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

Last change on this file since 757 was 753, checked in by joergs, on Jun 12, 2009 at 4:39:03 PM

adapt script name

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