source: dassbuild/trunk/usr/bin/dassbuild_osc.sh@ 882

Last change on this file since 882 was 821, checked in by joergs, on Feb 3, 2010 at 9:41:34 PM

added support for multiple OSC_PACKAGES

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