Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Staging:N
daps
daps-fetch-source-git
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File daps-fetch-source-git of Package daps
#!/bin/bash # # # Create DAPS source tarball from GitHub # Needed because we would like to exclude unnecessary stuff from # the source RPM in order to keep it lean # # Copyright (C) 2015 SUSE Linux GmbH # # Author: # Frank Sundermeyer <fsundermeyer at opensuse dot org> # NAME=daps VERSION= SPECFILE=${NAME}.spec TMPDIR=$(mktemp -q -d --tmpdir daps_XXXXXXXX) #---------- # Functions #---------- # exit on error # function exit_on_error { echo -e "$1" # rm -rf $TMPDIR exit 1 } function help { echo -e "$(basename $0) <DAPS_ARCHIVE_FILENAME>\n" } #----- # MAIN #----- # # Check for archive file name # if [[ -z $1 ]]; then exit_on_error "Please specify a URl for a DAPS release archive on Github, e.g.\nhttps://github.com/openSUSE/daps/archive/daps-2.0-rc5.tar.gz" else ARCHIVE_URL="$1" ARCHIVE_NAME="${ARCHIVE_URL##*/}" fi # This script needs to be called from the daps osc checkout directory, so # lets check whether we are in the correct directory # if [[ ! -s daps.spec && ! -d .osc ]]; then echo "Looks like you are not in the daps checkout directory." read -p "Continue anyway (y/n) [n]: " CONT if [[ n = $CONT || N = $CONT ]]; then exit_on_error "Aborted by user." fi fi #----------- # Download archive # echo "Downloading archive:" (cd $TMPDIR && wget -nv $ARCHIVE_URL) || exit_on_error "Download of $ARCHIVE_URL failed" #----------- # Unpack archive # case ${ARCHIVE_NAME##*.} in zip) UNPACK="unzip" ARCHIVE_DIR=$(basename $ARCHIVE_NAME .zip) ;; gz) UNPACK="tar xfz" ARCHIVE_DIR=$(basename $ARCHIVE_NAME .tar.gz) ;; bz2) UNPACK="tar xfj" ARCHIVE_DIR=$(basename $ARCHIVE_NAME .tar.bz2) ;; *) exit_on_error "Unknown archive format" esac SRC_DIR=${TMPDIR}/${NAME} EXCLUDES=${SRC_DIR}/packaging/exclude-files_for_daps_package.txt (cd $TMPDIR && $UNPACK $ARCHIVE_NAME) || exit_on_error "Unpacking $ARCHIVE_NAME failed" mv ${TMPDIR}/${NAME}-${ARCHIVE_DIR}/ ${SRC_DIR}/ #----------- # Get the version number # VERSION=$(egrep "^Version:\s*" ${SRC_DIR}/packaging/$SPECFILE | sed 's/^Version:\s*//') if [[ -z $VERSION ]]; then exit_on_error "Couldn't get version number from spec-file." fi #----------- # Create the tarball # export BZIP2=--best tar cf ${NAME}-${VERSION}.tar -C ${TMPDIR} \ --exclude-from=$EXCLUDES ${NAME} || exit_on_error "Failed to create the tarball." bzip2 -9 ${NAME}-${VERSION}.tar echo "Successfully wrote source tarball ${NAME}-${VERSION}.tar.bz2" # # Copy the spec file if necessary # diff -q $SPECFILE ${SRC_DIR}/packaging/$SPECFILE >/dev/null if [[ 0 = $? ]]; then echo "Spec file is up-to-date." else cp ${SRC_DIR}/packaging/$SPECFILE . || exit_on_error "Failed to copy the specfile." echo "Successfully updated the spec file." fi #rm -rf ${TMPDIR} exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor