source: trunk/dassbuild/svn_osc_build.sh@ 739

Last change on this file since 739 was 739, checked in by joergs, on May 26, 2009 at 1:34:34 PM

changed from tar.bz2 to orig.tar.gz to be compatable with Debian, checks for OSC_LOCAL flag file

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