* 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/
|
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 = [
|
fedora = [
|
||||||
http://ftp.nluug.nl/pub/os/Linux/distr/fedora/
|
http://ftp.nluug.nl/pub/os/Linux/distr/fedora/
|
||||||
http://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/
|
http://ftp.funet.fi/pub/mirrors/ftp.redhat.com/pub/fedora/
|
||||||
http://download.fedora.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
|
/* Generate a Nix expression containing fetchurl calls for the
|
||||||
closure of a set of top-level RPM packages from 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 =
|
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
|
gunzip < ${packagesList} > ./packages.xml
|
||||||
perl -w ${rpm/rpm-closure.pl} \
|
perl -w ${rpm/rpm-closure.pl} \
|
||||||
./packages.xml ${urlPrefix} ${toString packages} > $out
|
./packages.xml ${urlPrefix} ${toString packages} > $out
|
||||||
|
@ -508,12 +508,12 @@ rec {
|
||||||
names. */
|
names. */
|
||||||
|
|
||||||
makeImageFromRPMDist =
|
makeImageFromRPMDist =
|
||||||
{name, fullName, size ? 1024, urlPrefix, packagesList, packages, postInstall ? ""}:
|
{name, fullName, size ? 1024, urlPrefix, packagesList, packages, postInstall ? "", archs ? ["noarch" "i386"]}:
|
||||||
|
|
||||||
fillDiskWithRPMs {
|
fillDiskWithRPMs {
|
||||||
inherit name fullName size postInstall;
|
inherit name fullName size postInstall;
|
||||||
rpms = import (rpmClosureGenerator {
|
rpms = import (rpmClosureGenerator {
|
||||||
inherit name packagesList urlPrefix packages;
|
inherit name packagesList urlPrefix packages archs;
|
||||||
}) {inherit fetchurl;};
|
}) {inherit fetchurl;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -602,6 +602,17 @@ rec {
|
||||||
urlPrefix = mirror://fedora/linux/releases/8/Fedora/i386/os;
|
urlPrefix = mirror://fedora/linux/releases/8/Fedora/i386/os;
|
||||||
} // args);
|
} // 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 ({
|
ubuntu710i386 = args: makeImageFromDebDist ({
|
||||||
name = "ubuntu-7.10-gutsy-i386";
|
name = "ubuntu-7.10-gutsy-i386";
|
||||||
fullName = "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. */
|
/* Common packages for Debian/Ubuntu images. */
|
||||||
commonDebianPackages = [
|
commonDebianPackages = [
|
||||||
"base-passwd"
|
"base-passwd"
|
||||||
|
@ -706,6 +740,7 @@ rec {
|
||||||
fedora5i386 = diskImageFuns.fedora5i386 { packages = commonFedoraPackages; };
|
fedora5i386 = diskImageFuns.fedora5i386 { packages = commonFedoraPackages; };
|
||||||
fedora7i386 = diskImageFuns.fedora7i386 { packages = commonFedoraPackages; };
|
fedora7i386 = diskImageFuns.fedora7i386 { packages = commonFedoraPackages; };
|
||||||
fedora8i386 = diskImageFuns.fedora8i386 { packages = commonFedoraPackages; };
|
fedora8i386 = diskImageFuns.fedora8i386 { packages = commonFedoraPackages; };
|
||||||
|
opensuse103i386 = diskImageFuns.opensuse103i386 { packages = commonOpenSUSEPackages; };
|
||||||
|
|
||||||
ubuntu710i386 = diskImageFuns.ubuntu710i386 { packages = commonDebianPackages; };
|
ubuntu710i386 = diskImageFuns.ubuntu710i386 { packages = commonDebianPackages; };
|
||||||
debian40r3i386 = diskImageFuns.debian40r3i386 { packages = commonDebianPackages; };
|
debian40r3i386 = diskImageFuns.debian40r3i386 { packages = commonDebianPackages; };
|
||||||
|
|
|
@ -5,25 +5,48 @@ my $packagesFile = shift @ARGV;
|
||||||
my $urlPrefix = shift @ARGV;
|
my $urlPrefix = shift @ARGV;
|
||||||
my @toplevelPkgs = @ARGV;
|
my @toplevelPkgs = @ARGV;
|
||||||
|
|
||||||
my $xml = XMLin($packagesFile, ForceArray => ['package', 'rpm:entry', 'file'], KeyAttr => ['name']) or die;
|
my @archs = split ' ', ($ENV{'archs'} or "");
|
||||||
my $pkgs = $xml->{'package'};
|
|
||||||
|
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";
|
print STDERR "file contains $xml->{packages} packages\n";
|
||||||
|
|
||||||
|
|
||||||
my %provides;
|
my %pkgs;
|
||||||
foreach my $pkgName (keys %{$pkgs}) {
|
foreach my $pkg (@{$xml->{'package'}}) {
|
||||||
print STDERR "looking at $pkgName\n";
|
if (scalar @archs > 0) {
|
||||||
my $pkg = $pkgs->{$pkgName};
|
my $arch = $pkg->{arch};
|
||||||
print STDERR keys %{$pkg->{format}->{'rpm:provides'}}, "\n";
|
my $found = 0;
|
||||||
if (defined $pkg->{format}->{'rpm:provides'}) {
|
foreach my $a (@archs) { $found = 1 if $arch eq $a; }
|
||||||
my $provides = $pkg->{format}->{'rpm:provides'}->{'rpm:entry'};
|
next if !$found;
|
||||||
foreach my $req (keys %{$provides}) {
|
|
||||||
#print STDERR " provides $req\n";
|
|
||||||
#die "multiple provides for $req" if defined $provides{$req};
|
|
||||||
$provides{$req} = $pkgName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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}) {
|
if (defined $pkg->{format}->{file}) {
|
||||||
foreach my $file (@{$pkg->{format}->{file}}) {
|
foreach my $file (@{$pkg->{format}->{file}}) {
|
||||||
#print STDERR " provides file $file\n";
|
#print STDERR " provides file $file\n";
|
||||||
|
@ -44,17 +67,17 @@ sub closePackage {
|
||||||
|
|
||||||
print STDERR ">>> $pkgName\n";
|
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 $requires = $pkg->{format}->{'rpm:requires'}->{'rpm:entry'} or die;
|
||||||
|
|
||||||
my @deps = ();
|
my @deps = ();
|
||||||
foreach my $req (keys %{$requires}) {
|
foreach my $req (@{$requires}) {
|
||||||
next if $req =~ /^rpmlib\(/;
|
next if $req->{name} =~ /^rpmlib\(/;
|
||||||
print STDERR " needs $req\n";
|
print STDERR " needs $req->{name}\n";
|
||||||
my $provider = $provides{$req};
|
my $provider = $provides{$req->{name}};
|
||||||
if (!defined $provider) {
|
if (!defined $provider) {
|
||||||
print STDERR " WARNING: no provider for $req\n";
|
print STDERR " WARNING: no provider for $req->{name}\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
print STDERR " satisfied by $provider\n";
|
print STDERR " satisfied by $provider\n";
|
||||||
|
@ -79,7 +102,7 @@ print "{fetchurl}:\n\n";
|
||||||
print "[\n\n";
|
print "[\n\n";
|
||||||
|
|
||||||
foreach my $pkgName (@needed) {
|
foreach my $pkgName (@needed) {
|
||||||
my $pkg = $pkgs->{$pkgName};
|
my $pkg = $pkgs{$pkgName};
|
||||||
die if $pkg->{checksum}->{type} ne "sha";
|
die if $pkg->{checksum}->{type} ne "sha";
|
||||||
print " (fetchurl {\n";
|
print " (fetchurl {\n";
|
||||||
print " url = $urlPrefix/$pkg->{location}->{href};\n";
|
print " url = $urlPrefix/$pkg->{location}->{href};\n";
|
||||||
|
|
Loading…
Reference in New Issue