[pkg-haskell-tools] 03/11: dht dch: Support debchange's '--newversion' option

Ilias Tsitsimpis iliastsi-guest at moszumanska.debian.org
Sun Jul 24 20:52:53 UTC 2016


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

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

commit 108c11ca651f96f7dc8a271fc9b425ce19d6c562
Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
Date:   Sat Jul 23 16:49:52 2016 +0300

    dht dch: Support debchange's '--newversion' option
    
    Support debchange's '--newversion' option and let our custom heuristics
    decide whether a new changelog entry should be created, or the current
    one be amended.
    
    This depends on functionality found on newer versions of devscripts (for
    reference, see Debian bug #826837).
---
 debian/changelog |  7 +++++++
 debian/control   |  2 +-
 scripts/dch      | 32 +++++++++++++++++++++++++-------
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f2c08ab..5ce83fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,14 @@
 pkg-haskell-tools (0.10.4) UNRELEASED; urgency=medium
 
+  [ Joachim Breitner ]
   * dht make-all: Fancy dynamic console output
 
+  [ Ilias Tsitsimpis ]
+  * dht dch: Support debchange's '--newversion' option
+  * Build-Depend on newer version of devscripts (>= 2.16.6)
+    This newer version is needed because 'dht dch' relies on
+    #826837 in order to properly work.
+
  -- Joachim Breitner <nomeata at debian.org>  Thu, 02 Jun 2016 18:12:52 +0200
 
 pkg-haskell-tools (0.10.3) unstable; urgency=medium
diff --git a/debian/control b/debian/control
index 22054da..505dd52 100644
--- a/debian/control
+++ b/debian/control
@@ -34,7 +34,7 @@ Package: pkg-haskell-tools
 Architecture: any
 Section: haskell
 Depends:
- devscripts,
+ devscripts (>= 2.16.6),
  dctrl-tools,
  reprepro,
  cabal-debian (>= 4.31),
diff --git a/scripts/dch b/scripts/dch
index 0ec709a..c8f4800 100755
--- a/scripts/dch
+++ b/scripts/dch
@@ -16,6 +16,7 @@ amended: If the current version is tagged, create a new changelog entry, else
 append to the current one.
 
 It passes either --append or --increment to debchange, so you should not.
+The --newversion option may be used in order to specify the version number.
 __END__
 
 manpage <<__END__;
@@ -28,6 +29,7 @@ amended: If the current version is tagged, create a new changelog entry, else
 append to the current one.
 
 It passes either --append or --increment to debchange, so you should not.
+The --newversion option may be used in order to specify the version number.
 __END__
 
 my $changelog = "debian/changelog";
@@ -42,16 +44,32 @@ if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) ([\w-]+);/) {
 	my $tag = sprintf "%s_v%s", $source, $version;
 	$tag =~ tr/:~/_/;
 
-	my $option;
+	my @options = ("--release-heuristic", "changelog")
 	if (system(qw/git show-ref --quiet/, "refs/tags/$tag") == 0) {
-		# There is a tag. use --increment
-		$option = "--increment";
+        if ($suite eq "UNRELEASED") {
+            printf STDERR "Tag %s exists, but version is marked UNRELEASED\n", $tag;
+            next;
+        }
+        # A new changelog entry should be created.
+        # If user passes '--newversion' then this version will be used,
+        # else debchange will behave as if '--increment' has been given.
+        system("debchange", @options, @ARGV);
 	} else {
-		# There is no tag. use --append
-		$option = "--append";
+        if ($suite ne "UNRELEASED") {
+            # We want to append to this version, but debchange's heuristics
+            # consider this version to be released. Change distribution to
+            # UNRELEASED, and revert but to the current one later.
+            system("debchange", "-D", "UNRELEASED", "--append", "");
+        }
+        # Append to the current changelog entry.
+        # Since distribution is UNRELEASED, debchange's heuristics will
+        # append to the current entry, if '--newversion' is being used,
+        # or fallback to the '--append' option otherwise.
+        # Also, revert to the previous distribution. Users can always
+        # override this by passing the '-D' option.
+        system("debchange", @options, "-D", $suite, @ARGV);
 	}
-	system("debchange",$option, at ARGV);
 } else {
 	printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline;
-	next
+	next;
 }

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