/[fai]/branches/experimental/build-on-alioth
ViewVC logotype

Contents of /branches/experimental/build-on-alioth

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5790 - (show annotations) (download)
Fri May 28 11:29:35 2010 UTC (3 years ago) by mt
File size: 5725 byte(s)
make sure all files belong to the "fai" group
1 #!/bin/bash
2
3 mangle_version_number() {
4 dh_testdir || exit 3
5 trunk_vers="`dpkg-parsechangelog | grep ^Version: | awk '{ print $2 }'`"
6 if [ ! -f $storage/LATEST_BUILD ] ; then
7 echo "$trunk_vers+experimental1" > $storage/LATEST_BUILD
8 else
9 cp $storage/LATEST_BUILD $storage/LATEST_BUILD.successful
10 rm -f $storage/LATEST_BUILD
11 if dpkg --compare-versions $trunk_vers gt $(<$storage/LATEST_BUILD.successful) ; then
12 echo "$trunk_vers+experimental1" > $storage/LATEST_BUILD
13 else
14 beta_level="`cat $storage/LATEST_BUILD.successful | sed 's/.*+experimental//'`"
15 beta_level=$((beta_level + 1))
16 echo "$trunk_vers+experimental$beta_level" > $storage/LATEST_BUILD
17 fi
18 fi
19 }
20
21 build_changelog() {
22 dh_testdir || exit 3
23 mv debian/changelog debian/changelog.orig
24 echo "fai ($(<$storage/LATEST_BUILD)) unstable; urgency=low" > debian/changelog.new
25 echo >> debian/changelog.new
26 echo " * Experimental FAI based on SVN r$REV" >> debian/changelog.new
27 for i in `quilt series` ; do
28 author="`quilt header $i | sed -n 1p | sed 's/^[[:digit:] -]*//'`"
29 quilt header $i | sed '/^[[:space:]]*$/d' | sed '/^[^[:space:]]/d' | \
30 sed "s/^[[:space:]]*\*/ [ $author ]\n&/" | \
31 sed 's/^[[:space:]]\+/ /' | sed 's/^[[:space:]]*\[/ [/' | \
32 sed 's/^[[:space:]]*\*/ */' >> debian/changelog.new
33 done
34 echo >> debian/changelog.new
35 echo " -- FAI Developers <linux-fai-devel@uni-koeln.de> `date -R`" >> debian/changelog.new
36 echo >> debian/changelog.new
37 cat debian/changelog.new | perl -n -e '
38 if(/^ (\[.*\])$/) {
39 if($1 ne $author) {
40 $author=$1;
41 } else {
42 next;
43 }
44 }
45 print "$_";' > debian/changelog
46 cat debian/changelog.orig >> debian/changelog
47 rm debian/changelog.orig debian/changelog.new
48 }
49
50 REPOS="$1"
51 REV="$2"
52
53 set -v -x
54
55 storage=/org/alioth.debian.org/chroot/home/groups/fai
56 log=`mktemp -t faiXXX`
57 date > $log
58
59 tmppatch=`mktemp -t faiXXX`
60 cat > $tmppatch << "EOF"
61 --- debian/rules (revision 5044)
62 +++ debian/rules (working copy)
63 @@ -1,5 +1,7 @@
64 #!/usr/bin/make -f
65
66 +include /usr/share/quilt/quilt.make
67 +
68 DESTDIR=`pwd`/debian/tmp
69 DOCDIR=`pwd`/debian/fai-doc/usr/share/doc/fai-doc
70
71 @@ -12,7 +14,7 @@
72 include VERSION
73
74 build: build-stamp
75 -build-stamp:
76 +build-stamp: patch
77 dh_testdir
78
79 # Add here commands to compile the package.
80 @@ -20,7 +22,7 @@
81
82 touch build-stamp
83
84 -clean:
85 +clean: unpatch
86 dh_testdir
87 # dh_testroot
88 rm -f build-stamp
89 EOF
90
91 {
92
93 set -e
94
95 # make sure no other build is running concurrently
96 for i in `seq 1 21` ; do
97 if [ $i -eq 21 ] ; then
98 echo "Timed out!" 1>&2
99 exit 1
100 fi
101 if [ -e $storage/BUILDING ] ; then
102 sleep 5
103 else
104 > $storage/BUILDING
105 break
106 fi
107 done
108
109 # check arguments
110 test -n "$REV" -a -n "$REPOS"
111
112 # quilt must be available
113 test -e /usr/bin/quilt
114
115 # checkout the directories, if necessary
116 if [ ! -d $storage/trunk-w-exp ] ; then
117 svn co -r $REV file:///srv/svn.debian.org/svn/fai/trunk $storage/trunk-w-exp
118 chmod -R g+wX $storage/trunk-w-exp
119 find $storage/trunk-w-exp -type d -exec chmod g+s {} \;
120 fi
121 if [ ! -d $storage/trunk-w-exp/debian/patches ] ; then
122 svn co -r $REV file:///srv/svn.debian.org/svn/fai/branches/experimental/patches $storage/trunk-w-exp/debian/patches
123 chmod -R g+wX $storage/trunk-w-exp/debian/patches
124 find $storage/trunk-w-exp/debian/patches -type d -exec chmod g+s {} \;
125 fi
126
127 # is this a commit to experimental?
128 if svnlook dirs-changed -r $REV $REPOS | grep '^branches/experimental/' ; then
129 rm -f $storage/trunk-w-exp/debian/source.lintian-overrides
130 svn revert $storage/trunk-w-exp/debian/rules
131 svn revert $storage/trunk-w-exp/debian/changelog
132 svn up -r $REV $storage/trunk-w-exp
133 svn up -r $REV $storage/trunk-w-exp/debian/patches
134 cd $storage
135 rm -f fai*.deb fai*.changes fai*.dsc fai*.tar.gz
136 cd trunk-w-exp
137 export QUILT_PC=$PWD/debian/.pc
138 export QUILT_PATCHES=$PWD/debian/patches
139 mangle_version_number
140 patch -p0 < $tmppatch
141 echo "fai source: patch-modifying-debian-files" >> debian/source.lintian-overrides
142 echo "fai source: missing-build-dependency quilt" >> debian/source.lintian-overrides
143 build_changelog
144 dpkg-buildpackage -uc -us -d -I.svn -rfakeroot && dpkg_exit=$? || dpkg_exit=$?
145 chmod -fR g+wX $storage/trunk-w-exp || true
146 chgrp -fR fai $storage/trunk-w-exp || true
147 debian/rules clean
148 echo "STATUS: dpkg-buildpackage exited with status $dpkg_exit"
149 cd ..
150 if [ $dpkg_exit -eq 0 ] ; then
151 rm -f $storage/LATEST_BUILD.successful
152 vers="$(<$storage/LATEST_BUILD)"
153 if [ -x /usr/bin/lintian ] ; then
154 lintian -iI *$vers*.dsc *$vers*.deb
155 fi
156 rm -f htdocs/fai*.deb htdocs/fai*.changes htdocs/fai*.dsc htdocs/fai*.tar.gz
157 mv *$vers* htdocs/
158 cd htdocs
159 md5sum *$vers* | mail -s "FAI:$vers:$REV" -c mt@debian.org fai-experimental-upload@informatik.uni-koeln.de
160 else
161 who_did_it="`svnlook author -r $REV $REPOS`"
162 if [ -f $storage/LATEST_BUILD.successful ] ; then
163 mv $storage/LATEST_BUILD.successful $storage/LATEST_BUILD
164 else
165 rm $storage/LATEST_BUILD
166 fi
167 REPLYTO="mt@debian.org" mail -s "FAI build of $REV failed!" -c mt@debian.org $who_did_it@alioth.debian.org < $log
168 fi
169 else
170 echo "STATUS: nothing to be done"
171 fi
172
173 echo "STATUS: build exit status $?"
174
175 } 2>&1 | tee $log
176
177 date >> $log
178
179 err_found=0
180 if ! grep -q "^STATUS: build exit status 0" $log ; then
181 err_found=1
182 elif ! grep -q "^STATUS: dpkg-buildpackage exited with status 0" $log ; then
183 if ! grep -q "^STATUS: nothing to be done" $log ; then
184 err_found=1
185 fi
186 fi
187
188 if [ $err_found -eq 1 ] ; then
189 mail -s "FAI build of $REV failed!" mt@alioth.debian.org < $log
190 mv $log $storage/buildlog.failed.$REV
191 fi
192
193 rm -f $log $tmppatch $storage/BUILDING
194

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5