[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 |
|
---|
[722] | 25 | svn_build_prepare.sh $* || {
|
---|
| 26 | echo "failed to prepare sources"
|
---|
| 27 | exit 1
|
---|
| 28 | }
|
---|
[720] | 29 |
|
---|
[722] | 30 | # TODO: get this info from svn_build_prepare.sh? seperate script?
|
---|
[720] | 31 | if [ -z "$1" ]; then
|
---|
| 32 | # without parameter, we are in source directory
|
---|
| 33 | SPECFILE=$(ls *.spec | awk '{print $1}')
|
---|
| 34 | PACKAGE=$(sed -n -e 's/^Name:\W*//pi' <$SPECFILE)
|
---|
[722] | 35 | # use Version from BUILDSRC,
|
---|
| 36 | # because it has been modified by svn_build_prepare
|
---|
| 37 | #VERSION=$(sed -n -e 's/^Version:\W*//pi' <$SPECFILE)
|
---|
| 38 | BUILDSRC_DIR=${BUILDTEMP}/src/${PACKAGE}
|
---|
| 39 | VERSION=$(sed -n -e 's/^Version:\W*//pi' <$BUILDSRC_DIR/$SPECFILE)
|
---|
[720] | 40 | fi
|
---|
| 41 |
|
---|
[722] | 42 | # RPMs can be handeld directly by osc
|
---|
| 43 | # elif [ -r "$1" ]; then
|
---|
| 44 | # # parameter is src.rpm file
|
---|
| 45 | # PACKAGE=`rpm -qp --qf "%{NAME}" $1`
|
---|
| 46 | # VERSION=`rpm -qp --qf "%{VERSION}" $1`
|
---|
[720] | 47 |
|
---|
| 48 | if [ -z "$PACKAGE" ]; then
|
---|
| 49 | echo "nothing to build found!"
|
---|
| 50 | exit 1
|
---|
| 51 | fi
|
---|
| 52 |
|
---|
[722] | 53 | echo "Version: $VERSION"
|
---|
[720] | 54 |
|
---|
| 55 | osc co $OSC_PACKAGE || {
|
---|
| 56 | # error message already from osc
|
---|
| 57 | exit 1
|
---|
| 58 | }
|
---|
| 59 | # rsync is not usable, because ":" is interpretaded as remote host
|
---|
| 60 | #rsync -av "$BUILDSRC_DIR/*" "$OSC_PACKAGE/."
|
---|
[722] | 61 | #cp -av $BUILDSRC_DIR/* $OSC_PACKAGE/.
|
---|
[720] | 62 |
|
---|
[722] | 63 | cd $OSC_PACKAGE
|
---|
| 64 | rsync -a --delete $BUILDSRC_DIR/. . --exclude .osc
|
---|
[720] | 65 |
|
---|
| 66 | # osc build DIST ARCH
|
---|
[722] | 67 | #osc add $FILELIST
|
---|
| 68 | osc addremove
|
---|
| 69 | osc commit -m "release $VERSION"
|
---|