5 Script to build a source package in one of the available cowbuilders.
10 nd_build <family> <codename> [arch] <dsc file> [cowbuilder options]
16 Build for a single specific arch:
18 nd_build nd+debian lenny i386 someting.dsc
21 Build for all archs (will just build once for arch 'all'):
23 nd_build ubuntu jaunty something.dsc
26 Build the same way but don't put results in current dir:
28 nd_build debian sid something.dsc --buildresult to-upload/
39 if [ -z "$family" ]; then
40 echo "You need to provide a distribution family ('debian', 'ubuntu'); prefix with 'nd+' to enable the NeuroDebian repository."
44 if [ -z "$dist" ]; then
45 echo "You need to provide a distribution codename (e.g. 'lenny', 'squeeze')."
49 . /etc/neurodebian/cmdsettings.sh
52 opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace"
55 echo "You need to provide a .dsc file"
59 if [ ! "$3" = "${3%*.dsc}" ]; then
61 # must already be the dsc file, hence no arch info given
62 if [ "$(grep '^Architecture' $dscfile | awk '{ print $2 }')" = "all" ]; then
63 echo "Arch 'all' package detected -- using amd64 system to build it"
70 # must be arch given and dsc as 4th
73 if [ -z "$dscfile" ]; then
74 echo "You need to provide a .dsc file"
77 shift; shift; shift; shift
80 # failed will be set to 1 if any build fails
85 if [ "$a" = "amd64" ]; then
86 # only force source into the upload for NeuroDebian
87 if [ ! "$family" = "${family#nd+*}" ]; then
88 options="$opts --debbuildopts -sa"
91 options="$opts --debbuildopts -B"
94 echo "Building for $family $dist $a ..."
95 buildfile="${dscfile%.dsc}_${a}.build"
96 tsfile="${buildfile}.timestamp.`date +%s`" # "unique" timestamp file
97 /usr/bin/time -f "%E real, %U user, %S sys, %O out" -o "${tsfile}" \
98 cowbuilder --build $dscfile \
99 --basepath ${cowbuilderroot}/cow/${family}-${dist}-${a}.cow \
101 --logfile "${buildfile}" \
103 "$@" && status='OK' || { status='FAILED'; failed=1; }
104 timeinfo=$(tail -n 1 "${tsfile}")
105 # Update the summary of builds
106 touch summary.build # Assure existence
107 sed -i -e "s/\(${buildfile}.*out$\)/\1 OLD/g" summary.build # Mark previous entry as OLD
108 echo -e "${buildfile}\t$status\t$timeinfo" >> summary.build # Add current one
111 # Exit with failure status if any built failed
112 [ -z $failed ] || exit 1