[pkg-haskell-tools] 03/06: New script: what-to-build

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 0d4eacb41e7708107f33e6ae14567ad00894b49d
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Aug 13 13:29:10 2015 +0200

    New script: what-to-build
---
 debian/changelog      |  1 +
 debian/rules          |  2 +-
 scripts/what-to-build | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 5ce6498..ad04bd2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 pkg-haskell-tools (0.2) UNRELEASED; urgency=medium
 
   * Use pandoc instead of help2man 
+  * New script: what-to-build
 
  -- Joachim Breitner <nomeata at debian.org>  Thu, 13 Aug 2015 13:20:44 +0200
 
diff --git a/debian/rules b/debian/rules
index ce263dc..dcd3930 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,7 +7,7 @@ include /usr/share/cdbs/1/class/hlibrary.mk
 
 build/pkg-haskell-tools:: build-ghc-stamp debian/dht.1
 
-debian/dht.1: dht
+debian/dht.1: dht scripts/*
 	./dht --manpage | pandoc -f markdown -s -t man > $@
 
 clean::
diff --git a/scripts/what-to-build b/scripts/what-to-build
new file mode 100755
index 0000000..8e8560a
--- /dev/null
+++ b/scripts/what-to-build
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use DHT;
+
+usage <<__END__;
+what-to-build - Find packages to be built
+
+Usage: dht what-to-build [directory..]
+
+For all given directories (defaults to p/*/), check if they are to be built.
+This means, in particular:
+
+ * The latest entry in debian/changelog is not UNRELEASED, and
+ * there is no corresponding tag in the git repository.
+__END__
+
+manpage <<__END__;
+
+Usage: dht what-to-build [directory..]
+
+For all given directories (defaults to `p/*/`), check if they are to be built.
+This means, in particular:
+
+ * The latest entry in `debian/changelog` is *not* `UNRELEASED`, and
+ * there is no corresponding tag in the git repository.
+__END__
+
+
+my @dirs = @ARGV;
+
+unless (@dirs) {
+	@dirs = glob 'p/*/';
+}
+
+my %tags;
+open TAGS, '-|', 'git tag -l' or die @!;
+while (<TAGS>) { chomp; $tags{$_}++ };
+close TAGS or die @!;
+
+for my $dir (@dirs) {
+	my $changelog = "$dir/debian/changelog";
+	next unless -r $changelog;
+	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/:~/_/;
+		next if ($suite eq "UNRELEASED");
+		next if ($tags{$tag});
+		printf "%s\n", $dir;
+	} 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