From 67c6f3eded7dcb7c79243ed41f177c960f2b6aad Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 26 Jul 2012 18:28:12 -0400 Subject: [PATCH] nix-push: Support generating a manifest again This makes all the tests succeed. Woohoo! --- scripts/nix-push.in | 44 +++++++++++++++++++++++++++++++--------- tests/binary-patching.sh | 9 +++++--- tests/install-package.sh | 2 +- tests/nix-channel.sh | 2 +- tests/nix-pull.sh | 2 +- tests/nix-push.sh | 4 +++- 6 files changed, 46 insertions(+), 17 deletions(-) diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 45a0695a6..39fdd6da9 100755 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -8,31 +8,28 @@ use File::stat; use File::Copy; use Nix::Config; use Nix::Store; - -my $hashAlgo = "sha256"; +use Nix::Manifest; my $tmpDir = tempdir("nix-push.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; my $nixExpr = "$tmpDir/create-nars.nix"; -my $curl = "$Nix::Config::curl --fail --silent"; -my $extraCurlFlags = ${ENV{'CURL_FLAGS'}}; -$curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; - # Parse the command line. my $compressionType = "xz"; my $force = 0; my $destDir; +my $writeManifest = 0; +my $archivesURL; my @roots; sub showSyntax { print STDERR < "$archivesURL/$narName" + , hash => "sha256:$compressedHash" + , size => $compressedSize + , narHash => "$narHash" + , narSize => $narSize + , references => join(" ", @{$refs}) + , deriver => $deriver + } + ] if $writeManifest; } printf STDERR "total compressed size %.2f MiB, %.1f%%\n", $totalCompressedSize / (1024 * 1024), $totalCompressedSize / $totalNarSize * 100; + + +# Optionally write a manifest. +if ($writeManifest) { + writeManifest "$destDir/MANIFEST", \%narFiles, \(); +} diff --git a/tests/binary-patching.sh b/tests/binary-patching.sh index 8c52c2f14..188be109a 100644 --- a/tests/binary-patching.sh +++ b/tests/binary-patching.sh @@ -7,14 +7,17 @@ mkdir -p $TEST_ROOT/cache2 $TEST_ROOT/patches RESULT=$TEST_ROOT/result # Build version 1 and 2 of the "foo" package. -nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest1 \ +nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 \ $(nix-build -o $RESULT binary-patching.nix --arg version 1) +mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest1 out2=$(nix-build -o $RESULT binary-patching.nix --arg version 2) -nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest2 $out2 +nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out2 +mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest2 out3=$(nix-build -o $RESULT binary-patching.nix --arg version 3) -nix-push --copy $TEST_ROOT/cache2 $TEST_ROOT/manifest3 $out3 +nix-push --dest $TEST_ROOT/cache2 --manifest --bzip2 $out3 +mv $TEST_ROOT/cache2/MANIFEST $TEST_ROOT/manifest3 rm $RESULT diff --git a/tests/install-package.sh b/tests/install-package.sh index b818eda12..653dfee4c 100644 --- a/tests/install-package.sh +++ b/tests/install-package.sh @@ -9,7 +9,7 @@ clearStore clearProfiles cat > $TEST_ROOT/foo.nixpkg <