Merge pull request #37288 from cleverca22/improve-make-tarball
make-system-tarball: allow alternate compression methods
This commit is contained in:
commit
9b30d48b2b
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, perl, xz, pathsFromGraph
|
{ stdenv, perl, pixz, pathsFromGraph
|
||||||
|
|
||||||
, # The file name of the resulting tarball
|
, # The file name of the resulting tarball
|
||||||
fileName ? "nixos-system-${stdenv.system}"
|
fileName ? "nixos-system-${stdenv.system}"
|
||||||
@ -21,14 +21,20 @@
|
|||||||
|
|
||||||
# Extra tar arguments
|
# Extra tar arguments
|
||||||
, extraArgs ? ""
|
, extraArgs ? ""
|
||||||
|
# Command used for compression
|
||||||
|
, compressCommand ? "pixz"
|
||||||
|
# Extension for the compressed tarball
|
||||||
|
, compressionExtension ? ".xz"
|
||||||
|
# extra inputs, like the compressor to use
|
||||||
|
, extraInputs ? [ pixz ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "tarball";
|
name = "tarball";
|
||||||
builder = ./make-system-tarball.sh;
|
builder = ./make-system-tarball.sh;
|
||||||
buildInputs = [perl xz];
|
buildInputs = [ perl ] ++ extraInputs;
|
||||||
|
|
||||||
inherit fileName pathsFromGraph extraArgs extraCommands;
|
inherit fileName pathsFromGraph extraArgs extraCommands compressCommand;
|
||||||
|
|
||||||
# !!! should use XML.
|
# !!! should use XML.
|
||||||
sources = map (x: x.source) contents;
|
sources = map (x: x.source) contents;
|
||||||
@ -41,4 +47,6 @@ stdenv.mkDerivation {
|
|||||||
# For obtaining the closure of `storeContents'.
|
# For obtaining the closure of `storeContents'.
|
||||||
exportReferencesGraph =
|
exportReferencesGraph =
|
||||||
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
|
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
|
||||||
|
|
||||||
|
extension = compressionExtension;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
set -x
|
|
||||||
|
|
||||||
sources_=($sources)
|
sources_=($sources)
|
||||||
targets_=($targets)
|
targets_=($targets)
|
||||||
@ -54,8 +53,8 @@ mkdir -p $out/tarball
|
|||||||
|
|
||||||
rm env-vars
|
rm env-vars
|
||||||
|
|
||||||
tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
|
time tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -c * $extraArgs | $compressCommand > $out/tarball/$fileName.tar${extension}
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo $system > $out/nix-support/system
|
echo $system > $out/nix-support/system
|
||||||
echo "file system-tarball $out/tarball/$fileName.tar.xz" > $out/nix-support/hydra-build-products
|
echo "file system-tarball $out/tarball/$fileName.tar${extension}" > $out/nix-support/hydra-build-products
|
||||||
|
@ -14,9 +14,7 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
# Create the tarball
|
# Create the tarball
|
||||||
system.build.tarball = import ../../lib/make-system-tarball.nix {
|
system.build.tarball = pkgs.callPackage ../../lib/make-system-tarball.nix {
|
||||||
inherit (pkgs) stdenv perl xz pathsFromGraph;
|
|
||||||
|
|
||||||
contents = [];
|
contents = [];
|
||||||
extraArgs = "--owner=0";
|
extraArgs = "--owner=0";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user