From cc07ee1c77dd8324c11abda6abd576abd07c6788 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Mar 2008 14:56:47 +0000 Subject: [PATCH] * Install RPMs without the --notriggers and --nodeps options in order to construct an image that better approximates the Linux distribution in question. svn path=/nixpkgs/trunk/; revision=11184 --- pkgs/build-support/vm/default.nix | 48 ++++++++++++++------ pkgs/build-support/vm/rpm/rpm-list-to-nix.pl | 8 +++- pkgs/build-support/vm/rpm/suse-9-i386.list | 15 ++++-- pkgs/build-support/vm/rpm/suse-9-i386.nix | 15 ++++-- pkgs/build-support/vm/test.nix | 2 +- 5 files changed, 64 insertions(+), 24 deletions(-) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index efc76c2cf49e..36344101b716 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -295,10 +295,10 @@ rec { a set of RPM packages. */ fillDiskWithRPMs = - {size ? 1024, rpms, name, fullName, postInstall ? null}: + {size ? 1024, rpms, name, fullName, preInstall ? "", postInstall ? ""}: runInLinuxVM (stdenv.mkDerivation { - inherit name postInstall rpms; + inherit name preInstall postInstall rpms; preVM = createEmptyImage {inherit size fullName;}; @@ -309,24 +309,29 @@ rec { rpm="${rpm}/bin/rpm --root /mnt --dbpath /var/lib/rpm" $rpm --initdb + echo "unpacking RPMs..." + for i in $rpms; do + echo "$i..." + ${rpm}/bin/rpm2cpio "$i" | (cd /mnt && ${cpio}/bin/cpio -i --make-directories) + done + + eval "$preInstall" + + # Make the Nix store available in /mnt, because that's where the RPMs live. + mkdir -p /mnt/nix/store + ${klibcShrunk}/bin/mount -o bind /nix/store /mnt/nix/store + echo "installing RPMs..." - $rpm --noscripts --notriggers --nodeps -iv $rpms - - # Get rid of the Berkeley DB environment so that older RPM versions - # (using older versions of BDB) will still work. - rm -f /mnt/var/lib/rpm/__db.* - - if test -e /mnt/bin/rpm; then - chroot /mnt /bin/rpm --rebuilddb - fi - - chroot /mnt /sbin/ldconfig + chroot=$(type -tP chroot) + PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \ + rpm -iv $rpms echo "running post-install script..." eval "$postInstall" rm /mnt/.debug + ${klibcShrunk}/bin/umount /mnt/nix/store ${klibcShrunk}/bin/umount /mnt ''; }); @@ -350,6 +355,7 @@ rec { export origBuilder= export origArgs= export > $TMPDIR/saved-env + mountDisk=1 ${qemuCommand} ''; @@ -369,6 +375,9 @@ rec { buildPhase = '' eval "$preBuild" + + #echo "root:x:0:0:System administrator:/root:/bin/sh" >> /etc/passwd + #echo "root:!:0:" >> /etc/group # Hacky: RPM looks for .spec inside the tarball, so # strip off the hash. @@ -488,6 +497,19 @@ rec { fullName = "SUSE Linux 9.0 (i386)"; size = 768; rpms = import ./rpm/suse-9-i386.nix {inherit fetchurl;}; + # Urgh. The /etc/group entries are installed by aaa_base (or + # something) but due to dependency ordering, that package isn't + # installed yet by the time some other packages refer to these + # entries. + preInstall = '' + echo 'bin:x:1:daemon' >> /mnt/etc/group + echo 'tty:x:5:' >> /mnt/etc/group + echo 'disk:x:6:' >> /mnt/etc/group + echo 'lp:x:7:' >> /mnt/etc/group + echo 'uucp:x:14:' >> /mnt/etc/group + echo 'audio:x:17:' >> /mnt/etc/group + echo 'video:x:33:' >> /mnt/etc/group + ''; }; fedora2i386 = fillDiskWithRPMs { diff --git a/pkgs/build-support/vm/rpm/rpm-list-to-nix.pl b/pkgs/build-support/vm/rpm/rpm-list-to-nix.pl index c625cce2fd9e..bd0e32ac97e8 100755 --- a/pkgs/build-support/vm/rpm/rpm-list-to-nix.pl +++ b/pkgs/build-support/vm/rpm/rpm-list-to-nix.pl @@ -20,7 +20,7 @@ while () { print NEW "baseURL $baseURL\n"; } - elsif (/^\s*(\S+)(\s+([a-f0-9]+))?\s*$/) { + elsif (/^\s*(\S+)(\s+([a-z0-9]+))?\s*$/) { my $pkgName = $1; my $url = "$baseURL/$pkgName"; my $hash = $3; @@ -30,7 +30,11 @@ while () { chomp $hash; } print NEW "$pkgName $hash\n"; - print EXPR " (fetchurl {url=$url; md5=\"$hash\";})\n"; + if (length $hash == 32) { + print EXPR " (fetchurl {url=$url; md5=\"$hash\";})\n"; + } else { + print EXPR " (fetchurl {url=$url; sha256=\"$hash\";})\n"; + } } else { diff --git a/pkgs/build-support/vm/rpm/suse-9-i386.list b/pkgs/build-support/vm/rpm/suse-9-i386.list index edd42986ad97..9e3dbdae2397 100644 --- a/pkgs/build-support/vm/rpm/suse-9-i386.list +++ b/pkgs/build-support/vm/rpm/suse-9-i386.list @@ -1,4 +1,13 @@ baseURL ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586 +glibc-2.3.2-92.i586.rpm d5396400c92d4085e536b708ddce265c +zlib-1.1.4-232.i586.rpm ba1a8342757071dfd7e52a2c69c86584 +readline-4.3-212.i586.rpm c18b059909f3debca772a8f5b7d3aee7 +ncurses-5.3-115.i586.rpm 48c4f77acdbf2ef9aee807466d0fec88 +aaa_base-9.0-7.i586.rpm 1xj9k6b3s0zrdac52q1mw6l7ms55nzmdkfda1s1jbz9laijijppn +aaa_skel-2003.9.18-8.i586.rpm 1cp9kyg8ksqk0hixdkzd454jhymqdpln9x2y2izdifzsc9wzbsz3 +sysconfig-0.23.30-39.i586.rpm 1dmn95b9yb7rcbgxscw7nspjrdw67v4gdn7kmy5pqq3jxnpmhzi8 +permissions-2003.9.18-8.i586.rpm 0z0n89jh63lqsa0sg6z7f7mn1n6bh1qnxd1h9s5ypmpkazfdhhib +ash-0.2-804.i586.rpm 01m2nl5jmy206va26fx7w3p9zvmmvd5jkng19vjdw556a74h9saz autoconf-2.57-142.i586.rpm 1e360a37d4db4c87e07d15c88f0c12e2 automake-1.7.6-44.i586.rpm 2c7f1335e73751008f594a68eb515290 bash-2.05b-212.i586.rpm 1a0fd51a36144dbe89c16553a71899e0 @@ -25,11 +34,11 @@ gcc-3.3.1-29.i586.rpm e32b4b631483ab5d22a12900e070890b gcc-c++-3.3.1-29.i586.rpm 7e6ee0a475b23bbf1c0e57087f682e43 gdbm-1.8.3-124.i586.rpm 414fc63a785ee589e40908763b7fb18d glib-1.2.10-488.i586.rpm 018f711f294f1a54f9a5b625748f7b22 -glibc-2.3.2-92.i586.rpm d5396400c92d4085e536b708ddce265c glibc-devel-2.3.2-92.i586.rpm 705d90c6a8a7b7eaab8632c343d4e173 glibc-i18ndata-2.3.2-92.i586.rpm fc719866325ef22c27ac07e366f8b854 glibc-locale-2.3.2-92.i586.rpm 657164f38227450e5b0bde2892804f21 gnome-filesystem-0.1-80.i586.rpm f42a958db0291f04af16a7ab50efedca +gpm-1.20.1-204.i586.rpm 1mmrydfwl8ivlqhxx9l99w9f6vs0f7gnpc3r7j6qfcszm8ql77w6 gpg-1.2.2-88.i586.rpm 5734134e5b699eacc227672bcb7fdb62 grep-2.5.1-302.i586.rpm 553eea58a317a068b2bdbd279066f023 gzip-1.3.5-51.i586.rpm 011ad84c3d935647e639bba34f9c9726 @@ -49,11 +58,11 @@ libstdc++-devel-3.3.1-29.i586.rpm bb69c86478476fee2fd327a54b5790c9 libtiff-3.5.7-307.i586.rpm 53152a337d2f540f1b7a61e6b11ae41f libtool-1.5-85.i586.rpm dfc1992dc92bef0bcdef7273d2cd70fb libxcrypt-2.0-36.i586.rpm 022c44bdfb02c926ad6499506f9e8525 +logrotate-3.6.6-95.i586.rpm 0i8pj3rdnxf4ig1zghsbi63s3ss0mvnv4mvyjjxcnilnmg6qjnqj m4-1.4o-512.i586.rpm 141d24f90c907841a8a24ceb8e6cb94d make-3.80-101.i586.rpm 4f358bda24d2cefc78c3c744d2bd01da mktemp-1.5-637.i586.rpm 3f444e864a5b167472192de89957f47a modutils-2.4.25-56.i586.rpm 2d64e9b80a10f945e58a5a70e8859fc9 -ncurses-5.3-115.i586.rpm 48c4f77acdbf2ef9aee807466d0fec88 ncurses-devel-5.3-115.i586.rpm 747d41d77cfacc3ea3874a6ddebc1862 net-tools-1.60-448.i586.rpm e92f3a22f4595e97e72d8a6ac2e19959 openssl-0.9.7b-74.i586.rpm 18e0fa1e8168217f6dea90c1954b5a50 @@ -65,7 +74,6 @@ perl-5.8.1-51.i586.rpm 24c046fc2d03464f61c26c014b715bf2 perl-Filter-1.29-100.i586.rpm 7674bae9c1a7890a8553854b4933bc50 pkgconfig-0.15.0-108.i586.rpm 31db551f2fcc901a25da746110584e2d popt-1.7-76.i586.rpm 66f310eee498958f83e223845b776746 -readline-4.3-212.i586.rpm c18b059909f3debca772a8f5b7d3aee7 readline-devel-4.3-212.i586.rpm c9d0c8cd5ea825beb997c70b6ea95101 rpm-4.1.1-77.i586.rpm 341f5dfdc85070d91da5fb2774d8c886 sed-4.0.6-73.i586.rpm c95e7a25899d4d927785cb9cb165fca1 @@ -77,7 +85,6 @@ termcap-2.0.8-781.i586.rpm 755c8d17157be28822a940689ab3c1c7 unzip-5.50-250.i586.rpm 423d68022a4e5e78aa2a88c1642471a7 util-linux-2.11z-95.i586.rpm 2174767b2e2e6e4e3cdd8fc569dc3c6e XFree86-libs-4.3.0.1-29.i586.rpm 77b0e1d5974703b3fc6621d862b4b038 -zlib-1.1.4-232.i586.rpm ba1a8342757071dfd7e52a2c69c86584 zlib-devel-1.1.4-232.i586.rpm 7c60d8432793517236f64b0f79d7f20f baseURL ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/noarch suse-build-key-1.0-472.noarch.rpm 8e34a1af09d66b66ea353685f4a84dfc diff --git a/pkgs/build-support/vm/rpm/suse-9-i386.nix b/pkgs/build-support/vm/rpm/suse-9-i386.nix index 08463684e8b2..eef815673d5d 100644 --- a/pkgs/build-support/vm/rpm/suse-9-i386.nix +++ b/pkgs/build-support/vm/rpm/suse-9-i386.nix @@ -1,4 +1,13 @@ {fetchurl}: [ + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glibc-2.3.2-92.i586.rpm; md5="d5396400c92d4085e536b708ddce265c";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/zlib-1.1.4-232.i586.rpm; md5="ba1a8342757071dfd7e52a2c69c86584";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/readline-4.3-212.i586.rpm; md5="c18b059909f3debca772a8f5b7d3aee7";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/ncurses-5.3-115.i586.rpm; md5="48c4f77acdbf2ef9aee807466d0fec88";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/aaa_base-9.0-7.i586.rpm; sha256="1xj9k6b3s0zrdac52q1mw6l7ms55nzmdkfda1s1jbz9laijijppn";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/aaa_skel-2003.9.18-8.i586.rpm; sha256="1cp9kyg8ksqk0hixdkzd454jhymqdpln9x2y2izdifzsc9wzbsz3";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/sysconfig-0.23.30-39.i586.rpm; sha256="1dmn95b9yb7rcbgxscw7nspjrdw67v4gdn7kmy5pqq3jxnpmhzi8";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/permissions-2003.9.18-8.i586.rpm; sha256="0z0n89jh63lqsa0sg6z7f7mn1n6bh1qnxd1h9s5ypmpkazfdhhib";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/ash-0.2-804.i586.rpm; sha256="01m2nl5jmy206va26fx7w3p9zvmmvd5jkng19vjdw556a74h9saz";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/autoconf-2.57-142.i586.rpm; md5="1e360a37d4db4c87e07d15c88f0c12e2";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/automake-1.7.6-44.i586.rpm; md5="2c7f1335e73751008f594a68eb515290";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/bash-2.05b-212.i586.rpm; md5="1a0fd51a36144dbe89c16553a71899e0";}) @@ -25,11 +34,11 @@ (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gcc-c++-3.3.1-29.i586.rpm; md5="7e6ee0a475b23bbf1c0e57087f682e43";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gdbm-1.8.3-124.i586.rpm; md5="414fc63a785ee589e40908763b7fb18d";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glib-1.2.10-488.i586.rpm; md5="018f711f294f1a54f9a5b625748f7b22";}) - (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glibc-2.3.2-92.i586.rpm; md5="d5396400c92d4085e536b708ddce265c";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glibc-devel-2.3.2-92.i586.rpm; md5="705d90c6a8a7b7eaab8632c343d4e173";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glibc-i18ndata-2.3.2-92.i586.rpm; md5="fc719866325ef22c27ac07e366f8b854";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/glibc-locale-2.3.2-92.i586.rpm; md5="657164f38227450e5b0bde2892804f21";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gnome-filesystem-0.1-80.i586.rpm; md5="f42a958db0291f04af16a7ab50efedca";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gpm-1.20.1-204.i586.rpm; sha256="1mmrydfwl8ivlqhxx9l99w9f6vs0f7gnpc3r7j6qfcszm8ql77w6";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gpg-1.2.2-88.i586.rpm; md5="5734134e5b699eacc227672bcb7fdb62";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/grep-2.5.1-302.i586.rpm; md5="553eea58a317a068b2bdbd279066f023";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/gzip-1.3.5-51.i586.rpm; md5="011ad84c3d935647e639bba34f9c9726";}) @@ -49,11 +58,11 @@ (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/libtiff-3.5.7-307.i586.rpm; md5="53152a337d2f540f1b7a61e6b11ae41f";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/libtool-1.5-85.i586.rpm; md5="dfc1992dc92bef0bcdef7273d2cd70fb";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/libxcrypt-2.0-36.i586.rpm; md5="022c44bdfb02c926ad6499506f9e8525";}) + (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/logrotate-3.6.6-95.i586.rpm; sha256="0i8pj3rdnxf4ig1zghsbi63s3ss0mvnv4mvyjjxcnilnmg6qjnqj";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/m4-1.4o-512.i586.rpm; md5="141d24f90c907841a8a24ceb8e6cb94d";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/make-3.80-101.i586.rpm; md5="4f358bda24d2cefc78c3c744d2bd01da";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/mktemp-1.5-637.i586.rpm; md5="3f444e864a5b167472192de89957f47a";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/modutils-2.4.25-56.i586.rpm; md5="2d64e9b80a10f945e58a5a70e8859fc9";}) - (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/ncurses-5.3-115.i586.rpm; md5="48c4f77acdbf2ef9aee807466d0fec88";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/ncurses-devel-5.3-115.i586.rpm; md5="747d41d77cfacc3ea3874a6ddebc1862";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/net-tools-1.60-448.i586.rpm; md5="e92f3a22f4595e97e72d8a6ac2e19959";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/openssl-0.9.7b-74.i586.rpm; md5="18e0fa1e8168217f6dea90c1954b5a50";}) @@ -65,7 +74,6 @@ (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/perl-Filter-1.29-100.i586.rpm; md5="7674bae9c1a7890a8553854b4933bc50";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/pkgconfig-0.15.0-108.i586.rpm; md5="31db551f2fcc901a25da746110584e2d";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/popt-1.7-76.i586.rpm; md5="66f310eee498958f83e223845b776746";}) - (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/readline-4.3-212.i586.rpm; md5="c18b059909f3debca772a8f5b7d3aee7";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/readline-devel-4.3-212.i586.rpm; md5="c9d0c8cd5ea825beb997c70b6ea95101";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/rpm-4.1.1-77.i586.rpm; md5="341f5dfdc85070d91da5fb2774d8c886";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/sed-4.0.6-73.i586.rpm; md5="c95e7a25899d4d927785cb9cb165fca1";}) @@ -77,7 +85,6 @@ (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/unzip-5.50-250.i586.rpm; md5="423d68022a4e5e78aa2a88c1642471a7";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/util-linux-2.11z-95.i586.rpm; md5="2174767b2e2e6e4e3cdd8fc569dc3c6e";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/XFree86-libs-4.3.0.1-29.i586.rpm; md5="77b0e1d5974703b3fc6621d862b4b038";}) - (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/zlib-1.1.4-232.i586.rpm; md5="ba1a8342757071dfd7e52a2c69c86584";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/i586/zlib-devel-1.1.4-232.i586.rpm; md5="7c60d8432793517236f64b0f79d7f20f";}) (fetchurl {url=ftp://ftp.gwdg.de/pub/linux/suse/discontinued/i386/9.0/suse/noarch/suse-build-key-1.0-472.noarch.rpm; md5="8e34a1af09d66b66ea353685f4a84dfc";}) ] diff --git a/pkgs/build-support/vm/test.nix b/pkgs/build-support/vm/test.nix index bef100625a7f..5ee816d799aa 100644 --- a/pkgs/build-support/vm/test.nix +++ b/pkgs/build-support/vm/test.nix @@ -8,7 +8,7 @@ rec { buildPatchelfInVM = runInLinuxVM patchelf; - testRPMImage = makeImageTestScript diskImages.fedora5i386; + testRPMImage = makeImageTestScript diskImages.suse90i386; buildPatchelfRPM = buildRPM {