[pkg-haskell-tools] 04/06: New script: what-to-upgrade
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 2f9c25d319c694c9182a50f158ff8f3bc58e8640
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Aug 13 13:33:26 2015 +0200
New script: what-to-upgrade
---
debian/changelog | 3 +-
scripts/what-to-upgrade | 83 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index ad04bd2..d2a5829 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
pkg-haskell-tools (0.2) UNRELEASED; urgency=medium
- * Use pandoc instead of help2man
+ * Use pandoc instead of help2man
* New script: what-to-build
+ * New script: what-to-upgrade
-- Joachim Breitner <nomeata at debian.org> Thu, 13 Aug 2015 13:20:44 +0200
diff --git a/scripts/what-to-upgrade b/scripts/what-to-upgrade
new file mode 100755
index 0000000..c034d49
--- /dev/null
+++ b/scripts/what-to-upgrade
@@ -0,0 +1,83 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use File::Slurp;
+
+use DHT;
+
+usage <<__END__;
+what-to-upgrade - Find packages to be upgraded
+
+Usage: dht what-to-upgrade [directory..]
+
+For all given directories (defaults to p/*/), check if they are to be upgraded,
+i.e. that the package plan lists a newer version than the changelog.
+__END__
+
+manpage <<__END__;
+
+Usage: dht what-to-upgrade [directory..]
+
+For all given directories (defaults to `p/*/`), check if they are to be upgraded,
+i.e. that the package plan lists a newer version than the changelog.
+__END__
+
+my @dirs = @ARGV;
+
+unless (@dirs) {
+ @dirs = glob 'p/*/';
+}
+
+my %plan;
+open PLAN, '<', '../package-plan/packages.txt' or die @!;
+while (<PLAN>) {
+ chomp;
+ next if /^#/;
+ next if /^\s*$/;
+ unless (m/^(.*?) (.*?)(?: ([^#]*))?(?:#.*)?$/) {
+ print "Ignoring unparseable line $.: $_\n";
+ }
+ my ($pkg,$version,$attribs) = ($1,$2,$3);
+ $plan{$pkg} = $version;
+}
+close PLAN or die @!;
+
+for my $dir (@dirs) {
+ my $changelog = "$dir/debian/changelog";
+ my $watchfile = "$dir/debian/watch";
+ next unless -r $changelog;
+ next unless -r $watchfile;
+
+ open CHANGELOG, '<', $changelog or die @!;
+ my $firstline = <CHANGELOG>;
+ if ($firstline =~ m/([\w-]+) \(([\w:~.+-]+)\) (\w+);/) {
+ my ($source, $version, $suite) = ($1, $2, $3);
+ my ($cabal_version) = ($version =~ m/^(?:.*:)?(.*?)(?:\+dfsg\d*)?-.*?$/);
+
+ my $watch = read_file($watchfile) or die @!;
+ unless ($watch =~ m!http://hackage.haskell.org/package/(.*)/distro-monitor!) {
+ #printf STDERR "Cannot parse watchfile %s\n", $watchfile;
+ # ignore packages with non-standard watch files
+ next
+ }
+ my $cabal_package = $1;
+
+ unless (exists $plan{$cabal_package}) {
+ printf STDERR "W: package %s not in the package plan\n",
+ $dir, $cabal_package;
+ next
+ }
+
+ if ($cabal_version ne $plan{$cabal_package}) {
+ 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