[pkg-haskell-tools] 02/02: update: Use git to merge upgrade and custom changes

Joachim Breitner nomeata at moszumanska.debian.org
Sat Aug 15 13:34:29 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 e625974d8af50851dfd0349ee1f32529db907335
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Sat Aug 15 15:33:25 2015 +0200

    update: Use git to merge upgrade and custom changes
    
    by crafting a patch that represents the upgrading of an uncustomized
    debianization, and then cherry-picking that onto the current branch.
---
 scripts/upgrade         | 73 +++++++++++++++++++++++++++++++++++++++----------
 scripts/what-to-upgrade |  1 +
 2 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/scripts/upgrade b/scripts/upgrade
index ae14286..7118614 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -2,6 +2,21 @@
 
 set -e
 
+function run_cabal_debian () {
+  if grep -q '^DEB_ENABLE_TESTS :\?= yes' debian/rules
+  then
+    test=""
+  else
+    test="--no-tests"
+  fi
+
+  flags=$(perl -ne 'if (/^DEB_SETUP_GHC_CONFIGURE_ARGS/) {while (/(?:-f|--flags)=? ?(-?[a-z0-9_-]+)/gc) { print "--cabal-flag $1 "}}' debian/rules)
+
+  cabal-debian --official $test $flags "$@"
+  find debian/ -name '*~' -delete
+}
+
+
 if [ "$1" = "--help" ]
 then
 	cat <<__END__
@@ -12,6 +27,7 @@ __END__
 	exit 0
 fi
 
+
 if [ "$1" = "--manpage" ]
 then
 cat <<__END__
@@ -40,6 +56,24 @@ else
 	dist=unstable
 fi
 
+if ! git diff-files --quiet -- "$@"
+then
+      echo "The git repository is not clean. Please fix that first!"
+      exit 1
+fi
+
+if ! git diff-index --cached --quiet HEAD -- "$@"
+then
+      echo "WARNING: The git index is not clean, and will be amended!"
+fi
+
+if test -n "$(git ls-files --exclude-standard --others -- "$@")"
+then
+      echo "The git repository has untracked files. Please fix that first!"
+      exit 1
+fi
+
+
 for dir in "$@"
 do
   pushd $dir >/dev/null
@@ -77,26 +111,37 @@ do
 	exit 1
   fi
 
-  debchange --changelog debian/changelog --newversion="$epoch$version-1" 'New upstream release'
-  origtargz -u
+  branch_name="$(git symbolic-ref -q HEAD)"
+  branch_name="${branch_name##refs/heads/}"
 
-  if grep -q '^DEB_ENABLE_TESTS = yes' debian/rules
-  then
-    test=""
-  else
-    test="--no-tests"
-  fi
+  git checkout --orphan dht-update-tmp
 
-  cabal-debian --official --upgrade $test
-  find debian/ -name '*~' -delete
+  # base commit
+  origtargz -u
+  run_cabal_debian --upgrade
+  git add .
+  git commit -q -m 'Temporary base commit'
 
+  # next commit
+  debchange --changelog debian/changelog --newversion="$epoch$version-1" 'New upstream release'
+  origtargz -u
+  run_cabal_debian --upgrade
   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."
+  commit=$(git rev-parse HEAD)
+  git checkout "$branch_name"
+  git branch -D dht-update-tmp
+  if git cherry-pick $commit 
+  then
+    echo "Upgraded $cabal_name to $version:"
+    git diff HEAD^..HEAD
+    echo "Please check http://hdiff.luite.com/cgit/$cabal_name/diff/?id=$version&id2=$old_version for interesting changes."
+  else
+    echo "Upgraded $cabal_name to $version"
+    echo "Merge failed. Please resolve and then run"
+    echo "git add -u .; git commit"
+  fi
   if test -d debian/patches
   then
     echo "Please refresh the patches"
diff --git a/scripts/what-to-upgrade b/scripts/what-to-upgrade
index c034d49..4057202 100755
--- a/scripts/what-to-upgrade
+++ b/scripts/what-to-upgrade
@@ -40,6 +40,7 @@ while (<PLAN>) {
                 print "Ignoring unparseable line $.: $_\n";
         }
         my ($pkg,$version,$attribs) = ($1,$2,$3);
+	next if $attribs and $attribs =~ /obsolete/;
 	$plan{$pkg} = $version;
 }
 close PLAN or die @!;

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