[pkg-haskell-tools] 03/03: dht upgrade: More robust debian/watch parsing

Joachim Breitner nomeata at moszumanska.debian.org
Mon Feb 22 23:13:41 UTC 2016


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 30f936c52ed24b452ec35e6fe1881e5096fe5f2e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Feb 22 23:44:25 2016 +0100

    dht upgrade: More robust debian/watch parsing
---
 debian/changelog |  1 +
 scripts/upgrade  | 25 +++++++++++++++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1b6e0c2..dcf8a82 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ pkg-haskell-tools (0.10.2) UNRELEASED; urgency=medium
 
   * dht make-all: Do not print "dpkg-deb" calls.
   * dht make-all: Bump a few dependencies
+  * dht upgrade: More robust debian/watch parsing
 
  -- Joachim Breitner <nomeata at debian.org>  Sat, 12 Dec 2015 14:42:47 +0100
 
diff --git a/scripts/upgrade b/scripts/upgrade
index 3c65a92..0ea1e15 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -61,23 +61,28 @@ fi
 
 for dir in "$@"
 do
-  pushd $dir >/dev/null
+  pushd "$dir" >/dev/null
 
   if [ ! -d debian ]
   then
     echo "ERROR: No debian/ directory found in $dir; run me in the packaging directory."
     continue
-    popd $dir >/dev/null
+    popd "$dir" >/dev/null
   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
-	epoch=`echo $old_version | cut -d: -f1`:
-	old_version=`echo $old_version | cut -d: -f2-`
+  cabal_name="$(grep -Po '(?<=hackage.haskell\.org/package/)[a-zA-Z0-9-]+(?=/distro-monitor)' debian/watch)"
+  if [ -z "$cabal_name" ]
+  then
+    echo "could not detect cabal name from $dir/debian/watch"
+    exit 1
+  fi
+
+  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
+	epoch="$(echo "$old_version" | cut -d: -f1)":
+	old_version="$(echo "$old_version" | cut -d: -f2-)"
   else
           epoch=''
   fi
@@ -117,7 +122,7 @@ do
   commit=$(git rev-parse HEAD)
   git checkout "$branch_name"
   git branch -D dht-update-tmp
-  if git cherry-pick $commit 
+  if git cherry-pick "$commit"
   then
     echo "Upgraded $cabal_name to $version:"
     git diff HEAD^..HEAD

-- 
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