* Get rid of tab characters.

This commit is contained in:
Eelco Dolstra 2003-11-24 08:20:49 +00:00
parent af7e6fe22e
commit 60e86b124f

View file

@ -27,7 +27,7 @@ while (<CONFFILE>) {
chomp; chomp;
if (/^\s*(\S+)\s*(\#.*)?$/) { if (/^\s*(\S+)\s*(\#.*)?$/) {
my $url = $1; my $url = $1;
$url =~ s/\/$//; $url =~ s/\/$//;
print "obtaining list of Nix archives at $url...\n"; print "obtaining list of Nix archives at $url...\n";
@ -36,70 +36,70 @@ while (<CONFFILE>) {
open MANIFEST, "<$manifest"; open MANIFEST, "<$manifest";
my $inside = 0; my $inside = 0;
my $storepath; my $storepath;
my $narname; my $narname;
my $hash; my $hash;
my @preds; my @preds;
while (<MANIFEST>) { while (<MANIFEST>) {
chomp; chomp;
s/\#.*$//g; s/\#.*$//g;
next if (/^$/); next if (/^$/);
if (!$inside) { if (!$inside) {
if (/^\{$/) { if (/^\{$/) {
$inside = 1; $inside = 1;
undef $storepath; undef $storepath;
undef $narname; undef $narname;
undef $hash; undef $hash;
@preds = (); @preds = ();
} }
else { die "bad line: $_"; } else { die "bad line: $_"; }
} else { } else {
if (/^\}$/) { if (/^\}$/) {
$inside = 0; $inside = 0;
my $fullurl = "$url/$narname"; my $fullurl = "$url/$narname";
print "$storepath\n"; print "$storepath\n";
# Construct a Fix expression that fetches and unpacks a # Construct a Fix expression that fetches and unpacks a
# Nix archive from the network. # Nix archive from the network.
my $fetch = my $fetch =
"App(IncludeFix(\"fetchurl/fetchurl.fix\"), " . "App(IncludeFix(\"fetchurl/fetchurl.fix\"), " .
"[(\"url\", \"$fullurl\"), (\"md5\", \"$hash\")])"; "[(\"url\", \"$fullurl\"), (\"md5\", \"$hash\")])";
my $fixexpr = my $fixexpr =
"App(IncludeFix(\"nar/unnar.fix\"), " . "App(IncludeFix(\"nar/unnar.fix\"), " .
"[ (\"nar\", $fetch)" . "[ (\"nar\", $fetch)" .
", (\"outPath\", \"$storepath\")" . ", (\"outPath\", \"$storepath\")" .
"])"; "])";
if (!$first) { $fullexpr .= "," }; if (!$first) { $fullexpr .= "," };
$first = 0; $first = 0;
$fullexpr .= $fixexpr; # !!! O(n^2)? $fullexpr .= $fixexpr; # !!! O(n^2)?
push @srcpaths, $storepath; push @srcpaths, $storepath;
foreach my $p (@preds) { foreach my $p (@preds) {
push @sucs, $p; push @sucs, $p;
push @sucs, $storepath; push @sucs, $storepath;
} }
} }
elsif (/^\s*StorePath:\s*(\/\S+)\s*$/) { elsif (/^\s*StorePath:\s*(\/\S+)\s*$/) {
$storepath = $1; $storepath = $1;
} }
elsif (/^\s*NarName:\s*(\S+)\s*$/) { elsif (/^\s*NarName:\s*(\S+)\s*$/) {
$narname = $1; $narname = $1;
} }
elsif (/^\s*MD5:\s*(\S+)\s*$/) { elsif (/^\s*MD5:\s*(\S+)\s*$/) {
$hash = $1; $hash = $1;
} }
elsif (/^\s*SuccOf:\s*(\/\S+)\s*$/) { elsif (/^\s*SuccOf:\s*(\/\S+)\s*$/) {
push @preds, $1; push @preds, $1;
} }
else { die "bad line: $_"; } else { die "bad line: $_"; }
} }
} }
close MANIFEST; close MANIFEST;