Support supplying additional packages to the builder, in
`dist-BUILD.pkgs'. Release builds don't do this, for obvious reasons.
There's an annoying fiddle where we have to separate out the supplied
packages into per-architecture sets because sbuild is too stupid to do
this for itself and ends up using the wrong architecture.
yes,release)
case $sign in yes) sbuildargs="-k$signkey $sbuildargs" ;; esac
;;
yes,release)
case $sign in yes) sbuildargs="-k$signkey $sbuildargs" ;; esac
;;
+ yes,*)
+ if [ -d $toppath/dist-$build.pkgs ]; then
+ sbuildargs="-p$toppath/dist-$build.pkgs $sbuildargs"
+ fi
+ ;;
esac
case $sbuild,$build,$sign in
yes,*) run mdw-sbuild $sbuildargs ;;
esac
case $sbuild,$build,$sign in
yes,*) run mdw-sbuild $sbuildargs ;;
### Parse options.
bogusp=nil noactp=nil signp=nil
### Parse options.
bogusp=nil noactp=nil signp=nil
-unset buildopts
-while getopts "haik:nt:" opt; do
+unset buildopts pkgs
+while getopts "haik:np:t:" opt; do
-i Build only architecture-neutral packages.
-k KEYID Sign the result using KEYID.
-n Don't actually do the build.
-i Build only architecture-neutral packages.
-k KEYID Sign the result using KEYID.
-n Don't actually do the build.
+ -p DIR Upload additional packages from DIR.
-t TARGET Build in TARGET build environment.
EOF
exit 0
-t TARGET Build in TARGET build environment.
EOF
exit 0
i) buildopts="${buildopts+$buildopts }-i" ;;
k) signp=t keyid=$OPTARG ;;
n) buildopts="${buildopts+$buildopts }-n" noactp=t ;;
i) buildopts="${buildopts+$buildopts }-i" ;;
k) signp=t keyid=$OPTARG ;;
n) buildopts="${buildopts+$buildopts }-n" noactp=t ;;
t) buildopts="${buildopts+$buildopts }-t$OPTARG" ;;
*) bogusp=t ;;
esac
t) buildopts="${buildopts+$buildopts }-t$OPTARG" ;;
*) bogusp=t ;;
esac
esac
case $bogusp in t) fail_usage ;; esac
case $noactp in t) signp=nil ;; esac
esac
case $bogusp in t) fail_usage ;; esac
case $noactp in t) signp=nil ;; esac
+case ${pkgs-/hack} in /*) ;; *) pkgs=$(pwd)/$pkgs ;; esac
###--------------------------------------------------------------------------
### Main program.
###--------------------------------------------------------------------------
### Main program.
## upload the sources, run the build, and collect the results.
builddir=$(ssh "$host" mdw-sbuild-server dir "$pkg/$ver")
dcmd rsync -a "$dsc" "$host:$builddir/"
## upload the sources, run the build, and collect the results.
builddir=$(ssh "$host" mdw-sbuild-server dir "$pkg/$ver")
dcmd rsync -a "$dsc" "$host:$builddir/"
+case ${pkgs+t} in t) rsync -a "$pkgs/" "$host:$builddir/pkgs/" ;; esac
set +e; ssh "$host" mdw-sbuild-server $buildopts build "$builddir"
rc=$?; set -e
rsync -a "$host:$builddir/" ./
set +e; ssh "$host" mdw-sbuild-server $buildopts build "$builddir"
rc=$?; set -e
rsync -a "$host:$builddir/" ./
## racing with another process, but that's why we're trying in a loop.
if mkdir "$ver#$nn" >/dev/null 2>&1; then
winp=t
## racing with another process, but that's why we're trying in a loop.
if mkdir "$ver#$nn" >/dev/null 2>&1; then
winp=t
## Make sure we actually succeeded.
case $winp in t) ;; *) fail "failed to create build directory" ;; esac
## Make sure we actually succeeded.
case $winp in t) ;; *) fail "failed to create build directory" ;; esac
+ ## Make an empty directory for dependency packages.
+ mkdir -p pkgs/
+
## Done.
echo "$buildroot/$dist#$nn"
;;
## Done.
echo "$buildroot/$dist#$nn"
;;
nil) firstopt="$firstopt --debbuildopt=-A" ;;
esac
nil) firstopt="$firstopt --debbuildopt=-A" ;;
esac
+ ## Sort out the additional packages. This is rather annoying, because
+ ## sbuild(1) does this in a really stupid way.
+ rm -rf pkgs.*
+ for a in $buildarchs; do
+ mkdir pkgs.$a
+ for f in $(dpkg-scanpackages -a$a pkgs/ |
+ sed -n '/^Filename: /s///p')
+ do
+ ln $f pkgs.$a/
+ done
+ done
+
## Build a cheesy makefile to run these in parallel.
cat >build.mk <<EOF
### -*-makefile-*-
## Build a cheesy makefile to run these in parallel.
cat >build.mk <<EOF
### -*-makefile-*-
suite=\$\${full%%-*} target=\$\${full\#*-}; \\
{ echo started >build-status.\$\$full; \\
sbuild \\
suite=\$\${full%%-*} target=\$\${full\#*-}; \\
{ echo started >build-status.\$\$full; \\
sbuild \\
+ --extra-package=pkgs.\$\$target/ \\
--dist=\$\$suite --build=\$\$host --host=\$\$target \\
--chroot=\$\$suite-\$\$host --verbose \$1 \$(DSC); \\
rc=\$\$?; case \$\$rc in \\
--dist=\$\$suite --build=\$\$host --host=\$\$target \\
--chroot=\$\$suite-\$\$host --verbose \$1 \$(DSC); \\
rc=\$\$?; case \$\$rc in \\