chiark / gitweb /
el/dot-emacs.el: Better fontification for Ediff.
[profile] / bin / mdw-sbuild
index 84c24d8958c7cbebe66a1b388c47c7049c6954c8..5630dab8960efa5b1a538e27e9bb0c5216c03328 100755 (executable)
@@ -33,8 +33,8 @@ fail_usage () { usage >&2; exit 1; }
 ###--------------------------------------------------------------------------
 ### Parse options.
 
-bogusp=nil noactp=nil
-unset buildopts keyid
+bogusp=nil noactp=nil signp=nil
+unset buildopts
 while getopts "haik:nt:" opt; do
   case $opt in
     h)
@@ -53,7 +53,7 @@ EOF
       ;;
     a) buildopts="${buildopts+$buildopts }-a" ;;
     i) buildopts="${buildopts+$buildopts }-i" ;;
-    k) keyid=$OPTARG ;;
+    k) signp=t keyid=$OPTARG ;;
     n) buildopts="${buildopts+$buildopts }-n" noactp=t ;;
     t) buildopts="${buildopts+$buildopts }-t$OPTARG" ;;
     *) bogusp=t ;;
@@ -65,6 +65,7 @@ case $# in
   *) bogusp=t ;;
 esac
 case $bogusp in t) fail_usage ;; esac
+case $noactp in t) signp=nil ;; esac
 
 ###--------------------------------------------------------------------------
 ### Main program.
@@ -82,29 +83,29 @@ EOF
 case ${pkg+t} in t) ;; *) fail "can't figure out the package name" ;; esac
 case ${ver+t} in t) ;; *) fail "can't figure out the package version" ;; esac
 
-## Build a Debian source package.  If we're signing, use `dpkg-buildpackage'
-## for this so that we get an uploadable `_source.changes' file out the end
-## of it.
-case ${keyid+t},$noactp in
-  t,nil)
-    dpkg-buildpackage -S -k"$keyid"
-    cd ..
-    ;;
-  *)
-    dir=$(pwd); base=${dir##*/}
-    cd ..
-    dpkg-source -b "$base"
-    ;;
-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
+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/"
 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