[720] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | #
|
---|
[759] | 4 | # dassbuild_prepare.sh:
|
---|
| 5 | # creates the directory $DEST/buildsrc/src/$NAME
|
---|
| 6 | # and stores there the modified SPEC-file
|
---|
| 7 | # and the generated tar.gz-archive
|
---|
[720] | 8 | #
|
---|
| 9 |
|
---|
[759] | 10 |
|
---|
[739] | 11 | # environment variables:
|
---|
| 12 | # OSBS_PROJECT (e.g. home:dassit) or config file "OSC_PACKAGE" (e.g. home:dassit/dasscm)
|
---|
| 13 |
|
---|
[720] | 14 | BUILDUSER=$USER
|
---|
| 15 | [ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
|
---|
| 16 | BUILDTEMP=$DEST_DIR/buildsrc/
|
---|
| 17 |
|
---|
[739] | 18 | if [ -r OSC_LOCAL ]; then
|
---|
| 19 | LOCAL_BUILD="yes"
|
---|
[720] | 20 | fi
|
---|
| 21 |
|
---|
| 22 |
|
---|
[750] | 23 | dassbuild_prepare.sh $*
|
---|
[725] | 24 | RT=$?
|
---|
| 25 | if [ $RT -eq 1 ]; then
|
---|
| 26 | echo "nothing more to do"
|
---|
| 27 | exit 0
|
---|
| 28 | elif [ $RT -gt 1 ]; then
|
---|
| 29 | echo "error: failed to prepare sources"
|
---|
[722] | 30 | exit 1
|
---|
[725] | 31 | fi
|
---|
[720] | 32 |
|
---|
[722] | 33 | # TODO: get this info from svn_build_prepare.sh? seperate script?
|
---|
[720] | 34 | if [ -z "$1" ]; then
|
---|
| 35 | # without parameter, we are in source directory
|
---|
| 36 | SPECFILE=$(ls *.spec | awk '{print $1}')
|
---|
| 37 | PACKAGE=$(sed -n -e 's/^Name:\W*//pi' <$SPECFILE)
|
---|
[722] | 38 | # use Version from BUILDSRC,
|
---|
| 39 | # because it has been modified by svn_build_prepare
|
---|
| 40 | #VERSION=$(sed -n -e 's/^Version:\W*//pi' <$SPECFILE)
|
---|
| 41 | BUILDSRC_DIR=${BUILDTEMP}/src/${PACKAGE}
|
---|
| 42 | VERSION=$(sed -n -e 's/^Version:\W*//pi' <$BUILDSRC_DIR/$SPECFILE)
|
---|
[720] | 43 | fi
|
---|
| 44 |
|
---|
[722] | 45 | # RPMs can be handeld directly by osc
|
---|
| 46 | # elif [ -r "$1" ]; then
|
---|
| 47 | # # parameter is src.rpm file
|
---|
| 48 | # PACKAGE=`rpm -qp --qf "%{NAME}" $1`
|
---|
| 49 | # VERSION=`rpm -qp --qf "%{VERSION}" $1`
|
---|
[720] | 50 |
|
---|
| 51 | if [ -z "$PACKAGE" ]; then
|
---|
| 52 | echo "nothing to build found!"
|
---|
| 53 | exit 1
|
---|
| 54 | fi
|
---|
| 55 |
|
---|
[722] | 56 | echo "Version: $VERSION"
|
---|
[720] | 57 |
|
---|
[739] | 58 | #
|
---|
| 59 | # get the openSUSE build service project
|
---|
| 60 | # check for file "OSC_PACKAGE" first,
|
---|
| 61 | # if it is not found, use the variable OSBC_PROJECT
|
---|
| 62 | #
|
---|
| 63 | if [ -r OSC_PACKAGE ]; then
|
---|
| 64 | OSC_PACKAGE=`cat OSC_PACKAGE`
|
---|
| 65 | elif [ "$OSBS_PROJECT" ]; then
|
---|
| 66 | OSC_PACKAGE="$OSBS_PROJECT/$PACKAGE"
|
---|
| 67 | else
|
---|
| 68 | OSC_PACKAGE="home:$BUILDUSER/$PACKAGE"
|
---|
| 69 | fi
|
---|
| 70 |
|
---|
| 71 | # remove double slashes (/)
|
---|
| 72 | OSC_PACKAGE=`sed 's|/[/]*|/|g' <<< $OSC_PACKAGE`
|
---|
| 73 |
|
---|
[720] | 74 | osc co $OSC_PACKAGE || {
|
---|
[739] | 75 | echo
|
---|
| 76 | echo 'An existing "openSUSE Build Service" project must be specified.'
|
---|
| 77 | echo 'To specify it, use the config file OSC_PACKAGE or the environment variable OSBS_PROJECT'
|
---|
[720] | 78 | exit 1
|
---|
| 79 | }
|
---|
| 80 | # rsync is not usable, because ":" is interpretaded as remote host
|
---|
| 81 | #rsync -av "$BUILDSRC_DIR/*" "$OSC_PACKAGE/."
|
---|
[722] | 82 | #cp -av $BUILDSRC_DIR/* $OSC_PACKAGE/.
|
---|
[720] | 83 |
|
---|
[739] | 84 | cd $OSC_PACKAGE || exit 1
|
---|
[723] | 85 | # rsync -a: -rlptgoD
|
---|
| 86 | # but we don't want to check for timestamps
|
---|
[725] | 87 | # NOTE: this doesn't help, if the data (tar.bz2)
|
---|
| 88 | # contains dynamic data like the Changes file
|
---|
[723] | 89 | rsync --checksum -r -v --delete $BUILDSRC_DIR/. . --exclude .osc
|
---|
[720] | 90 |
|
---|
[739] | 91 | if [ "$LOCAL_BUILD" ]; then
|
---|
| 92 | echo 'skipped. Use
|
---|
| 93 | # local build:
|
---|
| 94 | # osc repos | while read DIST ARCH; do osc build --no-verify $DIST $ARCH; done
|
---|
| 95 | # '
|
---|
| 96 | else
|
---|
| 97 | osc addremove
|
---|
| 98 | osc commit -m "release $VERSION"
|
---|
| 99 | fi
|
---|
| 100 |
|
---|