X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/8c67a535e61f23ae8b1616bf82690e1b675691b2..5e9e7146d4fc4c365cf673a6458f9cfc0f9f801b:/bin/mdw-sbuild diff --git a/bin/mdw-sbuild b/bin/mdw-sbuild index 7bbeb3c..18f9901 100755 --- a/bin/mdw-sbuild +++ b/bin/mdw-sbuild @@ -33,9 +33,9 @@ fail_usage () { usage >&2; exit 1; } ###-------------------------------------------------------------------------- ### Parse options. -bogusp=nil noactp=nil -unset buildopts keyid -while getopts "haik:nt:" opt; do +bogusp=nil noactp=nil signp=nil +unset buildopts pkgs dbpargs +while getopts "haik:np:t:A:" opt; do case $opt in h) usage @@ -47,7 +47,9 @@ Options: -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. + -A ARGS Pass ARGS to \`dpkg-buildpackage'. EOF exit 0 ;; @@ -55,7 +57,12 @@ EOF i) buildopts="${buildopts+$buildopts }-i" ;; k) signp=t keyid=$OPTARG ;; n) buildopts="${buildopts+$buildopts }-n" noactp=t ;; + p) pkgs=$OPTARG ;; t) buildopts="${buildopts+$buildopts }-t$OPTARG" ;; + A) + buildopts="${buildopts+$buildopts }-A$OPTARG" + dbpargs="${dbpargs+$dbpargs }$OPTARG" + ;; *) bogusp=t ;; esac done @@ -66,6 +73,7 @@ case $# in 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. @@ -85,17 +93,30 @@ case ${ver+t} in t) ;; *) fail "can't figure out the package version" ;; esac ## Build a Debian source package. Don't sign anything yet. That will happen ## at the end, all in one go. -dpkg-buildpackage -S -uc -us +dpkg-buildpackage -S -uc -us -d -i $dbpargs cd .. dsc=${pkg}_${ver}.dsc [ -f "$dsc" ] || fail "where is my \`.dsc' file?" +## Actually do the build. Get a build directory assigned by the server, +## 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/" ./ case $rc in 0) ;; *) exit $rc ;; esac -case $?,${keyid+t},$noactp in - 0,t,nil) debsign -k"$keyid" "${pkg}_${ver}_"*.changes ;; + +## Merge the change files together, and maybe sign the result. +chchch=${pkg}_${ver}_source.changes +for i in "${pkg}_${ver}"_*.changes; do + case " $chchch " in *" $i "*) ;; *) chchch="$chchch $i" ;; esac +done +mergechanges -f $chchch +rm $chchch +case $signp in + t) debsign -k"$keyid" "${pkg}_${ver}_multi.changes" ;; esac + +###----- That's all, folks --------------------------------------------------