]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_build_testrdepends
BF: ~ must be escaped while used as default for bp_version_prefix
[neurodebian.git] / tools / nd_build_testrdepends
1 #!/bin/bash
2
3 # no undefined
4 set -u
5 # no failures
6 set -e
7
8 CMD=
9 #echo
10
11 family=$1
12 dist=$2
13 arch=$3      # limit to 1 for now
14
15 dscfile=$4
16 dscfilef=$(readlink -f $dscfile)
17 dscfilef_base=${dscfilef%%.dsc}
18
19 pkg=${dscfile%_*}
20
21 #? TODO -- should be a parameter as well?
22
23 testdir=${dscfilef_base}_$arch.testrdepends.$family-$dist
24 bindir=$testdir/bin
25 debdir=$testdir/debs
26 srcdir=$testdir/srcs
27 oldbuildsdir=$srcdir/old
28 newbuildsdir=$srcdir/new
29
30 echo "I: Building the new package for $pkg"
31
32 mkdir -p $debdir $srcdir $bindir
33 $CMD nd_build $family $dist $arch $dscfile --buildresult=$debdir
34
35 cd $debdir
36 dpkg-scanpackages . >| Packages
37 cd - > /dev/null
38
39 echo "I: Fetching all bdepends for $pkg in $family $dist under $arch"
40 # need first to provide the necessary scripts out there
41 cp -p $(dirname $0)/nd_fetch_bdepends $bindir
42 $CMD nd_execute $family $dist $arch --bindmounts $testdir $bindir/nd_fetch_bdepends $pkg $srcdir
43
44 echo "I: preparing the hook"
45 cat << EOF >| $bindir/D00add_custom_repo
46 echo 'deb file://$debdir ./' >| /etc/apt/sources.list.d/custom.list
47 apt-get update
48 EOF
49 chmod a+x $bindir/D00add_custom_repo
50
51 echo "I: Going throught the packages and testing the builds"
52 cd $srcdir
53 summary_file=${testdir}.summary
54 echo -e "\nTesting builds against $dscfile" >> $summary_file
55 for dsc in *.dsc; do
56         echo " I: Building $dsc with native versions"
57         src=${dsc%%_*}
58         dscbase=${dsc%%.dsc}
59         nd_build $family $dist $arch $dsc --buildresult=$oldbuildsdir \
60                 && old=ok || old=FAILED
61         mv ${dscbase}_$arch.build $oldbuildsdir
62         echo " I: Building $dsc with new versions"
63         nd_build $family $dist $arch $dsc --buildresult=$newbuildsdir \
64                 --hookdir=$bindir --bindmount=$testdir \
65                 && new=ok || new="FAILED $newbuildsdir/${dscbase}_$arch.build"
66         mv ${dscbase}_$arch.build $newbuildsdir
67         printf '%-40s\t%5s\t%5s\n' $dsc "$old" "$new" >> $summary_file
68 done