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 |
|
---|
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"
|
---|
32 | exit 1
|
---|
33 | fi
|
---|
34 |
|
---|
35 | # TODO: get this info from svn_build_prepare.sh? seperate script?
|
---|
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)
|
---|
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)
|
---|
45 | fi
|
---|
46 |
|
---|
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`
|
---|
52 |
|
---|
53 | if [ -z "$PACKAGE" ]; then
|
---|
54 | echo "nothing to build found!"
|
---|
55 | exit 1
|
---|
56 | fi
|
---|
57 |
|
---|
58 | echo "Version: $VERSION"
|
---|
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/."
|
---|
66 | #cp -av $BUILDSRC_DIR/* $OSC_PACKAGE/.
|
---|
67 |
|
---|
68 | cd $OSC_PACKAGE
|
---|
69 | # rsync -a: -rlptgoD
|
---|
70 | # but we don't want to check for timestamps
|
---|
71 | # NOTE: this doesn't help, if the data (tar.bz2)
|
---|
72 | # contains dynamic data like the Changes file
|
---|
73 | rsync --checksum -r -v --delete $BUILDSRC_DIR/. . --exclude .osc
|
---|
74 |
|
---|
75 | # osc build DIST ARCH
|
---|
76 | #osc add $FILELIST
|
---|
77 | osc addremove
|
---|
78 | osc commit -m "release $VERSION"
|
---|