summaryrefslogtreecommitdiff
path: root/bin/maintmerge
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-01-10 09:59:09 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-01-10 09:59:09 -0700
commit0f205af5fae23e1ecca7e97a9bc6646111528231 (patch)
tree2af7ca72cf261adfd997842f3f15f96c4af00963 /bin/maintmerge
parent7cdba874bc9f14dedb8cbd74a4077f7cdb3d53e7 (diff)
downloaddotfiles-0f205af5fae23e1ecca7e97a9bc6646111528231.tar.gz
begin dgit-maint-merge(7) setup script
Diffstat (limited to 'bin/maintmerge')
-rwxr-xr-xbin/maintmerge47
1 files changed, 47 insertions, 0 deletions
diff --git a/bin/maintmerge b/bin/maintmerge
new file mode 100755
index 00000000..253020ae
--- /dev/null
+++ b/bin/maintmerge
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Prepare a source package for dgit-maint-merge(7)
+
+# TODO Generalise to some sort of script for any kind of project skeleton code
+
+if ! (git diff-index --quiet --cached HEAD && \
+ git diff-files --quiet && \
+ test -z "$(git status --porcelain)" \
+ ) >/dev/null 2>&1; then
+ echo >&2 "please commit first"
+ exit 1
+fi
+
+if ! [ -f "debian/changelog" ]; then
+ echo >&2 "this doesn't look like a source package"
+ exit 1
+fi
+
+if ! [ -d ".git" ]; then
+ echo >&2 "please `git init`"
+ exit 1
+fi
+
+source=$(dpkg-parsechangelog -SSource)
+
+mkdir -p debian/source
+echo "single-debian-patch" >>debian/source/options
+echo "auto-commit" >>debian/source/options
+git add debian/source/options
+
+cat >debian/source/patch-header <<EOF
+The Debian packaging of $source is maintained using dgit. For the
+sake of an efficient workflow, Debian modifications to the upstream
+source are squashed into a single diff, rather than a series of quilt
+patches. To obtain a patch queue for package version 1.2.3-1:
+
+ # apt-get install dgit
+ % dgit clone $source
+ % cd $source
+ % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian'
+
+See dgit(1), dgit(7) and dgit-maint-merge(7) for more information.
+EOF
+git add debian/source/patch-header
+
+dgit setup-new-tree