* Put all the RPM/Debian images in an attribute set `diskImage'.

svn path=/nixpkgs/trunk/; revision=11181
This commit is contained in:
Eelco Dolstra 2008-03-18 12:54:21 +00:00
parent 113fafd778
commit fd2a77eeb0
13 changed files with 72 additions and 91 deletions

View file

@ -210,7 +210,7 @@ rec {
qemu-img create -f qcow $diskImage "${toString size}M"
mkdir $out/nix-support
echo ${fullName} > $out/nix-support/full-name
echo "${fullName}" > $out/nix-support/full-name
'';
@ -368,18 +368,28 @@ rec {
'';
buildPhase = ''
eval "$preBuild"
# Hacky: RPM looks for <basename>.spec inside the tarball, so
# strip off the hash.
stripHash "$src"
srcName="$strippedName"
ln -s "$src" "$srcName"
cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
rpmbuild -vv -ta "$srcName"
rpmbuild -vv -ta "$srcName" || fail
eval "$postBuild"
'';
installPhase = ''
ensureDir $out/rpms
find /usr/src -name "*.rpm" -exec cp {} $out/rpms \;
for i in $out/rpms/*.rpm; do
header "Generated RPM/SRPM: $i"
rpm -qip $i
stopNest
done
'';
}));
@ -462,4 +472,59 @@ rec {
});
/* A bunch of disk images. */
diskImages = {
redhat9i386 = fillDiskWithRPMs {
name = "redhat-9-i386-image";
fullName = "Red Hat Linux 9 (i386)";
size = 768;
rpms = import ./rpm/redhat-9-i386.nix {inherit fetchurl;};
};
suse90i386 = fillDiskWithRPMs {
name = "suse-9.0-i386-image";
fullName = "SUSE Linux 9.0 (i386)";
size = 768;
rpms = import ./rpm/suse-9-i386.nix {inherit fetchurl;};
};
fedora2i386 = fillDiskWithRPMs {
name = "fedora-core-2-i386-image";
fullName = "Fedora Core 2 (i386)";
size = 768;
rpms = import ./rpm/fedora-2-i386.nix {inherit fetchurl;};
};
fedora3i386 = fillDiskWithRPMs {
name = "fedora-core-3-i386-image";
fullName = "Fedora Core 3 (i386)";
size = 768;
rpms = import ./rpm/fedora-3-i386.nix {inherit fetchurl;};
};
fedora5i386 = fillDiskWithRPMs {
name = "fedora-core-5-i386-image";
fullName = "Fedora Core 5 (i386)";
size = 768;
rpms = import ./rpm/fedora-5-i386.nix {inherit fetchurl;};
};
ubuntu710i386 = fillDiskWithDebs {
name = "ubuntu-7.10-gutsy-i386-image";
fullName = "Ubuntu 7.10 Gutsy (i386)";
size = 512;
debs = import ./deb/ubuntu-7.10-gutsy-i386.nix {inherit fetchurl;};
};
debian40r3i386 = fillDiskWithDebs {
name = "debian-4.0r3-etch-i386-image";
fullName = "Debian 4.0r3 Etch (i386)";
size = 512;
debs = import ./deb/debian-4.0r3-etch-i386.nix {inherit fetchurl;};
};
};
}

View file

@ -1,60 +0,0 @@
pkgs:
rec {
stdenv = pkgs.stdenv;
fillDiskWithRPMs = {size ? 1024, rpms, name, fullName, postInstall ? null}:
stdenv.mkDerivation {
builder = ./fill-disk-with-rpms.sh;
worker = ./fill-disk-worker.sh;
buildInputs = [pkgs.uml pkgs.utillinux];
inherit (pkgs) sysvinit e2fsprogs rpm;
inherit rpms size name fullName postInstall;
};
runInUML = args: stdenv.mkDerivation (args // {
inherit (args) name image;
builder = ./run-in-uml.sh;
actualBuilder = args.builder;
boot = ./run-in-uml-boot.sh;
buildInputs = [pkgs.uml pkgs.utillinux];
inherit (pkgs) sysvinit utillinux;
});
redhat90Image = fillDiskWithRPMs {
rpms = (import ./redhat-9-packages.nix) {inherit (pkgs) fetchurl;};
name = "redhat-9.0";
fullName = "Red Hat 9.0";
postInstall = ./redhat-postinstall.sh;
};
suse90Image = fillDiskWithRPMs {
rpms = (import ./suse-9-packages.nix) {inherit (pkgs) fetchurl;};
name = "suse-9.0";
fullName = "SuSE 9.0";
};
fedora2Image = fillDiskWithRPMs {
rpms = (import ./fedora-2-packages.nix) {inherit (pkgs) fetchurl;};
name = "fedora-core-2";
fullName = "Fedora Core 2";
postInstall = ./fedora-postinstall.sh;
};
fedora3Image = fillDiskWithRPMs {
rpms = (import ./fedora-3-packages.nix) {inherit (pkgs) fetchurl;};
name = "fedora-core-3";
fullName = "Fedora Core 3";
postInstall = ./fedora-postinstall.sh;
};
fedora5Image = fillDiskWithRPMs {
rpms = (import ./fedora-5-packages.nix) {inherit (pkgs) fetchurl;};
name = "fedora-core-5";
fullName = "Fedora Core 5";
};
}

View file

@ -8,47 +8,23 @@ rec {
buildPatchelfInVM = runInLinuxVM patchelf;
rpmImage = fillDiskWithRPMs {
name = "fedora-image";
fullName = "Fedora Core 3";
size = 1024;
rpms = import ./rpm/fedora-3-packages.nix {inherit fetchurl;};
};
testRPMImage = makeImageTestScript rpmImage;
testRPMImage = makeImageTestScript diskImages.fedora5i386;
buildPatchelfRPM = buildRPM {
name = "patchelf-rpm";
src = patchelf.src;
diskImage = rpmImage;
diskImage = diskImages.fedora5i386;
};
ubuntuImage = fillDiskWithDebs {
name = "ubuntu-image";
fullName = "Ubuntu 7.10 Gutsy";
size = 256;
debs = import ./deb/ubuntu-7.10-gutsy-i386.nix {inherit fetchurl;};
};
debianImage = fillDiskWithDebs {
name = "debian-image";
fullName = "Debian 4.0r3 Etch";
size = 256;
debs = import ./deb/debian-4.0r3-etch-i386.nix {inherit fetchurl;};
};
testUbuntuImage = makeImageTestScript ubuntuImage;
testUbuntuImage = makeImageTestScript diskImages.ubuntu710i386;
buildInDebian = runInLinuxImage (stdenv.mkDerivation {
name = "deb-compile";
src = nixUnstable.src;
diskImage = debianImage;
diskImage = diskImages.debian40r3i386;
memSize = 512;
phases = "sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase fixupPhase distPhase";
sysInfoPhase = ''