]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd_build_testrdepends
ENH: nd_build_testrdepends to get names of all binary packages build-depends of which...
[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 # All binary packages produced
38 pkgs=$(awk '/^Package:/{print $2;}' Packages)
39 cd - > /dev/null
40
41 echo "I: Fetching all bdepends for $pkgs in $family $dist under $arch"
42 # need first to provide the necessary scripts out there
43 cp -p $(dirname $0)/nd_fetch_bdepends $bindir
44 $CMD nd_execute $family $dist $arch --bindmounts $testdir $bindir/nd_fetch_bdepends $srcdir $pkgs
45
46 echo "I: preparing the hook"
47 cat << EOF >| $bindir/D00add_custom_repo
48 echo 'deb file://$debdir ./' >| /etc/apt/sources.list.d/custom.list
49 apt-get update
50 EOF
51 chmod a+x $bindir/D00add_custom_repo
52
53 echo "I: Going throught the packages and testing the builds"
54 cd $srcdir
55 summary_file=${testdir}.summary
56 echo -e "\nTesting builds against $dscfile" >> $summary_file
57 for dsc in *.dsc; do
58         echo " I: Building $dsc with native versions"
59         src=${dsc%%_*}
60         dscbase=${dsc%%.dsc}
61         nd_build $family $dist $arch $dsc --buildresult=$oldbuildsdir \
62                 && old=ok || old=FAILED
63         mv ${dscbase}_$arch.build $oldbuildsdir
64         echo " I: Building $dsc with new versions"
65         nd_build $family $dist $arch $dsc --buildresult=$newbuildsdir \
66                 --hookdir=$bindir --bindmount=$testdir \
67                 && new=ok || new="FAILED $newbuildsdir/${dscbase}_$arch.build"
68         mv ${dscbase}_$arch.build $newbuildsdir
69         printf '%-40s\t%5s\t%5s\n' $dsc "$old" "$new" >> $summary_file
70 done