summaryrefslogtreecommitdiff
path: root/debian/bin
diff options
context:
space:
mode:
Diffstat (limited to 'debian/bin')
-rwxr-xr-xdebian/bin/commit2quilt68
-rwxr-xr-xdebian/bin/do-dch26
-rwxr-xr-xdebian/bin/urcl102
3 files changed, 196 insertions, 0 deletions
diff --git a/debian/bin/commit2quilt b/debian/bin/commit2quilt
new file mode 100755
index 000000000..dee525bda
--- /dev/null
+++ b/debian/bin/commit2quilt
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# commit2quilt, based on patch2quilt
+# Copyright (c) 2011, Frank Terbeck <ft@bewatermyfriend.org>
+# Copyright (c) 2014, Axel Beckert <abe@debian.org>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Often, we may want to backport a patch from upstream to our package. If
+# that's just a matter of cherry-picking a patch from upstream, this script can
+# help. We don't really want to git cherry-pick, but rather add a new patch to
+# our quilt series. In short, this script automates doing that.
+#
+# Call it like this:
+# % git fetch zsh
+# % debian/bin/commit2quilt $commit_id
+#
+# `commit2quilt' requires `quilt', `git' and $GIT_EDITOR or
+# emacsclient available.
+
+set -e
+
+for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
+ if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then
+ export QUILT_PATCHES=debian/patches
+ break
+ fi
+done
+
+export GIT_EDITOR=${GIT_EDITOR:-emacsclient}
+
+if [ $# -ne 1 ]; then
+ printf 'usage: patch2quilt <commit-id>\n'
+ exit 1
+fi
+
+commitid="$1"
+shortid="`echo -n $commitid | cut -c1-8`"
+desc="`git show $commitid | egrep '^ [^ ]' | head -1 | sed -e 's/^[- *:]*//'`"
+filename="cherry-pick-$shortid-`echo "$desc" | tr -c 'a-zA-Z0-9' '-' | tr 'A-Z' 'a-z' | sed -e 's/--*/-/g;s/-$//'`.patch"
+echo "$filename"
+
+if quilt series | fgrep -q "$filename"; then
+ echo "Patch $filename ($commitid) already existing" 1>&2
+ exit 1
+fi
+
+git show "$commitid" | filterdiff -x a/ChangeLog > "${where}debian/patches/$filename"
+echo "$filename" >> "${where}debian/patches/series"
+sed -e '1 s/^commit/Origin: commit/; 4 d; 5 s/^ /Description: /; 6 d' -i "${where}debian/patches/$filename"
+"${GIT_EDITOR}" "${where}debian/patches/$filename"
+git add "${where}debian/patches/$filename" "${where}debian/patches/series"
+quilt push -a
+quilt pop -a
+git commit -m "Cherry-pick $shortid ($desc) from upstream" -v --edit
+
+exit 0
+
diff --git a/debian/bin/do-dch b/debian/bin/do-dch
new file mode 100755
index 000000000..da40d6bcb
--- /dev/null
+++ b/debian/bin/do-dch
@@ -0,0 +1,26 @@
+#!/bin/sh
+# This runs "gbp dch" with appropriate options.
+#
+# All given options are handed over to "gbp dch" without tampering. You
+# should probably give a --since="..." definition, so the program knows
+# were to start. Also, when you're planning on a release, pass `-R'. For
+# snapshots, use `-S'.
+#
+# This script also takes care of weeding out [dch-ignore] lines from the
+# generated changelog.
+#
+# At the end an editor is spawned on debian/changelog no matter what.
+
+gbp dch \
+ --spawn-editor=never \
+ "$@"
+
+old="debian/changelog.old"
+cl="debian/changelog"
+
+rm -f "$old"
+cp "$cl" "$old"
+sed -e '/^ \* \[[a-f0-9]*\] \[dch-ignored?\] /d' < "$old" > "$cl"
+rm -f "$old"
+
+${VISUAL:-${EDITOR:-vi}} "$cl"
diff --git a/debian/bin/urcl b/debian/bin/urcl
new file mode 100755
index 000000000..8bfd8926f
--- /dev/null
+++ b/debian/bin/urcl
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# Seems like `gbp dch' doesn't work well with non-linear histories. With
+# pkg-zsh we do have merges everytime an upstream release is done. That's
+# where "Upstream Release ChangeLog" comes into play. It takes a set of
+# commit hashes and produces an initial changelog update for those
+# situations in which an upstream release tag was merged. After that,
+# the situation can be reduced to a linear history again and `gbp dch'
+# will do just fine.
+#
+# This script is pretty dumb, so some manual adjustments might be needed
+# for "debian/changelog".
+
+if [ $# = 0 ]; then
+ printf 'usage: urcl [OPTIONS] <COMMITHASH(s)...>\n\n'
+ printf 'Options:\n\n'
+ printf ' -n="..." Full name to be used for the changelog entry. (Defaults\n'
+ printf ' to "$DEBFULLNAME".)\n'
+ printf ' -m="..." Email address for the changelog entry. (Defaults to\n'
+ printf ' "$DEBEMAIL".)\n'
+ printf ' -p="..." Package name to use. (Defaults to "$PACKAGE".)\n'
+ printf ' -v="..." Version number to use. (Defaults to "$VERSION".)\n'
+ printf '\n'
+ exit 0
+fi
+
+case "$1" in
+ -*) isopt=1;;
+ *) isopt=0;;
+esac
+
+while [ "$#" -gt 0 ] && [ "$isopt" = 1 ]; do
+ case "$1" in
+ -n=*) who="${1#-n=}" ;;
+ -m=*) ewho="${1#-m=}" ;;
+ -p=*) PACKAGE="${1#-p=}" ;;
+ -v=*) VERSION="${1#-v=}" ;;
+ -*)
+ printf 'Unknown option `%s'\''\n.' "$1"
+ ;;
+ esac
+ shift
+ case "$1" in
+ -*) isopt=1;;
+ *) isopt=0;;
+ esac
+done
+
+if [ x"$who" = x ]; then
+ if [ x"$DEBFULLNAME" = x ]; then
+ printf '`$DEBFULLNAME'\'' is empty use -n=...\n'
+ exit 1
+ fi
+ who=$DEBFULLNAME
+fi
+if [ x"$ewho" = x ]; then
+ if [ x"$DEBEMAIL" = x ]; then
+ printf '`$DEBEMAIL'\'' is empty use -m=...\n'
+ exit 1
+ fi
+ ewho=$DEBEMAIL
+fi
+
+if [ x"$PACKAGE" = x ]; then
+ printf '`$PACKAGE'\'' is empty use -p=...\n'
+ exit 1
+fi
+
+if [ x"$VERSION" = x ]; then
+ printf '`$VERSION'\'' is empty use -v=...\n'
+ exit 1
+fi
+
+DATE=$(date -R)
+
+ours="debian/changelog.urcl"
+theirs="debian/changelog.old"
+cl="debian/changelog"
+
+xecho () {
+ printf '%s\n' "$@" >> "$ours"
+}
+
+rm -f "$ours" "$theirs"
+
+xecho "$PACKAGE ($VERSION) UNRELEASED; urgency=low"
+xecho
+
+for rev; do
+ data=$(git log -1 --abbrev=8 --pretty=format:' * [%h] %s' "$rev")
+ [ $? = 0 ] && xecho "$data"
+done
+
+xecho
+xecho " -- ${who} <${ewho}> $DATE"
+xecho
+
+cp "$cl" "$theirs"
+cat "$ours" > "$cl"
+cat "$theirs" >> "$cl"
+rm -f "$ours" "$theirs"
+${VISUAL:-${EDITOR:-vi}} "$cl"