From: martin f. krafft Date: Thu, 24 Apr 2008 18:22:10 +0000 (+0200) Subject: initial checkin X-Git-Url: https://git.madduck.net/code/mbuild.git/commitdiff_plain/74486b127a521eb20a034bb22210005ca67dabd2?ds=sidebyside initial checkin --- 74486b127a521eb20a034bb22210005ca67dabd2 diff --git a/mbuild.sh b/mbuild.sh new file mode 100755 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 +# 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"