* Add a NarSize field to Hydra manifests. This allows nix-env

to predict how much disk space a package will require.
* Compute the output / closure size using the info stored in the
  Nix database (rather than doing a slow "du").
This commit is contained in:
Eelco Dolstra
2010-11-19 15:44:20 +00:00
parent ba31684153
commit a93e272364
4 changed files with 17 additions and 24 deletions

View File

@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
our @ISA = qw(Exporter);
our @EXPORT = qw(
isValidPath queryPathInfo
isValidPath
getHydraPath getHydraDBPath openHydraDB txn_do
registerRoot getGCRootsDir gcRootFor
getPrimaryBuildsForView
@ -23,17 +23,6 @@ sub isValidPath {
}
sub queryPathInfo {
my $path = shift;
my $hash = Nix::queryPathHash($path);
my $deriver = Nix::queryDeriver($path);
my @refs = Nix::queryReferences($path);
return ($hash, $deriver, \@refs);
}
sub getHydraPath {
my $dir = $ENV{"HYDRA_DATA"};
die "The HYDRA_DATA environment variable is not set!\n" unless defined $dir;

View File

@ -21,7 +21,7 @@ sub process {
"}\n";
foreach my $path (@paths) {
my ($hash, $deriver, $refs) = queryPathInfo $path;
my ($deriver, $hash, $time, $narSize, $refs) = Nix::queryPathInfo $path;
# Escape the characters that are allowed to appear in a Nix
# path name but have special meaning in a URI.
@ -40,6 +40,7 @@ sub process {
(defined $deriver ? " Deriver: $deriver\n" : "") .
" NarURL: $url\n" .
" NarHash: $hash\n" .
($narSize != 0 ? " NarSize: $narSize\n" : "") .
"}\n";
}