[DHG_packages] 01/21: New script: what to upgrade

Joachim Breitner nomeata at moszumanska.debian.org
Wed Aug 12 12:18:09 UTC 2015


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

nomeata pushed a commit to branch master
in repository DHG_packages.

commit bd884124b283492815c807dfe3f27c534507dbcd
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Aug 12 13:37:40 2015 +0200

    New script: what to upgrade
    
    compares the packages with the package plan and tells you what needs
    upgrading.
---
 what-to-upgrade.pl | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/what-to-upgrade.pl b/what-to-upgrade.pl
new file mode 100755
index 0000000..5bff304
--- /dev/null
+++ b/what-to-upgrade.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use File::Slurp;
+
+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/(?:.*:)?(.*)-.*?/);
+
+		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/DHG_packages.git



More information about the Pkg-haskell-commits mailing list