]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_build
Adjust path for new location of tools.
[neurodebian.git] / tools / nd_build
1 #!/bin/bash
2
3 if [ -z "$1" ]; then
4 cat << EOT
5 Script to build a source package in one of the available cowbuilders.
6
7 Synopsis
8 --------
9
10   nd_build <family> <codename> [arch] <dsc file> [cowbuilder options]
11
12
13 Examples
14 --------
15
16 Build for a single specific arch:
17
18   nd_build nd+debian lenny i386 someting.dsc
19
20
21 Build for all archs (will just build once for arch 'all'):
22
23   nd_build ubuntu jaunty something.dsc
24
25
26 Build the same way but don't put results in current dir:
27
28   nd_build debian sid something.dsc --buildresult to-upload/
29
30 EOT
31 exit 1
32 fi
33
34 . /home/cowbuilder/neurodebian.git/tools/nd_cmdsettings.sh
35
36 # common options
37 opts="--distribution $dist --aptcache $aptcache --buildplace $buildplace"
38
39 if [ -z "$3" ]; then
40   echo "You need to provide a .dsc file"
41   exit 1
42 fi
43
44 if [ ! "$3" = "${3%*.dsc}" ]; then
45   dscfile=$3
46   # must already be the dsc file, hence no arch info given
47   if [ "$(grep '^Architecture' $dscfile | awk '{ print $2 }')" = "all" ]; then
48     echo "Arch 'all' package detected -- using amd64 system to build it"
49     arch="amd64"
50   else
51     arch="i386 amd64"
52   fi
53   shift; shift; shift
54 else
55   # must be arch given and dsc as 4th
56   arch=$3
57   dscfile=$4
58   if [ -z "$dscfile" ]; then
59     echo "You need to provide a .dsc file"
60     exit 1
61   fi
62   shift; shift; shift; shift
63 fi
64
65 for a in $arch; do
66   echo "Building for $family $dist $a ..."
67   cowbuilder --build $dscfile \
68              --basepath ${cowbuilderroot}/cow/${family}-${dist}-${a}.cow \
69              --buildresult . \
70              $opts \
71              $*
72 done