aboutsummaryrefslogtreecommitdiff
path: root/scripts/nix-generate-patches.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-02-09 12:41:54 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-02-09 12:41:54 +0000
commitd0eda1f3e9b2030e373038fd8997f033f2d7aedd (patch)
tree9db733f87fceaba36ddcba54b794b8be06c1d136 /scripts/nix-generate-patches.in
parent3854fc9b42d16b810f62b64194b699033b03aaf1 (diff)
parent543988572e2abc85767da315b2acc1f971c5d07f (diff)
* Merged the SQLite branch.
Diffstat (limited to 'scripts/nix-generate-patches.in')
-rw-r--r--scripts/nix-generate-patches.in42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/nix-generate-patches.in b/scripts/nix-generate-patches.in
new file mode 100644
index 000000000..c96cc704a
--- /dev/null
+++ b/scripts/nix-generate-patches.in
@@ -0,0 +1,42 @@
+#! @perl@ -w -I@libexecdir@/nix
+
+use strict;
+use File::Temp qw(tempdir);
+use NixManifest;
+use GeneratePatches;
+
+if (scalar @ARGV != 5) {
+ print STDERR <<EOF;
+Usage: nix-generate-patches NAR-DIR PATCH-DIR PATCH-URI OLD-MANIFEST NEW-MANIFEST
+
+This command generates binary patches between NAR files listed in
+OLD-MANIFEST and NEW-MANIFEST. The patches are written to the
+directory PATCH-DIR, and the prefix PATCH-URI is used to generate URIs
+for the patches. The patches are added to NEW-MANIFEST. All NARs are
+required to exist in NAR-DIR. Patches are generated between
+succeeding versions of packages with the same name.
+EOF
+ exit 1;
+}
+
+my $narPath = $ARGV[0];
+my $patchesPath = $ARGV[1];
+my $patchesURL = $ARGV[2];
+my $srcManifest = $ARGV[3];
+my $dstManifest = $ARGV[4];
+
+my (%srcNarFiles, %srcLocalPaths, %srcPatches);
+readManifest $srcManifest, \%srcNarFiles, \%srcLocalPaths, \%srcPatches;
+
+my (%dstNarFiles, %dstLocalPaths, %dstPatches);
+readManifest $dstManifest, \%dstNarFiles, \%dstLocalPaths, \%dstPatches;
+
+my $tmpDir = tempdir("nix-generate-patches.XXXXXX", CLEANUP => 1, TMPDIR => 1)
+ or die "cannot create a temporary directory";
+
+generatePatches \%srcNarFiles, \%dstNarFiles, \%srcPatches, \%dstPatches,
+ $narPath, $patchesPath, $patchesURL, $tmpDir;
+
+propagatePatches \%srcPatches, \%dstNarFiles, \%dstPatches;
+
+writeManifest $dstManifest, \%dstNarFiles, \%dstPatches;