[Pkg-haskell-commits] [package-plan] 05/05: Make test-packages.pl independent of installed packages

Joachim Breitner nomeata at moszumanska.debian.org
Mon Apr 20 10:47:32 UTC 2015


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

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

commit 96ea434f1d83e0e9a751279b6eacac02eaa48484
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Apr 20 12:45:52 2015 +0200

    Make test-packages.pl independent of installed packages
    
    Using a trick found by by Daniel Gröber.
---
 test-packages.pl | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/test-packages.pl b/test-packages.pl
index 93dd440..3e7faf4 100755
--- a/test-packages.pl
+++ b/test-packages.pl
@@ -140,6 +140,7 @@ 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);
@@ -243,9 +244,22 @@ __END__
 	$tar->write($tarpath);
 }
 
+print "Creating fake global package db\n";
+system("rm","-rf",$dbpath);
+mkdir "$dbpath" or die $!;
+open GHCFILES, "-|", "dpkg-query -L ghc" or die $!;
+while (<GHCFILES>) {
+	chomp;
+	if (m!^/var/lib/ghc/package.conf.d/(.*\.conf)$!) {
+		symlink $_, "$dbpath/$1" or die $!;
+	}
+}
+close GHCFILES;
+system("ghc-pkg","--package-db=$dbpath","recache");
 
 unlink "all-packages.cabal";
 
+
 my %groups;
 $groups{$_}++ foreach values %group;
 $groups{default}++;
@@ -256,7 +270,16 @@ my $total_out;
 my $all_runs_ok = 1;
 
 for my $group (@groups) {
-	my @params = ("cabal", "-v", "--config-file", "$sandboxdir/config", "install", "--dry-run", "--force-reinstall","--max-backjumps","-1");
+	my @params = ("cabal",
+		 #"-v",
+		 "--config-file",
+		 "$sandboxdir/config",
+		 "--ghc-pkg-option=--global-package-db=$dbpath",
+		 "install",
+		 "--dry-run",
+		 "--force-reinstall",
+		 "--max-backjumps",
+		 "-1");
 
 	for my $pkg (sort keys %flags) {
 		for my $flag (@{$flags{$pkg}}) {
@@ -333,7 +356,7 @@ if ($all_runs_ok) {
 		next if $_ eq "Choosing modular solver.";
 		next if $_ eq "Resolving dependencies...";
 		next if $_ eq "Updating the index cache file...";
-		next if $_ eq "In order, the following would be installed:";
+		next if $_ =~ "In order, the following would be installed";
 		next if $_ eq "package)"; # what is that?
 		if (m!^([a-zA-Z0-9-]+)-([0-9.]+)!gm) {
 			my ($pkg, $version) = ($1, $2);

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