[pkg-haskell-tools] 02/04: New script: dch (wrapper around debchange)

Joachim Breitner nomeata at moszumanska.debian.org
Thu Aug 20 12:30:35 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 207b63ac1cb262708d27c1b6e2ba6c32d1085df0
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 20 10:10:01 2015 +0200

    New script: dch (wrapper around debchange)
---
 debian/changelog |  3 ++-
 scripts/dch      | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index b40f58d..13ab70b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,9 @@ pkg-haskell-tools (0.9) UNRELEASED; urgency=medium
 
   * Depend on cabal-debian >= 4.31, the first version supporting --upgrade
     (among other improvements)
+  * New script: dch (wrapper around debchange)
 
- -- Joachim Breitner <nomeata at debian.org>  Wed, 19 Aug 2015 22:41:58 +0200
+ -- Joachim Breitner <nomeata at debian.org>  Thu, 20 Aug 2015 10:09:40 +0200
 
 pkg-haskell-tools (0.8) unstable; urgency=medium
 
diff --git a/scripts/dch b/scripts/dch
new file mode 100755
index 0000000..bb9f4df
--- /dev/null
+++ b/scripts/dch
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use DHT;
+
+usage <<__END__;
+dch - Append the changelog
+
+Usage: dht dch [debchange option]
+
+This is a wrapper for debchange(1), which will implement our custom heuristics
+of whether a new changelog entry should be created, or the current one be
+amended: If there current one is tagged, create a new one, else append the
+current one.
+
+It passes either --append or --increment to debchange, so you should not.
+__END__
+
+manpage <<__END__;
+
+Usage: dht dch [debchange option]
+
+This is a wrapper for debchange(1), which will implement our custom heuristics
+of whether a new changelog entry should be created, or the current one be
+amended: If there current one is tagged, create a new one, else append the
+current one.
+
+It passes either --append or --increment to debchange, so you should not.
+__END__
+
+my $changelog = "debian/changelog";
+unless (-r $changelog) {
+	print "ERROR: Could not find $changelog\n";
+	next;
+}
+open CHANGELOG, '<', $changelog or die @!;
+my $firstline = <CHANGELOG>;
+if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) ([\w-]+);/) {
+	my ($source, $version, $suite) = ($1, $2, $3);
+	my $tag = sprintf "%s_v%s", $source, $version;
+	$tag =~ tr/:~/_/;
+
+	my $option;
+	if (system(qw/git show-ref --quiet/, "refs/tags/$tag") == 0) {
+		# There is a tag. use --increment
+		$option = "--increment";
+	} else {
+		# There is no tag. use --append
+		$option = "--append";
+	}
+	system("debchange",$option, at ARGV);
+} else {
+	printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline;
+	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