copy-tarballs.pl: Revive extracting all tarballs from release.nix

This commit is contained in:
Eelco Dolstra 2015-12-16 13:59:02 +01:00
parent 493f633002
commit 7cd3d502bb
6 changed files with 47 additions and 9 deletions

View File

@ -0,0 +1,18 @@
/* Helper expression for copy-tarballs. This returns (nearly) all
tarballs used the free packages in Nixpkgs.
Typical usage:
$ copy-tarballs.pl --expr 'import <nixpkgs/maintainers/scripts/all-tarballs.nix>'
*/
removeAttrs (import ../../pkgs/top-level/release.nix
{ # Don't apply hydraJob to jobs, because then we can't get to the
# dependency graph.
scrubJobs = false;
# No need to evaluate on i686.
supportedSystems = [ "x86_64-linux" ];
})
[ # Remove jobs whose evaluation depends on a writable Nix store.
"tarball" "unstable"
]

View File

@ -93,7 +93,7 @@ elsif ($op eq "--expr") {
# Evaluate find-tarballs.nix.
my $expr = $ARGV[0] // die "$0: --expr requires a Nix expression\n";
my $pid = open(JSON, "-|", "nix-instantiate", "--eval-only", "--json", "--strict",
my $pid = open(JSON, "-|", "nix-instantiate", "--eval", "--json", "--strict",
"<nixpkgs/maintainers/scripts/find-tarballs.nix>",
"--arg", "expr", $expr);
my $stdout = <JSON>;
@ -113,6 +113,11 @@ elsif ($op eq "--expr") {
my $algo = $fetch->{type};
my $hash = $fetch->{hash};
if (defined $ENV{DEBUG}) {
print "$url $algo $hash\n";
next;
}
if ($url !~ /^http:/ && $url !~ /^https:/ && $url !~ /^ftp:/ && $url !~ /^mirror:/) {
print STDERR "skipping $url (unsupported scheme)\n";
next;

View File

@ -1,10 +1,9 @@
# This expression returns a list of all fetchurl calls used by all
# packages reachable from release.nix.
# This expression returns a list of all fetchurl calls used by expr.
with import ../.. { };
with lib;
{ expr ? removeAttrs (import ../../pkgs/top-level/release.nix { }) [ "tarball" "unstable" ] }:
{ expr }:
let

View File

@ -14,7 +14,7 @@ releaseTools.sourceTarball rec {
version = builtins.readFile ../../.version;
versionSuffix = "pre${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
buildInputs = [ nix ];
buildInputs = [ nix jq ];
configurePhase = ''
eval "$preConfigure"
@ -83,7 +83,15 @@ releaseTools.sourceTarball rec {
stopNest
header "checking find-tarballs.nix"
nix-instantiate --eval --strict --show-trace ./maintainers/scripts/find-tarballs.nix > /dev/null
nix-instantiate --eval --strict --show-trace --json \
./maintainers/scripts/find-tarballs.nix \
--arg expr 'import ./maintainers/scripts/all-tarballs.nix' > $TMPDIR/tarballs.json
nrUrls=$(jq -r '.[].url' < $TMPDIR/tarballs.json | wc -l)
echo "found $nrUrls URLs"
if [ "$nrUrls" -lt 10000 ]; then
echo "suspiciously low number of URLs"
exit 1
fi
stopNest
'';

View File

@ -1,4 +1,8 @@
{ supportedSystems, packageSet ? (import ./all-packages.nix), allowTexliveBuilds ? false }:
{ supportedSystems
, packageSet ? (import ./all-packages.nix)
, allowTexliveBuilds ? false
, scrubJobs ? true
}:
with import ../../lib;
@ -14,6 +18,9 @@ rec {
pkgs = pkgsFor "x86_64-linux";
hydraJob' = if scrubJobs then hydraJob else id;
/* !!! Hack: poor man's memoisation function. Necessary to prevent
Nixpkgs from being evaluated again and again for every
job/platform pair. */
@ -48,7 +55,7 @@ rec {
a derivation for each supported platform, i.e. { x86_64-linux =
f pkgs_x86_64_linux; i686-linux = f pkgs_i686_linux; ... }. */
testOn = systems: f: genAttrs
(filter (x: elem x supportedSystems) systems) (system: hydraJob (f (pkgsFor system)));
(filter (x: elem x supportedSystems) systems) (system: hydraJob' (f (pkgsFor system)));
/* Similar to the testOn function, but with an additional

View File

@ -13,9 +13,10 @@
, officialRelease ? false
, # The platforms for which we build Nixpkgs.
supportedSystems ? [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]
, scrubJobs ? true
}:
with import ./release-lib.nix { inherit supportedSystems; };
with import ./release-lib.nix { inherit supportedSystems scrubJobs; };
let