[Git][haskell-team/package-plan][master] Use "secure" 01-index.tar

Clint Adams gitlab at salsa.debian.org
Mon Apr 23 12:11:52 BST 2018


Clint Adams pushed to branch master at Debian Haskell Group / package-plan


Commits:
952d2b93 by Clint Adams at 2018-04-23T07:11:01-04:00
Use "secure" 01-index.tar

- - - - -


1 changed file:

- test-packages.pl


Changes:

=====================================
test-packages.pl
=====================================
--- a/test-packages.pl
+++ b/test-packages.pl
@@ -233,26 +233,24 @@ for my $pkg (sort keys %packages) {
 }
 
 my $sandboxdir = cwd() . "/cabal-sandbox";
+my $originaltarpath = $ENV{HOME}."/.cabal/packages/hackage.haskell.org/01-index.tar";
+my $tarpath = "$sandboxdir/packages/debian/00-index.tar";
 my $dbpath = "$sandboxdir/db";
 my $createsandbox = 0;
-
-for my $tarnumber ("00", "01") {
-	my $originaltarpath = $ENV{HOME}."/.cabal/packages/hackage.haskell.org/".$tarnumber."-index.tar";
-	my $tarpath = "$sandboxdir/packages/debian/".$tarnumber."-index.tar";
-	if (-e $tarpath) {
-		$createsandbox++ if (-M $originaltarpath < -M $tarpath);
-		$createsandbox++ if (-M "./patches" < -M $tarpath);
-		for my $patchfile (<./patches/*/*/*>) {
-			$createsandbox++ if (-M $patchfile < -M $tarpath);
-		}
-		for my $cabalfile (<./additional-cabals/*.cabal>) {
-			$createsandbox++ if (-M $cabalfile < -M $tarpath);
-		}
-	} else {
-		$createsandbox++;
+if (-e $tarpath) {
+	$createsandbox++ if (-M $originaltarpath < -M $tarpath);
+	$createsandbox++ if (-M "./patches" < -M $tarpath);
+	for my $patchfile (<./patches/*/*/*>) {
+		$createsandbox++ if (-M $patchfile < -M $tarpath);
+	}
+	for my $cabalfile (<./additional-cabals/*.cabal>) {
+		$createsandbox++ if (-M $cabalfile < -M $tarpath);
 	}
+} else {
+	$createsandbox++;
 }
 
+
 if ($createsandbox) {
 	print "(Re-)Creating local hackage \"repository\"...\n";
 	system("rm","-rf",$sandboxdir);
@@ -273,77 +271,73 @@ __END__
 
 	close CABALCONFIG or die $!;
 
-	for my $tarnumber ("00", "01") {
-		my $originaltarpath = $ENV{HOME}."/.cabal/packages/hackage.haskell.org/".$tarnumber."-index.tar";
-		my $tarpath = "$sandboxdir/packages/debian/".$tarnumber."-index.tar";
-		print "Reading ".$tarnumber."-index.tar...\n";
-		my $tar = Archive::Tar->new($originaltarpath);
-		print "Adding additional packages...\n";
-		for my $cabalfile (<./additional-cabals/*.cabal>) {
-			unless ($cabalfile =~ m!^./additional-cabals/(.*)-(.*).cabal!) {
-			        printf "Ignoring $cabalfile, does not match not match naming scheme additional-cabals/<pkg>-<version>.cabal";
-				$error_count++;
-				next
-			}
-			my $package = $1;
-			my $version = $2;
-
-			my $content = read_file($cabalfile);
-			my $filename = "$package/$version/$package.cabal";
-			if ($tar->contains_file($filename)) {
-				$tar->replace_content($filename, $content);
-			} else {
-				$tar->add_data($filename, $content);
-			}
+	print "Reading 01-index.tar...\n";
+	my $tar = Archive::Tar->new($originaltarpath);
+	print "Adding additional packages...\n";
+	for my $cabalfile (<./additional-cabals/*.cabal>) {
+		unless ($cabalfile =~ m!^./additional-cabals/(.*)-(.*).cabal!) {
+		        printf "Ignoring $cabalfile, does not match not match naming scheme additional-cabals/<pkg>-<version>.cabal";
+			$error_count++;
+			next
 		}
+		my $package = $1;
+		my $version = $2;
 
-		print "Applying patches to repository .cabal files...\n";
-		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} || exists $obsolete{$pkg}) {
-				printf "Ignoring patches for %s-%s, not listed in packages.txt\n", $pkg ,$version;
-				$error_count++;
-				next
-			}
-			unless (exists $versions{$pkg} and $version eq $versions{$pkg}
-			     or exists $lts{$pkg} and $version eq $lts{$pkg}) {
-				# printf "Ignoring patches for %s-%s, version does not match %s in packages.txt\n", $pkg ,$version, $versions{$pkg};
-				next
-			}
-			my $cabalpath = sprintf "%s/%s/%s.cabal", $pkg, $version, $pkg;
-			unless ($tar->contains_file($cabalpath)) {
-				printf "File %s not found in ".$tarnumber."-index.tar\n", $cabalpath;
-				$error_count++;
-				next
-			}
+		my $content = read_file($cabalfile);
+		my $filename = "$package/$version/$package.cabal";
+		if ($tar->contains_file($filename)) {
+			$tar->replace_content($filename, $content);
+		} else {
+			$tar->add_data($filename, $content);
+		}
+	}
 
-			my ($tarfile) = $tar->get_files($cabalpath);
-			printf "Patching %s.cabal (version %s)\n", $pkg, $version;
-			my $content = $tarfile->get_content();
-			my $series = read_file($seriesfile);
-			foreach my $patchfile (split /^/, $series) {
-				chomp $patchfile;
-				my $patch;
-				run ["filterdiff", "-i", "*.cabal",
-					"patches/$pkg/$version/$patchfile"], \"", \$patch;
-				if ($patch) {
-					$content = patch($content, $patch, STYLE => "Unified");
-				} else {
-					#print "Ignoring $patchfile\n";
-				}
-			};
-			$tarfile->replace_content($content) or die;
-			$stats{patched}++;
+	print "Applying patches to repository .cabal files...\n";
+	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} || exists $obsolete{$pkg}) {
+			printf "Ignoring patches for %s-%s, not listed in packages.txt\n", $pkg ,$version;
+			$error_count++;
+			next
 		}
-		print "Writing ".$tarnumber."-index.tar...\n";
-		$tar->write($tarpath);
+		unless (exists $versions{$pkg} and $version eq $versions{$pkg}
+		     or exists $lts{$pkg} and $version eq $lts{$pkg}) {
+			# printf "Ignoring patches for %s-%s, version does not match %s in packages.txt\n", $pkg ,$version, $versions{$pkg};
+			next
+		}
+		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
+		}
+
+		my ($tarfile) = $tar->get_files($cabalpath);
+		printf "Patching %s.cabal (version %s)\n", $pkg, $version;
+		my $content = $tarfile->get_content();
+		my $series = read_file($seriesfile);
+		foreach my $patchfile (split /^/, $series) {
+			chomp $patchfile;
+			my $patch;
+			run ["filterdiff", "-i", "*.cabal",
+				"patches/$pkg/$version/$patchfile"], \"", \$patch; 
+			if ($patch) {
+				$content = patch($content, $patch, STYLE => "Unified");
+			} else {
+				#print "Ignoring $patchfile\n";
+			}
+		};
+		$tarfile->replace_content($content) or die;
+		$stats{patched}++;
 	}
+	print "Writing 00-index.tar...\n";
+	$tar->write($tarpath);
 }
 
 print "Creating fake global package db\n";



View it on GitLab: https://salsa.debian.org/haskell-team/package-plan/commit/952d2b93ba80202b1630c6705efc5e4b05568a3d

---
View it on GitLab: https://salsa.debian.org/haskell-team/package-plan/commit/952d2b93ba80202b1630c6705efc5e4b05568a3d
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20180423/9e608d15/attachment-0001.html>


More information about the Pkg-haskell-commits mailing list