[SCM] Debian packaging for sketch 3D line drawing software branch, master, updated. debian/0.2.183-1-12-g987b56c

David Bremner bremner at unb.ca
Sat Dec 18 14:52:15 UTC 2010


The following commit has been merged in the master branch:
commit 9d0915ad6931a4a698c125a7ffbe39337e3ffd23
Author: David Bremner <bremner at unb.ca>
Date:   Sat Dec 18 10:21:56 2010 -0400

    updated version of export-patches.sh from ron lee

diff --git a/debian/export-patches.sh b/debian/export-patches.sh
index 97b1df0..41c74dc 100644
--- a/debian/export-patches.sh
+++ b/debian/export-patches.sh
@@ -1,51 +1,53 @@
 #!/bin/sh
-# export patches according to a recipe in debian/git-patches
-# To use as a hook in gitpkg, 
-#   git config gitpkg.deb-export-hook debian/export-patches.sh
+# This script reads a list of revision ranges suitable for git format-patch
+# from the file debian/git-patches, one per line, and exports them to the
+# debian/patches directory in a form suitable for format 3.0(quilt) packages.
+# It is not required for creating such packages, but permits you to separate
+# out individual patches from what would otherwise be just a single blob.
+#
+# The revision ranges may include $DEB_VERSION and/or $UPSTREAM_VERSION, which
+# will be substituted according to the version of the package being exported.
+#
+# To enable this hook, use:
+# git config gitpkg.deb-export-hook /usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
+
+patch_list=debian/git-patches
+
+if [ ! -r "$patch_list" ]; then
+    echo "No $patch_list file, I guess you've pushed them all upstream."
+    echo "Good Work!"
+    exit 0
+fi
 
-trap cleanup INT 
-    
-# make this configable?
-recipe=debian/git-patches
 
-export GIT_DIR
 if [ -n "$REPO_DIR" ]; then
-    GIT_DIR=$REPO_DIR/.git
+    git_dir="--git-dir=$REPO_DIR/.git"
 else
     # support running as a free-standing script, without gitpkg
-    DEB_VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: \(.*:\|\)\(.*\)/\2/p')
+    DEB_VERSION="$(dpkg-parsechangelog | sed -rne 's/^Version: ([^:]+:)?//p')"
 fi;
 
-case $DEB_VERSION in
-    *-*)
-	DEB_UPSTREAM=${DEB_VERSION%-*}
-	;;
-    *)
-	DEB_UPSTREAM=$DEB_VERSION
-	;;
-esac
 
-tmpdir=$(mktemp -d patches.XXXXXXX)
+UPSTREAM_VERSION="${DEB_VERSION%-*}"
 
-cleanup (){
-    echo "cleaning up..."
-    rm -rf $tmpdir
-    exit 1
-}
+tmpdir=$(mktemp -d patches.XXXXXXX)
+count=1
 
 do_patches (){
-    while read -r base tip
+    while read -r line
     do
-	case $base in
+	[ -n "$line" ] || continue
+	case $line in
 	    \#*)
 		;;
 	    *)
-		count=$(wc -l $tmpdir/series | cut -f1 -d' ')
-		if PATCHES=$(git format-patch --start-number $count -N -o $tmpdir $base...$tip); then
-		    echo $PATCHES | sed -e "s%$tmpdir/%%g" -e 's% %\n%g'>> $tmpdir/series
+		if PATCHES="$(git "$git_dir" format-patch --start-number $count -N -o $tmpdir "$line")"; then
+		    echo "$PATCHES" | sed -e "s,$tmpdir/,,g" -e 's, ,\n,g'>> $tmpdir/series
+		    count=$(wc -l $tmpdir/series | cut -f1 -d' ')
 		else
-		    echo "git format-patch failed"
-		    cleanup
+		    echo "git $git_dir format-patch --start-number $count -N -o $tmpdir $line"
+		    echo "failed."
+		    exit 1
 		fi
 	esac
     done
@@ -53,15 +55,17 @@ do_patches (){
 
 echo "# Patches exported from git by gitpkg-export-patches" > $tmpdir/series
 
-sed -e s/%DEB_VERSION%/${DEB_VERSION}/g  -e s/%DEB_UPSTREAM%/${DEB_UPSTREAM}/ < $recipe | do_patches || exit 1
-
-count=$(wc -l $tmpdir/series | cut -f1 -d' ')
+sed -e "s/\$DEB_VERSION/$DEB_VERSION/g"			\
+    -e "s/\${DEB_VERSION}/$DEB_VERSION/g"		\
+    -e "s/\$UPSTREAM_VERSION/$UPSTREAM_VERSION/g"	\
+    -e "s/\${UPSTREAM_VERSION}/$UPSTREAM_VERSION/g"	\
+    < "$patch_list" | do_patches || exit 1
 
 if [ $count -gt 1 ]; then
     rm -rf debian/patches
     mv $tmpdir debian/patches
 else
     echo "No patches found: debian/patches left untouched"
-    cleanup
+    #XXX well, except we already mashed the series file ...
+    #     so what should we do here?  it's not really an error to have no patches
 fi
-

-- 
Debian packaging for sketch 3D line drawing software



More information about the debian-science-commits mailing list