[Pkg-haskell-commits] [package-plan] 142/457: Add option to check for possible upgrades

Joachim Breitner nomeata at moszumanska.debian.org
Mon Apr 14 20:05:19 UTC 2014


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

nomeata pushed a commit to branch master
in repository package-plan.

commit 7603a972ae928b1c1642341a909f2fa098747903
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Jul 4 14:07:58 2013 +0000

    Add option to check for possible upgrades
---
 test-packages.pl | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/test-packages.pl b/test-packages.pl
index 1eda966..0c3b165 100644
--- a/test-packages.pl
+++ b/test-packages.pl
@@ -10,6 +10,7 @@ use Archive::Tar;
 use File::Slurp;
 use Text::Patch;
 use IPC::Run qw( run );
+use Getopt::Long;
 
 my %packages;
 my %versions;
@@ -18,6 +19,12 @@ my %comments;
 my %notest;
 my @flags;
 
+my $allow_upgrade = 0;
+
+GetOptions (
+	"allow-upgrade" => \$allow_upgrade,
+	) or die("Error in command line arguments\n");
+
 print "Reading packages.txt...\n";
 open PACKAGES, "<", "packages.txt" or die $!;
 while (<PACKAGES>) {
@@ -166,7 +173,7 @@ __END__
 my $comma = "";
 for my $pkg (sort keys %versions) {
 	next if (exists $comments{$pkg});
-	printf CABAL "    %s%s (== %s)\n", $comma, $pkg, $versions{$pkg};
+	printf CABAL "    %s%s (%s %s)\n", $comma, $pkg, ($allow_upgrade?">=":"=="), $versions{$pkg};
 	$comma = ", ";
 }
 close CABAL;
@@ -176,12 +183,12 @@ my @params = ("cabal", "--config-file", "$sandboxdir/config", "install", "--dry-
 
 for my $pkg (sort keys %versions) {
 	next if (exists $comments{$pkg});
-	push @params, "--constraint", sprintf "%s (== %s)", $pkg, $versions{$pkg};
+	push @params, "--constraint", sprintf "%s (%s %s)", $pkg, ($allow_upgrade?">=":"==") ,$versions{$pkg};
 }
 for my $pkg (sort keys %versions) {
 	next if (exists $comments{$pkg});
 	next if (exists $notest{$pkg});
-	push @params, sprintf "%s-%s", $pkg, $versions{$pkg};
+	push @params, sprintf "%s", $pkg;
 }
 push @params, @flags;
 
@@ -199,7 +206,11 @@ if (run \@params, \"", \$out, \$err) {
 			next
 		}
 		unless ($versions{$pkg} eq $version) {
-			printf "ERROR: %s has %s but should have %\n", $pkg, $version, $versions{$pkg};
+			if ($allow_upgrade) {
+				printf "Upgrading %s: %s -> %s\n", $pkg, $versions{$pkg}, $version;
+			} else {
+				printf "ERROR: %s has %s but should have %s\n", $pkg, $version, $versions{$pkg};
+			}
 			next
 		}
 		$count++;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/package-plan.git



More information about the Pkg-haskell-commits mailing list