* Image generation for openSUSE 10.3.
svn path=/nixpkgs/trunk/; revision=11570
This commit is contained in:
parent
1cf96f65bf
commit
75222355db
@ -128,11 +128,19 @@ rec {
|
||||
http://archive.ubuntu.com/ubuntu/
|
||||
];
|
||||
|
||||
# Fedora (please only full mirrors that carry old Fedora distributions as well).
|
||||
# Fedora (please only add full mirrors that carry old Fedora distributions as well).
|
||||
fedora = [
|
||||
http://ftp.nluug.nl/pub/os/Linux/distr/fedora/
|
||||
http://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/
|
||||
http://download.fedora.redhat.com/pub/fedora/
|
||||
];
|
||||
|
||||
# openSUSE.
|
||||
opensuse = [
|
||||
http://opensuse.hro.nl/opensuse/
|
||||
http://ftp.funet.fi/pub/linux/mirrors/opensuse/
|
||||
http://ftp5.gwdg.de/pub/opensuse/
|
||||
http://ftp.opensuse.org/pub/opensuse/
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -491,12 +491,12 @@ rec {
|
||||
|
||||
/* Generate a Nix expression containing fetchurl calls for the
|
||||
closure of a set of top-level RPM packages from the
|
||||
`primary.xml.gz' file of a Fedora or OpenSUSE distribution. */
|
||||
`primary.xml.gz' file of a Fedora or openSUSE distribution. */
|
||||
|
||||
rpmClosureGenerator =
|
||||
{name, packagesList, urlPrefix, packages}:
|
||||
{name, packagesList, urlPrefix, packages, archs ? []}:
|
||||
|
||||
runCommand "${name}.nix" {buildInputs = [perl perlXMLSimple];} ''
|
||||
runCommand "${name}.nix" {buildInputs = [perl perlXMLSimple]; inherit archs;} ''
|
||||
gunzip < ${packagesList} > ./packages.xml
|
||||
perl -w ${rpm/rpm-closure.pl} \
|
||||
./packages.xml ${urlPrefix} ${toString packages} > $out
|
||||
@ -508,12 +508,12 @@ rec {
|
||||
names. */
|
||||
|
||||
makeImageFromRPMDist =
|
||||
{name, fullName, size ? 1024, urlPrefix, packagesList, packages, postInstall ? ""}:
|
||||
{name, fullName, size ? 1024, urlPrefix, packagesList, packages, postInstall ? "", archs ? ["noarch" "i386"]}:
|
||||
|
||||
fillDiskWithRPMs {
|
||||
inherit name fullName size postInstall;
|
||||
rpms = import (rpmClosureGenerator {
|
||||
inherit name packagesList urlPrefix packages;
|
||||
inherit name packagesList urlPrefix packages archs;
|
||||
}) {inherit fetchurl;};
|
||||
};
|
||||
|
||||
@ -602,6 +602,17 @@ rec {
|
||||
urlPrefix = mirror://fedora/linux/releases/8/Fedora/i386/os;
|
||||
} // args);
|
||||
|
||||
opensuse103i386 = args: makeImageFromRPMDist ({
|
||||
name = "opensuse-10.3-i586";
|
||||
fullName = "openSUSE 10.3 (i586)";
|
||||
packagesList = fetchurl {
|
||||
url = mirror://opensuse/distribution/10.3/repo/oss/suse/repodata/primary.xml.gz;
|
||||
sha256 = "0zb5kxsb755nqq9i8jdclmanacyf551ncx6a011v9jqphsvyfvd7";
|
||||
};
|
||||
urlPrefix = mirror://opensuse/distribution/10.3/repo/oss/suse/;
|
||||
archs = ["noarch" "i586"];
|
||||
} // args);
|
||||
|
||||
ubuntu710i386 = args: makeImageFromDebDist ({
|
||||
name = "ubuntu-7.10-gutsy-i386";
|
||||
fullName = "Ubuntu 7.10 Gutsy (i386)";
|
||||
@ -649,6 +660,29 @@ rec {
|
||||
];
|
||||
|
||||
|
||||
/* Common packages for openSUSE images. */
|
||||
commonOpenSUSEPackages = [
|
||||
"aaa_base"
|
||||
"autoconf"
|
||||
"automake"
|
||||
"bzip2"
|
||||
"curl"
|
||||
"devs"
|
||||
"diffutils"
|
||||
"findutils"
|
||||
"gawk"
|
||||
"gcc-c++"
|
||||
"gzip"
|
||||
"make"
|
||||
"patch"
|
||||
"perl"
|
||||
"pkg-config"
|
||||
"rpm"
|
||||
"tar"
|
||||
"unzip"
|
||||
];
|
||||
|
||||
|
||||
/* Common packages for Debian/Ubuntu images. */
|
||||
commonDebianPackages = [
|
||||
"base-passwd"
|
||||
@ -706,6 +740,7 @@ rec {
|
||||
fedora5i386 = diskImageFuns.fedora5i386 { packages = commonFedoraPackages; };
|
||||
fedora7i386 = diskImageFuns.fedora7i386 { packages = commonFedoraPackages; };
|
||||
fedora8i386 = diskImageFuns.fedora8i386 { packages = commonFedoraPackages; };
|
||||
opensuse103i386 = diskImageFuns.opensuse103i386 { packages = commonOpenSUSEPackages; };
|
||||
|
||||
ubuntu710i386 = diskImageFuns.ubuntu710i386 { packages = commonDebianPackages; };
|
||||
debian40r3i386 = diskImageFuns.debian40r3i386 { packages = commonDebianPackages; };
|
||||
|
@ -5,25 +5,48 @@ my $packagesFile = shift @ARGV;
|
||||
my $urlPrefix = shift @ARGV;
|
||||
my @toplevelPkgs = @ARGV;
|
||||
|
||||
my $xml = XMLin($packagesFile, ForceArray => ['package', 'rpm:entry', 'file'], KeyAttr => ['name']) or die;
|
||||
my $pkgs = $xml->{'package'};
|
||||
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 %provides;
|
||||
foreach my $pkgName (keys %{$pkgs}) {
|
||||
print STDERR "looking at $pkgName\n";
|
||||
my $pkg = $pkgs->{$pkgName};
|
||||
print STDERR keys %{$pkg->{format}->{'rpm:provides'}}, "\n";
|
||||
if (defined $pkg->{format}->{'rpm:provides'}) {
|
||||
my $provides = $pkg->{format}->{'rpm:provides'}->{'rpm:entry'};
|
||||
foreach my $req (keys %{$provides}) {
|
||||
#print STDERR " provides $req\n";
|
||||
#die "multiple provides for $req" if defined $provides{$req};
|
||||
$provides{$req} = $pkgName;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
my %provides;
|
||||
foreach my $pkgName (keys %pkgs) {
|
||||
print STDERR "looking at $pkgName\n";
|
||||
my $pkg = $pkgs{$pkgName};
|
||||
|
||||
#print STDERR keys %{$pkg->{format}}, "\n";
|
||||
|
||||
#print STDERR $pkg->{format}->{'rpm:provides'}, "\n";
|
||||
|
||||
my $provides = $pkg->{format}->{'rpm:provides'}->{'rpm:entry'} or die;
|
||||
foreach my $req (@{$provides}) {
|
||||
#print "$req->{name}\n";
|
||||
#print STDERR " provides $req\n";
|
||||
#die "multiple provides for $req" if defined $provides{$req};
|
||||
$provides{$req->{name}} = $pkgName;
|
||||
}
|
||||
|
||||
if (defined $pkg->{format}->{file}) {
|
||||
foreach my $file (@{$pkg->{format}->{file}}) {
|
||||
#print STDERR " provides file $file\n";
|
||||
@ -44,17 +67,17 @@ sub closePackage {
|
||||
|
||||
print STDERR ">>> $pkgName\n";
|
||||
|
||||
my $pkg = $pkgs->{$pkgName} or die "package $pkgName doesn't exist";
|
||||
my $pkg = $pkgs{$pkgName} or die "package $pkgName doesn't exist";
|
||||
|
||||
my $requires = $pkg->{format}->{'rpm:requires'}->{'rpm:entry'} or die;
|
||||
|
||||
my @deps = ();
|
||||
foreach my $req (keys %{$requires}) {
|
||||
next if $req =~ /^rpmlib\(/;
|
||||
print STDERR " needs $req\n";
|
||||
my $provider = $provides{$req};
|
||||
foreach my $req (@{$requires}) {
|
||||
next if $req->{name} =~ /^rpmlib\(/;
|
||||
print STDERR " needs $req->{name}\n";
|
||||
my $provider = $provides{$req->{name}};
|
||||
if (!defined $provider) {
|
||||
print STDERR " WARNING: no provider for $req\n";
|
||||
print STDERR " WARNING: no provider for $req->{name}\n";
|
||||
next;
|
||||
}
|
||||
print STDERR " satisfied by $provider\n";
|
||||
@ -79,7 +102,7 @@ print "{fetchurl}:\n\n";
|
||||
print "[\n\n";
|
||||
|
||||
foreach my $pkgName (@needed) {
|
||||
my $pkg = $pkgs->{$pkgName};
|
||||
my $pkg = $pkgs{$pkgName};
|
||||
die if $pkg->{checksum}->{type} ne "sha";
|
||||
print " (fetchurl {\n";
|
||||
print " url = $urlPrefix/$pkg->{location}->{href};\n";
|
||||
|
Loading…
Reference in New Issue
Block a user