* rpm-closure.pl: add possibility to use multiple repositories
* default.nix: do not assume fixed filesystem type when mounting, to allow using other filesystems svn path=/nixpkgs/trunk/; revision=29757
This commit is contained in:
@@ -1,34 +1,52 @@
|
||||
use strict;
|
||||
use XML::Simple;
|
||||
|
||||
my $packagesFile = shift @ARGV;
|
||||
my $urlPrefix = shift @ARGV;
|
||||
my @packagesFiles = ();
|
||||
my @urlPrefixes = ();
|
||||
|
||||
# rpm-closure.pl (<package-file> <url-prefix>)+ <toplevel-pkg>+
|
||||
|
||||
while(-f $ARGV[0]) {
|
||||
my $packagesFile = shift @ARGV;
|
||||
my $urlPrefix = shift @ARGV;
|
||||
push(@packagesFiles, $packagesFile);
|
||||
push(@urlPrefixes, $urlPrefix);
|
||||
}
|
||||
|
||||
my @toplevelPkgs = @ARGV;
|
||||
|
||||
my @archs = split ' ', ($ENV{'archs'} or "");
|
||||
|
||||
print STDERR "parsing packages...\n";
|
||||
|
||||
my $xml = XMLin($packagesFile, ForceArray => ['package', 'rpm:entry', 'file'], KeyAttr => []) or die;
|
||||
|
||||
print STDERR "file contains $xml->{packages} packages\n";
|
||||
|
||||
|
||||
my %pkgs;
|
||||
foreach my $pkg (@{$xml->{'package'}}) {
|
||||
if (scalar @archs > 0) {
|
||||
my $arch = $pkg->{arch};
|
||||
my $found = 0;
|
||||
foreach my $a (@archs) { $found = 1 if $arch eq $a; }
|
||||
next if !$found;
|
||||
}
|
||||
if (defined $pkgs{$pkg->{name}}) {
|
||||
print STDERR "WARNING: duplicate occurrence of package $pkg->{name}\n";
|
||||
next;
|
||||
}
|
||||
$pkgs{$pkg->{name}} = $pkg;
|
||||
}
|
||||
for (my $i = 0; $i < scalar(@packagesFiles); $i++) {
|
||||
my $packagesFile = $packagesFiles[$i];
|
||||
print STDERR "parsing packages in $packagesFile...\n";
|
||||
|
||||
my $xml = XMLin($packagesFile, ForceArray => ['package', 'rpm:entry', 'file'], KeyAttr => []) or die;
|
||||
|
||||
print STDERR "$packagesFile contains $xml->{packages} packages\n";
|
||||
|
||||
foreach my $pkg (@{$xml->{'package'}}) {
|
||||
if (scalar @archs > 0) {
|
||||
my $arch = $pkg->{arch};
|
||||
my $found = 0;
|
||||
foreach my $a (@archs) { $found = 1 if $arch eq $a; }
|
||||
next if !$found;
|
||||
}
|
||||
if (defined $pkgs{$pkg->{name}}) {
|
||||
my $earlierPkg = $pkgs{$pkg->{name}};
|
||||
print STDERR "WARNING: duplicate occurrence of package $pkg->{name}\n";
|
||||
if ($earlierPkg->{'time'}->{file} <= $pkg->{'time'}->{file}) {
|
||||
print STDERR "WARNING: replaced package $pkg->{name} with newer one\n";
|
||||
$pkg->{urlPrefix} = $urlPrefixes[$i];
|
||||
$pkgs{$pkg->{name}} = $pkg;
|
||||
}
|
||||
next;
|
||||
}
|
||||
$pkg->{urlPrefix} = $urlPrefixes[$i];
|
||||
$pkgs{$pkg->{name}} = $pkg;
|
||||
}
|
||||
}
|
||||
|
||||
my %provides;
|
||||
foreach my $pkgName (keys %pkgs) {
|
||||
@@ -104,7 +122,7 @@ print "[\n\n";
|
||||
foreach my $pkgName (@needed) {
|
||||
my $pkg = $pkgs{$pkgName};
|
||||
print " (fetchurl {\n";
|
||||
print " url = $urlPrefix/$pkg->{location}->{href};\n";
|
||||
print " url = $pkg->{urlPrefix}/$pkg->{location}->{href};\n";
|
||||
if ($pkg->{checksum}->{type} eq "sha") {
|
||||
print " sha1 = \"$pkg->{checksum}->{content}\";\n";
|
||||
} elsif ($pkg->{checksum}->{type} eq "sha256") {
|
||||
|
||||
Reference in New Issue
Block a user