source: trunk/technical/common/build/svn_osc_build.sh@ 720

Last change on this file since 720 was 720, checked in by joergs, on Oct 2, 2008 at 2:30:13 PM

tools for using the openSUSE build server

  • Property svn:executable set to *
File size: 2.3 KB
Line 
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
14BUILDUSER=$USER
15[ -z $DEST_DIR ] && DEST_DIR="/tmp/build.$BUILDUSER"
16BUILDTEMP=$DEST_DIR/buildsrc/
17
18if [ ! -r OSC_PACKAGE ]; then
19 echo "failed to read config file OSC_PACKAGE"
20 exit 1
21fi
22
23OSC_PACKAGE=`cat OSC_PACKAGE`
24
25
26
27if [ -z "$1" ]; then
28 # without parameter, we are in source directory
29 SPECFILE=$(ls *.spec | awk '{print $1}')
30 PACKAGE=$(sed -n -e 's/^Name:\W*//pi' <$SPECFILE)
31 VERSION=$(sed -n -e 's/^Version:\W*//pi' <$SPECFILE)
32elif [ -r "$1" ]; then
33 # parameter is src.rpm file
34 PACKAGE=`rpm -qp --qf "%{NAME}" $1`
35 VERSION=`rpm -qp --qf "%{VERSION}" $1`
36fi
37
38
39if [ -z "$PACKAGE" ]; then
40 echo "nothing to build found!"
41 exit 1
42fi
43
44BUILDSRC_DIR=${BUILDTEMP}/src/${PACKAGE}
45
46
47svn_build_prepare.sh $* || {
48 echo "failed to prepare sources"
49 exit 1
50}
51
52osc co $OSC_PACKAGE || {
53 # error message already from osc
54 exit 1
55}
56# rsync is not usable, because ":" is interpretaded as remote host
57#rsync -av "$BUILDSRC_DIR/*" "$OSC_PACKAGE/."
58cp -av $BUILDSRC_DIR/* $OSC_PACKAGE/.
59
60if [ "$BUILD_USES_SVN" = "yes" ]; then
61 echo "receiving subversion information ..."
62 # set RELEASE number (last modification in this directory)
63 # requires subversion (but connection to server isn't neccessary)
64 SVN_BUILD_RELEASE=$(unset LANG; svn info . | sed -n 's/^Last Changed Rev: \([0-9]*\)/\1/p')
65 # in case of local modification a "m" is added to the release number
66 SVN_BUILD_MODIFIED=$(svn status -v | grep "^ *M" | wc -l)
67 # checks if a file is commited,
68 # but update on its directory is not performed
69 SVN_LAST_MODIFICATION=$(svn status -v | sed -n 's/^ *[0-9]* *\([0-9]*\) .*/\1/p' | sort -n | tail -1)
70 if [ $SVN_BUILD_MODIFIED -gt 0 ]; then
71 SVN_BUILD_RELEASE=${SVN_BUILD_RELEASE}m
72 elif [ $SVN_LAST_MODIFICATION -ne $SVN_BUILD_RELEASE ]; then
73 SVN_BUILD_RELEASE=${SVN_BUILD_RELEASE}p
74 fi
75 echo "SVN_BUILD_RELEASE: $SVN_BUILD_RELEASE"
76fi
77
78cd $OSC_PACKAGE
79pwd
80#echo "OSC_PACKAGE"
81# osc build DIST ARCH
82osc add *
83if [ "$SVN_BUILD_RELEASE" ]; then
84 osc commit -m "release $SVN_BUILD_RELEASE"
85fi
Note: See TracBrowser for help on using the repository browser.