diff options
author | Rob Vermaas <rob.vermaas@gmail.com> | 2011-10-11 13:22:09 +0000 |
---|---|---|
committer | Rob Vermaas <rob.vermaas@gmail.com> | 2011-10-11 13:22:09 +0000 |
commit | 40f1e4e289c19b9a8deafa77ad8e450f0f93f753 (patch) | |
tree | 3b80c7768909cd7012553210d43b337c19f4b19f /pkgs/build-support/vm/rpm | |
parent | a1f9b6f7b63e3571efdb332c8cf2a6a0094cb910 (diff) | |
download | nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar.gz nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar.bz2 nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar.lz nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar.xz nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.tar.zst nixlib-40f1e4e289c19b9a8deafa77ad8e450f0f93f753.zip |
* 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
Diffstat (limited to 'pkgs/build-support/vm/rpm')
-rw-r--r-- | pkgs/build-support/vm/rpm/rpm-closure.pl | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/pkgs/build-support/vm/rpm/rpm-closure.pl b/pkgs/build-support/vm/rpm/rpm-closure.pl index 5f333fdfe80b..5efc162784ac 100644 --- a/pkgs/build-support/vm/rpm/rpm-closure.pl +++ b/pkgs/build-support/vm/rpm/rpm-closure.pl @@ -1,35 +1,53 @@ 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; +my %pkgs; +for (my $i = 0; $i < scalar(@packagesFiles); $i++) { + my $packagesFile = $packagesFiles[$i]; + print STDERR "parsing packages in $packagesFile...\n"; -print STDERR "file contains $xml->{packages} packages\n"; + my $xml = XMLin($packagesFile, ForceArray => ['package', 'rpm:entry', 'file'], KeyAttr => []) or die; + print STDERR "$packagesFile 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; + 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; } - $pkgs{$pkg->{name}} = $pkg; } - my %provides; foreach my $pkgName (keys %pkgs) { print STDERR "looking at $pkgName\n"; @@ -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") { |