[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.4.1-34-ga9af703

Stephane Glondu steph at glondu.net
Sun Jul 12 17:12:22 UTC 2009


The following commit has been merged in the master branch:
commit a9af703d28382f44a3d41fb590adb8b10c5da9d6
Author: Stephane Glondu <steph at glondu.net>
Date:   Sun Jul 12 16:38:10 2009 +0200

    More genericity in dom-{apply,save}-patches
    
    Give the possibility to specify patch, master and upstream branches
    with environment variables or gbp.conf.

diff --git a/tools/dom-apply-patches b/tools/dom-apply-patches
index f6bde28..03d6d89 100755
--- a/tools/dom-apply-patches
+++ b/tools/dom-apply-patches
@@ -1,7 +1,27 @@
 #!/bin/sh
 set -e
 
-PATCH_BRANCH="patch-queue"
+PATCH_BRANCH="${PATCH_BRANCH:-patch-queue}"
+GBP_CONF="${GBP_CONF:-debian/gbp.conf}"
+
+if [ -z "$MASTER_BRANCH" ]; then
+    if [ -f "$GBP_CONF" ]; then
+        MASTER_BRANCH=`awk -F' *= *' '/debian-branch/{print $2}' "$GBP_CONF"`
+	echo $MASTER_BRANCH
+    fi
+    MASTER_BRANCH="${MASTER_BRANCH:-master}"
+fi
+
+if [ -z "$UPSTREAM_BRANCH" ]; then
+    if [ -f "$GBP_CONF" ]; then
+        UPSTREAM_BRANCH=`awk -F' *= *' '/upstream-branch/{print $2}' "$GBP_CONF"`
+	echo $UPSTREAM_BRANCH
+    fi
+    UPSTREAM_BRANCH="${UPSTREAM_BRANCH:-upstream}"
+fi
+
+echo "Debian branch is $MASTER_BRANCH"
+echo "Upstream branch is $UPSTREAM_BRANCH"
 
 error () {
     echo "E: $1"
@@ -11,11 +31,11 @@ error () {
 if [ -n "`git branch | grep $PATCH_BRANCH`" ]; then
     error "There is already a branch $PATCH_BRANCH"
 else
-    git checkout -b $PATCH_BRANCH upstream
+    git checkout -b "$PATCH_BRANCH" "$UPSTREAM_BRANCH"
 
-    ## When master:debian/patches/series doesn't exist, git cat-file
+    ## When $MASTER_BRANCH:debian/patches/series doesn't exist, git cat-file
     ## will produce an empty output (along with an error on stderr).
-    for patch in `git cat-file -p master:debian/patches/series 2>/dev/null`; do
-	git cat-file -p master:debian/patches/$patch | git am;
+    for patch in `git cat-file -p "$MASTER_BRANCH":debian/patches/series 2>/dev/null`; do
+	git cat-file -p "$MASTER_BRANCH":debian/patches/$patch | git am;
     done
 fi
diff --git a/tools/dom-save-patches b/tools/dom-save-patches
index 92ad97b..efe2745 100755
--- a/tools/dom-save-patches
+++ b/tools/dom-save-patches
@@ -1,7 +1,25 @@
 #!/bin/sh
 set -e
 
-PATCH_BRANCH="patch-queue"
+PATCH_BRANCH="${PATCH_BRANCH:-patch-queue}"
+GBP_CONF="${GBP_CONF:-debian/gbp.conf}"
+
+if [ -z "$MASTER_BRANCH" ]; then
+    if [ -f "$GBP_CONF" ]; then
+        MASTER_BRANCH=`awk -F' *= *' '/debian-branch/{print $2}' "$GBP_CONF"`
+    fi
+    MASTER_BRANCH="${MASTER_BRANCH:-master}"
+fi
+
+if [ -z "$UPSTREAM_BRANCH" ]; then
+    if [ -f "$GBP_CONF" ]; then
+        UPSTREAM_BRANCH=`awk -F' *= *' '/upstream-branch/{print $2}' "$GBP_CONF"`
+    fi
+    UPSTREAM_BRANCH="${UPSTREAM_BRANCH:-upstream}"
+fi
+
+echo "Debian branch is $MASTER_BRANCH"
+echo "Upstream branch is $UPSTREAM_BRANCH"
 
 error () {
     echo "E: $1"
@@ -15,18 +33,18 @@ clean_patch () {
     rm -f $1~
 }
 
-if [ -z "`git branch | grep $PATCH_BRANCH`" ]; then
+if [ -z "`git branch | grep -e "$PATCH_BRANCH"`" ]; then
     error "There is no branch $PATCH_BRANCH…"
 else
-    git checkout master
+    git checkout "$MASTER_BRANCH"
 
-    echo "Saving patches in master:debian/patches/"
+    echo "Saving patches in $MASTER_BRANCH:debian/patches/"
     mkdir -p debian/patches/
     rm -f debian/patches/*
-    git format-patch -N -o debian/patches upstream...$PATCH_BRANCH | \
+    git format-patch -N -o debian/patches "$UPSTREAM_BRANCH"..."$PATCH_BRANCH" | \
         sed -e 's%debian/patches/%%' > debian/patches/series
 
-    git branch -D $PATCH_BRANCH
+    git branch -D "$PATCH_BRANCH"
 
     echo "Cleaning patches…"
     sed -i 1d debian/patches/*.patch 2>/dev/null

-- 
dh-ocaml packaging



More information about the Pkg-ocaml-maint-commits mailing list