[pkg-haskell-tools] 02/06: Add upgrade script

Joachim Breitner nomeata at moszumanska.debian.org
Thu Aug 13 11:47:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

nomeata pushed a commit to branch master
in repository pkg-haskell-tools.

commit 8b501e8d4586d6e83d1bf2c701b778543717847e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 13 13:23:12 2015 +0200

    Add upgrade script
---
 debian/pkg-haskell-tools.install |   1 +
 scripts/upgrade                  | 102 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)

diff --git a/debian/pkg-haskell-tools.install b/debian/pkg-haskell-tools.install
index 8941c44..62b474c 100644
--- a/debian/pkg-haskell-tools.install
+++ b/debian/pkg-haskell-tools.install
@@ -1,4 +1,5 @@
 dist-ghc/build/make-all/make-all var/lib/pkg-haskell-tools/bin
 scripts/tag var/lib/pkg-haskell-tools/bin
+scripts/upgrade var/lib/pkg-haskell-tools/bin
 lib/* var/lib/pkg-haskell-tools/lib
 dht usr/bin
diff --git a/scripts/upgrade b/scripts/upgrade
new file mode 100755
index 0000000..1432620
--- /dev/null
+++ b/scripts/upgrade
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+set -e
+
+if [ "$1" = "--help" ]
+then
+	cat <<__END__
+upgrade - Upgrade a package to the version in the package plan
+
+__END__
+	$0 --manpage
+	exit 0
+fi
+
+if [ "$1" = "--manpage" ]
+then
+cat <<__END__
+Usage: dht upgrade [-D dist]
+
+This script will:
+
+ * Query the package plan for the desired version number.
+ * Run debchange to amend the debian/changlog.
+ * Run cabal-debian --official --upgrade to upgrade the packaging.
+ * Optimistically mark the package as ready for release
+ * Commit this to git.
+
+At the end, it will rightfully ask you to review the changes,
+giving you a helpful link to the diff between the upstream sources.
+__END__
+	exit 0;
+fi
+
+if [ ! -d debian ]
+then
+  echo "No debian/ directory found!"
+  echo "Run me in the packaging directory."
+  exit 1
+fi
+
+if [ "$1" = "-D" ]
+then
+	dist="$2"
+	shift
+	shift
+else
+	dist=unstable
+fi
+
+
+cabal_name="$(cat debian/watch | grep http | cut -d/ -f5)"
+package="$(grep-dctrl -n -s Source . < debian/control)"
+old_version=`dpkg-parsechangelog -ldebian/changelog -c1 | grep-dctrl -n -s Version .`
+old_version=`echo $old_version | cut -d- -f1` # this could be improved
+if echo $old_version | fgrep -q : ; then
+	old_version=`echo $old_version | cut -d: -f2-`
+	epoch=`echo $old_version | cut -d: -f1`:
+else
+        epoch=''
+fi
+
+version=$(grep "^$cabal_name " ../../../package-plan/packages.txt|cut -d\  -f2)
+
+if [ -z "$version" ]
+then
+	echo "could not detect version to upgrade to."
+	exit 1
+fi
+
+if [ "$version" = "$old_version" ]
+then
+	echo "No new version to upgrade to."
+	exit 1
+fi
+
+debchange --changelog debian/changelog --newversion="$epoch$version-1" 'New upstream release'
+origtargz -u
+
+if grep -q '^DEB_ENABLE_TESTS = yes' debian/rules
+then
+  test=""
+else
+  test="--no-tests"
+fi
+
+cabal-debian --official --upgrade $test
+find debian/ -name '*~' -delete
+
+dch -D $dist -r ''
+
+git commit . -q -m "$cabal_name: Upgrading from $old_version to $version"
+
+echo "Upgraded $cabal_name to $version"
+echo "Please check git show HEAD for sanity."
+echo "Please check http://hdiff.luite.com/cgit/$cabal_name/diff/?id=$version&id2=$old_version for interesting changes."
+if test -d debian/patches
+then
+	echo "Please refresh the patches"
+fi
+
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git



More information about the Pkg-haskell-commits mailing list