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