[720] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | #
|
---|
| 4 | # svn_build_prepare.sh:
|
---|
| 5 | # erzeugen des SPEC und der tar.gz. Ablegen in $DEST/buildsrc/src/PACKETNAME
|
---|
| 6 | # überprüfen ob projekt exisitert
|
---|
| 7 | # osc commit
|
---|
| 8 | # osc build
|
---|
| 9 | #
|
---|
| 10 | #
|
---|
| 11 |
|
---|
| 12 | [ -z "$BUILD_USES_SVN" ] && BUILD_USES_SVN="yes"
|
---|
| 13 |
|
---|
| 14 | BUILDUSER=$USER
|
---|
| 15 | [ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
|
---|
| 16 | BUILDTEMP=$DEST_DIR/buildsrc/
|
---|
| 17 |
|
---|
| 18 | if [ ! -r OSC_PACKAGE ]; then
|
---|
| 19 | echo "failed to read config file OSC_PACKAGE"
|
---|
| 20 | exit 1
|
---|
| 21 | fi
|
---|
| 22 |
|
---|
| 23 | OSC_PACKAGE=`cat OSC_PACKAGE`
|
---|
| 24 |
|
---|
[725] | 25 | svn_build_prepare.sh $*
|
---|
| 26 | RT=$?
|
---|
| 27 | if [ $RT -eq 1 ]; then
|
---|
| 28 | echo "nothing more to do"
|
---|
| 29 | exit 0
|
---|
| 30 | elif [ $RT -gt 1 ]; then
|
---|
| 31 | echo "error: failed to prepare sources"
|
---|
[722] | 32 | exit 1
|
---|
[725] | 33 | fi
|
---|
[720] | 34 |
|
---|
[722] | 35 | # TODO: get this info from svn_build_prepare.sh? seperate script?
|
---|
[720] | 36 | if [ -z "$1" ]; then
|
---|
| 37 | # without parameter, we are in source directory
|
---|
| 38 | SPECFILE=$(ls *.spec | awk '{print $1}')
|
---|
| 39 | PACKAGE=$(sed -n -e 's/^Name:\W*//pi' <$SPECFILE)
|
---|
[722] | 40 | # use Version from BUILDSRC,
|
---|
| 41 | # because it has been modified by svn_build_prepare
|
---|
| 42 | #VERSION=$(sed -n -e 's/^Version:\W*//pi' <$SPECFILE)
|
---|
| 43 | BUILDSRC_DIR=${BUILDTEMP}/src/${PACKAGE}
|
---|
| 44 | VERSION=$(sed -n -e 's/^Version:\W*//pi' <$BUILDSRC_DIR/$SPECFILE)
|
---|
[720] | 45 | fi
|
---|
| 46 |
|
---|
[722] | 47 | # RPMs can be handeld directly by osc
|
---|
| 48 | # elif [ -r "$1" ]; then
|
---|
| 49 | # # parameter is src.rpm file
|
---|
| 50 | # PACKAGE=`rpm -qp --qf "%{NAME}" $1`
|
---|
| 51 | # VERSION=`rpm -qp --qf "%{VERSION}" $1`
|
---|
[720] | 52 |
|
---|
| 53 | if [ -z "$PACKAGE" ]; then
|
---|
| 54 | echo "nothing to build found!"
|
---|
| 55 | exit 1
|
---|
| 56 | fi
|
---|
| 57 |
|
---|
[722] | 58 | echo "Version: $VERSION"
|
---|
[720] | 59 |
|
---|
| 60 | osc co $OSC_PACKAGE || {
|
---|
| 61 | # error message already from osc
|
---|
| 62 | exit 1
|
---|
| 63 | }
|
---|
| 64 | # rsync is not usable, because ":" is interpretaded as remote host
|
---|
| 65 | #rsync -av "$BUILDSRC_DIR/*" "$OSC_PACKAGE/."
|
---|
[722] | 66 | #cp -av $BUILDSRC_DIR/* $OSC_PACKAGE/.
|
---|
[720] | 67 |
|
---|
[722] | 68 | cd $OSC_PACKAGE
|
---|
[723] | 69 | # rsync -a: -rlptgoD
|
---|
| 70 | # but we don't want to check for timestamps
|
---|
[725] | 71 | # NOTE: this doesn't help, if the data (tar.bz2)
|
---|
| 72 | # contains dynamic data like the Changes file
|
---|
[723] | 73 | rsync --checksum -r -v --delete $BUILDSRC_DIR/. . --exclude .osc
|
---|
[720] | 74 |
|
---|
| 75 | # osc build DIST ARCH
|
---|
[722] | 76 | #osc add $FILELIST
|
---|
| 77 | osc addremove
|
---|
| 78 | osc commit -m "release $VERSION"
|
---|