From 680b320d315143b366d91ef46401b9bf7d5abb95 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 11 Apr 2011 14:50:41 +0000 Subject: Make sure we keep the original Distribution: git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@475 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- sbuild-stuff | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'sbuild-stuff') diff --git a/sbuild-stuff b/sbuild-stuff index 5f282fd..ebd59d5 100755 --- a/sbuild-stuff +++ b/sbuild-stuff @@ -9,7 +9,43 @@ if [ "${1:-}" == "--binary-only" ]; then shift else BINARCH=0 -fi; +fi + +if ! which grep-dctrl > /dev/null; then + echo "grep-dctrl not found. Maybe install dctrl-tools?" + exit 1 +fi +if ! which changestool > /dev/null; then + echo "changestool not found. Maybe install reprepro?" + exit 1 +fi + +get_metadata() { + local dsc="$1"; shift + + dsc="$(readlink -f "$dsc")" + local origtar="$(dcmd --orig $dsc)" + if ! [ -e "$origtar" ]; then + echo >&2 "File $origtar not found" + exit 1 + fi + local dirname="$(tar tzf $origtar | head -n1)" + dirname="${dirname%%/}" + + local tmpdir="`mktemp -d`" + pushd . >/dev/null + cd "$tmpdir" + + dpkg-source -x "$dsc" > /dev/null + cd "$dirname" + + local dist=$(dpkg-parsechangelog | grep-dctrl -n -s Distribution '') + local ver=$(dpkg-parsechangelog | grep-dctrl -n -s Version '') + + popd >/dev/null + rm -rf "$tmpdir" + echo "$dist $ver" +} DSC="${1:-}"; shift if [ -z "$DSC" ] || [ -z "$BINARCH" ]; then @@ -17,8 +53,8 @@ if [ -z "$DSC" ] || [ -z "$BINARCH" ]; then exit 1; fi -package=`echo $DSC | sed -e 's/_.*//'` -debian_version=`echo $DSC | sed -e 's/^[^_]*_//' -e s/\.dsc$//` +metadata="$(get_metadata "$DSC")" +read dscdist debian_version <<< "$metadata" if [ -z "${DIST:-}" ]; then DIST=sid @@ -49,3 +85,10 @@ else fi sbuild --arch="$ARCH" --dist="$DIST" --apt-update $extra "$DSC" + +changesfile="${DSC%.dsc}_$ARCH.changes" +if ! [ -e "$changesfile" ]; then + echo >&2 "Expected file $changesfile does not exist" + exit 1 +fi +changestool "$changesfile" setdistribution "$dscdist" -- cgit v1.2.3