diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 7d334f045409..efc76c2cf49e 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -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 .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;}; + }; + + }; + } diff --git a/pkgs/build-support/vm/rpm/fedora-2-packages.list b/pkgs/build-support/vm/rpm/fedora-2-i386.list similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-2-packages.list rename to pkgs/build-support/vm/rpm/fedora-2-i386.list diff --git a/pkgs/build-support/vm/rpm/fedora-2-packages.nix b/pkgs/build-support/vm/rpm/fedora-2-i386.nix similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-2-packages.nix rename to pkgs/build-support/vm/rpm/fedora-2-i386.nix diff --git a/pkgs/build-support/vm/rpm/fedora-3-packages.list b/pkgs/build-support/vm/rpm/fedora-3-i386.list similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-3-packages.list rename to pkgs/build-support/vm/rpm/fedora-3-i386.list diff --git a/pkgs/build-support/vm/rpm/fedora-3-packages.nix b/pkgs/build-support/vm/rpm/fedora-3-i386.nix similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-3-packages.nix rename to pkgs/build-support/vm/rpm/fedora-3-i386.nix diff --git a/pkgs/build-support/vm/rpm/fedora-5-packages.list b/pkgs/build-support/vm/rpm/fedora-5-i386.list similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-5-packages.list rename to pkgs/build-support/vm/rpm/fedora-5-i386.list diff --git a/pkgs/build-support/vm/rpm/fedora-5-packages.nix b/pkgs/build-support/vm/rpm/fedora-5-i386.nix similarity index 100% rename from pkgs/build-support/vm/rpm/fedora-5-packages.nix rename to pkgs/build-support/vm/rpm/fedora-5-i386.nix diff --git a/pkgs/build-support/vm/rpm/redhat-9-packages.list b/pkgs/build-support/vm/rpm/redhat-9-i386.list similarity index 100% rename from pkgs/build-support/vm/rpm/redhat-9-packages.list rename to pkgs/build-support/vm/rpm/redhat-9-i386.list diff --git a/pkgs/build-support/vm/rpm/redhat-9-packages.nix b/pkgs/build-support/vm/rpm/redhat-9-i386.nix similarity index 100% rename from pkgs/build-support/vm/rpm/redhat-9-packages.nix rename to pkgs/build-support/vm/rpm/redhat-9-i386.nix diff --git a/pkgs/build-support/vm/rpm/rpm.nix b/pkgs/build-support/vm/rpm/rpm.nix deleted file mode 100644 index 624e3b387a5f..000000000000 --- a/pkgs/build-support/vm/rpm/rpm.nix +++ /dev/null @@ -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"; - }; -} diff --git a/pkgs/build-support/vm/rpm/suse-9-packages.list b/pkgs/build-support/vm/rpm/suse-9-i386.list similarity index 100% rename from pkgs/build-support/vm/rpm/suse-9-packages.list rename to pkgs/build-support/vm/rpm/suse-9-i386.list diff --git a/pkgs/build-support/vm/rpm/suse-9-packages.nix b/pkgs/build-support/vm/rpm/suse-9-i386.nix similarity index 100% rename from pkgs/build-support/vm/rpm/suse-9-packages.nix rename to pkgs/build-support/vm/rpm/suse-9-i386.nix diff --git a/pkgs/build-support/vm/test.nix b/pkgs/build-support/vm/test.nix index 6c25667a222b..bef100625a7f 100644 --- a/pkgs/build-support/vm/test.nix +++ b/pkgs/build-support/vm/test.nix @@ -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 = ''