[Pkg-ocaml-maint-commits] [SCM] dh-ocaml packaging branch, master, updated. debian/0.4.1-23-g25b4d33
Mehdi Dogguy
dogguy at pps.jussieu.fr
Wed May 27 19:15:03 UTC 2009
The following commit has been merged in the master branch:
commit 25b4d3361b03d1a5d1ef6751bce2107118070172
Author: Mehdi Dogguy <dogguy at pps.jussieu.fr>
Date: Wed May 27 20:50:16 2009 +0200
Add two little scripts to manipulate patches using Git and update the policy to explain there usage.
diff --git a/git-tools/git-dom-apply-patches b/git-tools/git-dom-apply-patches
new file mode 100755
index 0000000..34da082
--- /dev/null
+++ b/git-tools/git-dom-apply-patches
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+PATCH_BRANCH="patch-queue"
+
+error () {
+ echo "E: $1"
+ exit 1
+}
+
+if [ -n "`git branch | grep $PATCH_BRANCH`" ]; then
+ error "There is already a branch $PATCH_BRANCH"
+else
+ git checkout -b $PATCH_BRANCH upstream
+
+ ## When master: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`; do
+ git cat-file -p master:debian/patches/$patch | git am;
+ done
+fi
diff --git a/git-tools/git-dom-save-patches b/git-tools/git-dom-save-patches
new file mode 100755
index 0000000..83ad3d2
--- /dev/null
+++ b/git-tools/git-dom-save-patches
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PATCH_BRANCH="patch-queue"
+
+error () {
+ echo "E: $1"
+ exit 1
+}
+
+clean_patch () {
+ mv $1 $1~
+ ## Assertion: There is at least one line that matches "^-- "
+ head -n `grep -n '^-- ' $1~ | tail -n1 | cut -d: -f1` $1~ > $1
+ rm -f $1~
+}
+
+if [ -z "`git branch | grep $PATCH_BRANCH`" ]; then
+ error "There is no branch $PATCH_BRANCH…"
+else
+ git checkout master
+
+ echo "Saving patches in master:debian/patches/"
+ mkdir -p debian/patches/
+ rm -f debian/patches/*
+ git format-patch -N -o debian/patches upstream...$PATCH_BRANCH | \
+ sed -e 's%debian/patches/%%' > debian/patches/series
+
+ git branch -D $PATCH_BRANCH
+
+ echo "Cleaning patches…"
+ sed -i 1d debian/patches/*.patch
+ ## Hackish: Remove 2 last lines
+ # sed -i -n -e :a -e '1,2!{P;N;D;};N;ba' debian/patches/*.patch
+ for patch in `ls -1 debian/patches/*.patch`; do
+ clean_patch $patch
+ done
+fi
diff --git a/policy/appendix-git.xml b/policy/appendix-git.xml
index a517678..eac2f57 100644
--- a/policy/appendix-git.xml
+++ b/policy/appendix-git.xml
@@ -249,5 +249,64 @@
of <ulink url="http://repo.or.cz/w/topgit.git">TopGit</ulink>
and quilt-serialized patches, and raw quilt or dpatch.
</para>
+
+ <section>
+ <title>Quilt-serialized patches</title>
+
+ <para>
+ Patches can be serialized using Git. Two tools are used to
+ apply and save the patches
+ in <command>debian/patches/series</command>.
+
+ <itemizedlist>
+ <listitem>
+ <para><command>git-dom-apply-patches</command>: Creates
+ the branch <command>patch-queue</command> and checkout
+ it. Then, it applies all patches listed in
+ <command>debian/patches/series</command>.
+ </para>
+ </listitem>
+ <listitem>
+ <para><command>git-dom-save-patches</command>:
+
+ <itemizedlist>
+ <listitem>
+ <para>Move back to branch <command>master</command></para>
+ </listitem>
+ <listitem>
+ <para>Save all patches present in branch
+ <command>patch-queue</command> (where each commit
+ represents a patch to upstream) in
+ <command>debian/patches/</command> and
+ update <command>debian/patches/series</command>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Update <command>debian/patches/series</command>
+ </para>
+ </listitem>
+ <listitem>
+ <para>Remove branch <command>patch-queue</command></para>
+ </listitem>
+ </itemizedlist>
+
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ The branch <command>patch-queue</command> is used only
+ locally and should never be pushed.
+ </para>
+
+ <para>
+ TODO: Install the two tools somewhere. Remove this paragraph
+ when it's done. The best location could be: /usr/lib/git-core.
+ It's is the easiest way to make Git "dom-aware". The "dom"
+ prefix is used to avoid name clashes with upstream commands.
+ </para>
+
+ </section>
</section>
--
dh-ocaml packaging
More information about the Pkg-ocaml-maint-commits
mailing list