[Pkg-haskell-commits] [package-plan] 01/01: ./test-packages.pl: Set proper return value

Joachim Breitner nomeata at moszumanska.debian.org
Wed Apr 16 10:32:38 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 48a3cd464638bc3c89a690b3d2b5e468783db58c
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Apr 16 12:31:27 2014 +0200

    ./test-packages.pl: Set proper return value
---
 test-packages.pl | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/test-packages.pl b/test-packages.pl
index 2f3eae5..fb27376 100755
--- a/test-packages.pl
+++ b/test-packages.pl
@@ -23,6 +23,7 @@ my %obsolete;
 my @flags;
 
 my $allow_upgrade = 0;
+my $error_count = 0;
 
 GetOptions (
 	"allow-upgrade" => \$allow_upgrade,
@@ -59,6 +60,7 @@ while (<AVAILABLE>) {
 	chomp;
 	unless (m/^(.*)-([0-9\.]*)-([a-f0-9]*?)$/) {
 		print "Ignoring unparseable grep-aptavail output line $.: $_\n";
+		$error_count++;
 	}
 	my ($pkg,$version) = ($1, $2);
 	$version = 0.85 if $pkg eq "IfElse" and $version eq "0.85.0.0.1"; # anomaly
@@ -74,6 +76,7 @@ while ( my ($pkg, $bin) = each %binary ) {
 		chomp;
 		unless (m/^(?:.*:)?(.*)-(?:.*)$/) {
 			print "Ignoring unparseable version for $pkg: $_\n";
+			$error_count++;
 		}
 		$available{$pkg} = $1;
 		$packages{$pkg}++;
@@ -90,15 +93,18 @@ for my $pkg (sort keys %packages) {
 	} elsif ($obsolete{$pkg} && !$available{$pkg}) {
 		printf "REMOVED:  %s %s\n" ,
 			$pkg, $available{$pkg};
+		$error_count++;
 	} elsif (! exists($versions{$pkg})) {
 		printf "MISSING:  %s %s\n" ,
 			$pkg, $available{$pkg};
+		$error_count++;
 	} elsif (! exists($available{$pkg})) {
 		printf "Added:    %s is %s here but does not exist in the archive.\n" ,
 			$pkg, $versions{$pkg};
 	} elsif ( version_compare($versions{$pkg}, $available{$pkg}) == -1 ) {
 		printf "OLD:      %s is %s here but %s exists in the archive.\n" ,
 			$pkg, $versions{$pkg}, $available{$pkg};
+		$error_count++;
 	} elsif ( version_compare($versions{$pkg}, $available{$pkg}) == 1 ) {
 		printf "Updated:  %s is %s in the archive but %s exists here.\n" ,
 			$pkg, $available{$pkg}, $versions{$pkg};
@@ -146,12 +152,14 @@ __END__
 	for my $seriesfile (<./patches/*/*/series>) {
 		unless ($seriesfile =~ m!^./patches/(.*)/(.*?)/series$!) {
 			printf "Ignoring $seriesfile, does not match naming scheme patches/<pkg>/<version>/series\n";
+			$error_count++;
 			next
 		}
 		my $pkg = $1;
 		my $version = $2;
 		unless (exists $versions{$pkg}) {
 			printf "Ignoring patches for %s-%s, not listed in all-packages.txt\n", $pkg ,$version;
+			$error_count++;
 			next
 		}
 		unless ($version eq $versions{$pkg}) {
@@ -161,6 +169,7 @@ __END__
 		my $cabalpath = sprintf "%s/%s/%s.cabal", $pkg, $version, $pkg;
 		unless ($tar->contains_file($cabalpath)) {
 			printf "File %s not found in 00-index.tar\n", $cabalpath;
+			$error_count++;
 			next
 		}
 
@@ -242,6 +251,7 @@ if (run \@params, \"", \$out, \$err) {
 				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};
+				$error_count++;
 			}
 			next
 		}
@@ -253,5 +263,10 @@ if (run \@params, \"", \$out, \$err) {
 	}
 } else {
 	print "Cabal install failed:\n";
+	$error_count++;
 	print $err;
 }
+if ($error_count) {
+	printf "%d error(s) in total.\n", $error_count;
+	exit 1;
+}

-- 
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