Commit 04c5c267 authored by Clint Adams's avatar Clint Adams
Browse files

Rewrite both 00-index.tar and 01-index.tar

This is almost certainly the wrong way to do this.
parent e15f9cc3
Loading
Loading
Loading
Loading
+81 −75
Original line number Diff line number Diff line
@@ -233,10 +233,12 @@ 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;

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);
@@ -249,7 +251,7 @@ if (-e $tarpath) {
	} else {
		$createsandbox++;
	}

}

if ($createsandbox) {
	print "(Re-)Creating local hackage \"repository\"...\n";
@@ -271,7 +273,10 @@ __END__

	close CABALCONFIG or die $!;

	print "Reading 00-list.tar...\n";
	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>) {
@@ -336,9 +341,10 @@ __END__
			$tarfile->replace_content($content) or die;
			$stats{patched}++;
		}
	print "Writing 00-list.tar...\n";
		print "Writing ".$tarnumber."-index.tar...\n";
		$tar->write($tarpath);
	}
}

print "Creating fake global package db\n";
system("rm","-rf",$dbpath);