[Git][haskell-team/package-plan][master] Rewrite both 00-index.tar and 01-index.tar

Clint Adams gitlab at salsa.debian.org
Mon Apr 23 01:40:46 BST 2018


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


Commits:
04c5c267 by Clint Adams at 2018-04-22T20:40:15-04:00
Rewrite both 00-index.tar and 01-index.tar

This is almost certainly the wrong way to do this.

- - - - -


1 changed file:

- test-packages.pl


Changes:

=====================================
test-packages.pl
=====================================
--- a/test-packages.pl
+++ b/test-packages.pl
@@ -233,24 +233,26 @@ for my $pkg (sort keys %packages) {
 }
 
 my $sandboxdir = cwd() . "/cabal-sandbox";
-my $originaltarpath = $ENV{HOME}."/.cabal/packages/hackage.haskell.org/00-index.tar";
-my $tarpath = "$sandboxdir/packages/debian/00-index.tar";
 my $dbpath = "$sandboxdir/db";
 my $createsandbox = 0;
-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);
+
+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++;
 	}
-} else {
-	$createsandbox++;
 }
 
-
 if ($createsandbox) {
 	print "(Re-)Creating local hackage \"repository\"...\n";
 	system("rm","-rf",$sandboxdir);
@@ -271,73 +273,77 @@ __END__
 
 	close CABALCONFIG or die $!;
 
-	print "Reading 00-list.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);
-		}
-	}
+	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;
 
-	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 00-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";
+		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
 			}
-		};
-		$tarfile->replace_content($content) or die;
-		$stats{patched}++;
+			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 ".$tarnumber."-index.tar...\n";
+		$tar->write($tarpath);
 	}
-	print "Writing 00-list.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/04c5c267e6f0a1c2480b3fcebf08bd9fd15824e2

---
View it on GitLab: https://salsa.debian.org/haskell-team/package-plan/commit/04c5c267e6f0a1c2480b3fcebf08bd9fd15824e2
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/1d14e9b9/attachment-0001.html>


More information about the Pkg-haskell-commits mailing list