madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

initial checkin
authormartin f. krafft <madduck@clegg.madduck.net>
Thu, 24 Apr 2008 18:22:10 +0000 (20:22 +0200)
committermartin f. krafft <madduck@clegg.madduck.net>
Thu, 24 Apr 2008 18:22:10 +0000 (20:22 +0200)
mbuild.sh [new file with mode: 0755]

diff --git a/mbuild.sh b/mbuild.sh
new file mode 100755 (executable)
index 0000000..2b4f5b4
--- /dev/null
+++ b/mbuild.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# mbuild - make sbuild and reprepro work together
+#
+# Copyright (c) 2008 martin f. krafft <madduck@debian.org>
+# Released under the terms of the Artistic Licence 2.0.
+#
+set -eu
+
+BUNDLEDIR="$HOME/reprepro/bundles"
+REPREPRODIR="$HOME/reprepro"
+
+DINSTALL="reprepro --basedir $REPREPRODIR include \$dist"
+
+GNUPGHOME="$REPREPRODIR/.gnupg"; export GNUPGHOME
+KEYID=330c4a75
+
+DIR="$HOME/sbuild"
+cd "$DIR"
+
+sbuild_args=
+schangesfile=
+arch=
+dist=
+for opt in "$@"; do
+  case "$opt" in
+    --arch=*) arch="${opt#--arch=}";;
+    --dist=*) dist="${opt#--dist=}";;
+    -sa) sbuild_args="${sbuild_args:+$sbuild_args }--force-orig-source";;
+    --*) sbuild_args="${sbuild_args:+$sbuild_args }$opt";;
+    *_source.changes)
+      if [ -z "$schangesfile" ]; then
+        if [ -f "$opt" ] && [ -r "$opt" ]; then
+          schangesfile="$opt"
+        else
+          echo "E: file does not exist: $opt" >&2
+          exit 1
+        fi
+      else
+        echo "E: cannot pass more than one source changes file: $opt" >&2
+        exit 1
+      fi
+      ;;
+    *)
+      echo "E: unknown option: $opt" >&1
+      exit 1
+      ;;
+  esac
+done
+
+schangesfile_basename="${schangesfile##*/}"
+packagenameversion="${schangesfile_basename%_*}"
+
+builddir="$(mktemp -dp "$DIR" "${packagenameversion}.XXXXXXXX")"
+trap "rm -R '$builddir'" 0
+
+cd "${schangesfile%/*}"
+dcmd cp "${schangesfile##*/}" "$builddir"
+schangesfile="$schangesfile_basename"
+
+cd "$builddir"
+
+sbuild $sbuild_args --arch="$arch" --arch-all --dist="$dist" --keyid=$KEYID \
+  "$packagenameversion".dsc
+
+changesfile="${packagenameversion}_${arch}.changes"
+
+$SHELL
+
+eval $DINSTALL "$schangesfile"
+eval $DINSTALL "$changesfile"
+
+mv "$changesfile" "${changesfile}.binonly"
+mergechanges "$schangesfile" "${changesfile}.binonly" > "$changesfile"
+rm "${changesfile}.binonly" "$schangesfile"
+
+bundle="$BUNDLEDIR/${packagenameversion}.bundle.tar"
+dcmd tar -chf "$bundle" "$changesfile"
+
+rm -r "$builddir"
+trap - 0
+
+echo "Bundle available at $bundle"