From 249e4176778cf2bb39b92c2e84f387b73d0d0c9d Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 21 Oct 2014 18:29:55 +0200 Subject: [PATCH 01/12] btrfsprogs: Update to new upstream version 3.17. Signed-off-by: aszlig --- pkgs/tools/filesystems/btrfsprogs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/filesystems/btrfsprogs/default.nix b/pkgs/tools/filesystems/btrfsprogs/default.nix index 21906889692..e7c38db9f8a 100644 --- a/pkgs/tools/filesystems/btrfsprogs/default.nix +++ b/pkgs/tools/filesystems/btrfsprogs/default.nix @@ -1,14 +1,14 @@ { stdenv, fetchurl, attr, acl, zlib, libuuid, e2fsprogs, lzo , asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt }: -let version = "3.16.2"; in +let version = "3.17"; in stdenv.mkDerivation rec { name = "btrfs-progs-${version}"; src = fetchurl { url = "mirror://kernel/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v${version}.tar.xz"; - sha256 = "0avk8x0k91zrqvlbk8r067aw49byr8hvvr4niy48d3ib1jz2mmnl"; + sha256 = "187hdfh10hrabvldqmhg88wdv0s9r7hc5264v83ykir9wxqvzbzc"; }; buildInputs = [ From 369a5c6180b513c272e12e4bb5eaf8bb5f50c9e9 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 21 Oct 2014 18:32:10 +0200 Subject: [PATCH 02/12] python-six: Update to new upstream version 1.8.0. Signed-off-by: aszlig --- pkgs/top-level/python-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 701e29d437f..cbdbf9b3efe 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8479,11 +8479,11 @@ let six = buildPythonPackage rec { - name = "six-1.7.3"; + name = "six-1.8.0"; src = pkgs.fetchurl { url = "http://pypi.python.org/packages/source/s/six/${name}.tar.gz"; - md5 = "784c6e5541c3c4952de9c0a966a0a80b"; + md5 = "1626eb24cc889110c38f7e786ec69885"; }; # error: invalid command 'test' From 6553845afcfdb2adbd02a86fbd95e6b40c2b7063 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:21:02 +0200 Subject: [PATCH 03/12] pyparted: Add patch to fix tests for parted 3.2. See this message for the patch and details: https://www.redhat.com/archives/pyparted-devel/2014-April/msg00000.html Signed-off-by: aszlig --- pkgs/top-level/python-packages.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cbdbf9b3efe..2629945d26b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6856,6 +6856,17 @@ let sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv"; }; + patches = singleton (pkgs.fetchurl { + url = "https://www.redhat.com/archives/pyparted-devel/" + + "2014-April/msg00000.html"; + postFetch = '' + sed -i -ne '//,// { + s/^<[^>]*>//; /^$/!p + }' "$downloadedFile" + ''; + sha256 = "1lakhz3nvx0qacn90bj1nq13zqxphiw4d9dsc44gwa8nj24j2zws"; + }); + postPatch = '' sed -i -e 's|/sbin/mke2fs|${pkgs.e2fsprogs}&|' tests/baseclass.py sed -i -e ' From 34ae3b7f77ef389574602e86bea6f6e434ab9d1b Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:17:26 +0200 Subject: [PATCH 04/12] parted: Update to new upstream version 3.2. In order to properly run tests, we need to fix the unicode tests and after some search, I have found that Ludo (who is also the maintainer of parted) already reported this upstream and also provided a solution: http://lists.gnu.org/archive/html/bug-parted/2014-08/msg00003.html I'm updating parted to 3.2, because the latest blivet implementation relies on it for device geometry calculations. Signed-off-by: aszlig --- pkgs/tools/misc/parted/default.nix | 14 +++++-- .../misc/parted/gpt-unicode-test-fix.patch | 38 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 pkgs/tools/misc/parted/gpt-unicode-test-fix.patch diff --git a/pkgs/tools/misc/parted/default.nix b/pkgs/tools/misc/parted/default.nix index 01b9f391a44..0763532260a 100644 --- a/pkgs/tools/misc/parted/default.nix +++ b/pkgs/tools/misc/parted/default.nix @@ -1,20 +1,26 @@ -{ stdenv, fetchurl, devicemapper, libuuid, gettext, readline +{ stdenv, fetchurl, devicemapper, libuuid, gettext, readline, perl, python , utillinux, check, enableStatic ? false, hurd ? null }: stdenv.mkDerivation rec { - name = "parted-3.1"; + name = "parted-3.2"; src = fetchurl { url = "mirror://gnu/parted/${name}.tar.xz"; - sha256 = "05fa4m1bky9d13hqv91jlnngzlyn7y4rnnyq6d86w0dg3vww372y"; + sha256 = "1r3qpg3bhz37mgvp9chsaa3k0csby3vayfvz8ggsqz194af5i2w5"; }; + patches = stdenv.lib.optional doCheck ./gpt-unicode-test-fix.patch; + + postPatch = stdenv.lib.optionalString doCheck '' + patchShebangs tests + ''; + buildInputs = [ libuuid ] ++ stdenv.lib.optional (readline != null) readline ++ stdenv.lib.optional (gettext != null) gettext ++ stdenv.lib.optional (devicemapper != null) devicemapper ++ stdenv.lib.optional (hurd != null) hurd - ++ stdenv.lib.optional doCheck check; + ++ stdenv.lib.optionals doCheck [ check perl python ]; configureFlags = (if (readline != null) diff --git a/pkgs/tools/misc/parted/gpt-unicode-test-fix.patch b/pkgs/tools/misc/parted/gpt-unicode-test-fix.patch new file mode 100644 index 00000000000..470188bf55e --- /dev/null +++ b/pkgs/tools/misc/parted/gpt-unicode-test-fix.patch @@ -0,0 +1,38 @@ +From Ludo's suggestion at: + + http://debbugs.gnu.org/cgi/bugreport.cgi?msg=8;bug=18258 + +diff --git a/tests/.t0251-gpt-unicode.sh.swp b/tests/.t0251-gpt-unicode.sh.swp +deleted file mode 100644 +index b41c337..0000000 +Binary files a/tests/.t0251-gpt-unicode.sh.swp and /dev/null differ +diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh +index c845950..fa63a72 100755 +--- a/tests/t0251-gpt-unicode.sh ++++ b/tests/t0251-gpt-unicode.sh +@@ -22,7 +22,24 @@ dev=loop-file + # create zeroed device + truncate -s 10m $dev || fail=1 + +-export LC_ALL=C.UTF-8 ++found_locale=no ++for locale in en_US de_DE fr_FR es_ES ++do ++ LC_ALL="$locale.UTF-8" ++ export LC_ALL ++ ++ # In a UTF-8 locale, the string below prints as 4 characters. ++ if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then ++ found_locale=yes ++ break ++ fi ++done ++ ++if [ "$found_locale" != "yes" ]; then ++ echo "no valid UTF-8 locale found; skipping" >&2 ++ exit 77 ++fi ++ + # create gpt label with named partition + part_name=$(printf 'foo\341\264\244') + parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1 From 7deadbb55f327dd9fffd397c72e13e4b95e15c61 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:29:18 +0200 Subject: [PATCH 05/12] nixpart: Copy package expression to 0.4.nix. Update the nixpart0 pointer to point to this version, because we're going to update blivet as well and NixOps still points to nixpart0. Signed-off-by: aszlig --- pkgs/tools/filesystems/nixpart/0.4.nix | 29 ++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 pkgs/tools/filesystems/nixpart/0.4.nix diff --git a/pkgs/tools/filesystems/nixpart/0.4.nix b/pkgs/tools/filesystems/nixpart/0.4.nix new file mode 100644 index 00000000000..633f04320c3 --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, buildPythonPackage, blivet +# Propagated to blivet +, useNixUdev ? null, udevSoMajor ? null +}: + +let + blivetOverrides = stdenv.lib.filterAttrs (k: v: v != null) { + inherit useNixUdev udevSoMajor; + }; +in buildPythonPackage rec { + name = "nixpart-${version}"; + version = "0.4.1"; + + src = fetchurl { + url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz"; + sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp"; + }; + + propagatedBuildInputs = [ (blivet.override blivetOverrides) ]; + + doCheck = false; + + meta = { + description = "NixOS storage manager/partitioner"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2629945d26b..acaad0804ea 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -123,7 +123,7 @@ let # This is used for NixOps to make sure we won't break it with the next major # version of nixpart. - nixpart0 = self.nixpart; + nixpart0 = callPackage ../tools/filesystems/nixpart/0.4.nix { }; pitz = callPackage ../applications/misc/pitz { }; From cb2c34f1bb8245a4460cef9f82301a76ab60441c Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:37:32 +0200 Subject: [PATCH 06/12] blivet: Update to new upstream version 0.67. Put a copy of old version 0.17 expression into 0.17.nix and update the pointers from nixpart0 accordingly. This also means, that plain nixpart is now way more broken than nixpart0 (we might want to temporarily fix 0.4 anyway). Signed-off-by: aszlig --- nixos/tests/partition.nix | 2 +- .../python-modules/blivet/0.17.nix | 58 +++++++++++++++++++ .../python-modules/blivet/default.nix | 46 ++++++--------- pkgs/tools/filesystems/nixpart/default.nix | 13 +---- pkgs/top-level/python-packages.nix | 6 +- 5 files changed, 85 insertions(+), 40 deletions(-) create mode 100644 pkgs/development/python-modules/blivet/0.17.nix diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix index 72fd37e041e..afe6b8d4a0d 100644 --- a/nixos/tests/partition.nix +++ b/nixos/tests/partition.nix @@ -67,7 +67,7 @@ in { machine = { config, pkgs, ... }: { environment.systemPackages = [ - pkgs.pythonPackages.nixpart + pkgs.pythonPackages.nixpart0 pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2 ]; virtualisation.emptyDiskImages = [ 4096 4096 ]; diff --git a/pkgs/development/python-modules/blivet/0.17.nix b/pkgs/development/python-modules/blivet/0.17.nix new file mode 100644 index 00000000000..c1b36bf909d --- /dev/null +++ b/pkgs/development/python-modules/blivet/0.17.nix @@ -0,0 +1,58 @@ +{ stdenv, fetchurl, buildPythonPackage, pykickstart, pyparted, pyblock +, libselinux, cryptsetup, multipath_tools, lsof, utillinux +, useNixUdev ? true, udev ? null +# This is only used when useNixUdev is false +, udevSoMajor ? 1 +}: + +assert useNixUdev -> udev != null; + +let + pyenable = { enablePython = true; }; + selinuxWithPython = libselinux.override pyenable; + cryptsetupWithPython = cryptsetup.override pyenable; +in buildPythonPackage rec { + name = "blivet-${version}"; + version = "0.17-1"; + + src = fetchurl { + url = "https://git.fedorahosted.org/cgit/blivet.git/snapshot/" + + "${name}.tar.bz2"; + sha256 = "1k3mws2q0ryb7422mml6idmaasz2i2v6ngyvg6d976dx090qnmci"; + }; + + postPatch = '' + sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \ + blivet/devicelibs/mpath.py blivet/devices.py + sed -i -e '/"wipefs"/ { + s|wipefs|${utillinux}/sbin/wipefs| + s/-f/--force/ + }' blivet/formats/__init__.py + sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py + sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py + sed -i '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py + '' + (if useNixUdev then '' + sed -i -e '/find_library/,/find_library/ { + c libudev = "${udev}/lib/libudev.so.1" + }' blivet/pyudev.py + '' else '' + sed -i \ + -e '/^somajor *=/s/=.*/= ${toString udevSoMajor}/p' \ + -e 's|common =.*|& + ["/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]|' \ + blivet/pyudev.py + ''); + + propagatedBuildInputs = [ + pykickstart pyparted pyblock selinuxWithPython cryptsetupWithPython + ] ++ stdenv.lib.optional useNixUdev udev; + + # tests are currently _heavily_ broken upstream + doCheck = false; + + meta = { + homepage = "https://fedoraproject.org/wiki/Blivet"; + description = "Module for management of a system's storage configuration"; + license = [ "GPLv2+" "LGPLv2.1+" ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/development/python-modules/blivet/default.nix b/pkgs/development/python-modules/blivet/default.nix index c1b36bf909d..9942c092d75 100644 --- a/pkgs/development/python-modules/blivet/default.nix +++ b/pkgs/development/python-modules/blivet/default.nix @@ -1,52 +1,42 @@ -{ stdenv, fetchurl, buildPythonPackage, pykickstart, pyparted, pyblock -, libselinux, cryptsetup, multipath_tools, lsof, utillinux -, useNixUdev ? true, udev ? null -# This is only used when useNixUdev is false -, udevSoMajor ? 1 +{ stdenv, fetchFromGitHub, buildPythonPackage, pykickstart, pyparted, pyblock +, pyudev, six, libselinux, cryptsetup, multipath_tools, lsof, utillinux }: -assert useNixUdev -> udev != null; - let pyenable = { enablePython = true; }; selinuxWithPython = libselinux.override pyenable; cryptsetupWithPython = cryptsetup.override pyenable; in buildPythonPackage rec { name = "blivet-${version}"; - version = "0.17-1"; + version = "0.67"; - src = fetchurl { - url = "https://git.fedorahosted.org/cgit/blivet.git/snapshot/" - + "${name}.tar.bz2"; - sha256 = "1k3mws2q0ryb7422mml6idmaasz2i2v6ngyvg6d976dx090qnmci"; + src = fetchFromGitHub { + owner = "dwlehman"; + repo = "blivet"; + rev = name; + sha256 = "1gk94ghjrxfqnx53hph1j2s7qcv86fjz48is7l099q9c24rjv8ky"; }; postPatch = '' - sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \ - blivet/devicelibs/mpath.py blivet/devices.py + sed -i \ + -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \ + -e '/^def set_friendly_names/a \ return False' \ + blivet/devicelibs/mpath.py sed -i -e '/"wipefs"/ { s|wipefs|${utillinux}/sbin/wipefs| s/-f/--force/ }' blivet/formats/__init__.py sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py - sed -i '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py - '' + (if useNixUdev then '' - sed -i -e '/find_library/,/find_library/ { - c libudev = "${udev}/lib/libudev.so.1" - }' blivet/pyudev.py - '' else '' - sed -i \ - -e '/^somajor *=/s/=.*/= ${toString udevSoMajor}/p' \ - -e 's|common =.*|& + ["/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]|' \ - blivet/pyudev.py - ''); + sed -i -e '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py + ''; propagatedBuildInputs = [ - pykickstart pyparted pyblock selinuxWithPython cryptsetupWithPython - ] ++ stdenv.lib.optional useNixUdev udev; + pykickstart pyparted pyblock pyudev selinuxWithPython cryptsetupWithPython + six + ]; - # tests are currently _heavily_ broken upstream + # Tests in coming soon. doCheck = false; meta = { diff --git a/pkgs/tools/filesystems/nixpart/default.nix b/pkgs/tools/filesystems/nixpart/default.nix index 633f04320c3..f0c580b7990 100644 --- a/pkgs/tools/filesystems/nixpart/default.nix +++ b/pkgs/tools/filesystems/nixpart/default.nix @@ -1,13 +1,6 @@ -{ stdenv, fetchurl, buildPythonPackage, blivet -# Propagated to blivet -, useNixUdev ? null, udevSoMajor ? null -}: +{ stdenv, fetchurl, buildPythonPackage, blivet }: -let - blivetOverrides = stdenv.lib.filterAttrs (k: v: v != null) { - inherit useNixUdev udevSoMajor; - }; -in buildPythonPackage rec { +buildPythonPackage rec { name = "nixpart-${version}"; version = "0.4.1"; @@ -16,7 +9,7 @@ in buildPythonPackage rec { sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp"; }; - propagatedBuildInputs = [ (blivet.override blivetOverrides) ]; + propagatedBuildInputs = [ blivet ]; doCheck = false; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index acaad0804ea..fea5f8d6e5b 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -65,6 +65,8 @@ let blivet = callPackage ../development/python-modules/blivet { }; + blivet_0_17 = callPackage ../development/python-modules/blivet/0.17.nix { }; + dbus = callPackage ../development/python-modules/dbus { dbus = pkgs.dbus; }; @@ -123,7 +125,9 @@ let # This is used for NixOps to make sure we won't break it with the next major # version of nixpart. - nixpart0 = callPackage ../tools/filesystems/nixpart/0.4.nix { }; + nixpart0 = callPackage ../tools/filesystems/nixpart/0.4.nix { + blivet = self.blivet_0_17; + }; pitz = callPackage ../applications/misc/pitz { }; From 23160383e3d499fea96ff0feeb918e3c65a44d44 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:50:15 +0200 Subject: [PATCH 07/12] nixos: Add a filesystem module for JFS. I'm not using JFS, but this is to mainly make jfsutils available if you have defined a JFS filesystem in your configuration. Signed-off-by: aszlig --- nixos/modules/module-list.nix | 1 + nixos/modules/tasks/filesystems/jfs.nix | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 nixos/modules/tasks/filesystems/jfs.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 17d3140b087..d65691c4379 100755 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -364,6 +364,7 @@ ./tasks/filesystems/cifs.nix ./tasks/filesystems/ext.nix ./tasks/filesystems/f2fs.nix + ./tasks/filesystems/jfs.nix ./tasks/filesystems/nfs.nix ./tasks/filesystems/reiserfs.nix ./tasks/filesystems/unionfs-fuse.nix diff --git a/nixos/modules/tasks/filesystems/jfs.nix b/nixos/modules/tasks/filesystems/jfs.nix new file mode 100644 index 00000000000..b7091ce9b18 --- /dev/null +++ b/nixos/modules/tasks/filesystems/jfs.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + inInitrd = any (fs: fs == "jfs") config.boot.initrd.supportedFilesystems; +in +{ + config = mkIf (any (fs: fs == "jfs") config.boot.supportedFilesystems) { + + system.fsPackages = [ pkgs.jfsutils ]; + + boot.initrd.kernelModules = mkIf inInitrd [ "jfs" ]; + + boot.initrd.extraUtilsCommands = mkIf inInitrd '' + cp -v ${pkgs.jfsutils}/sbin/fsck.jfs "$out/bin/" + ''; + }; +} From 16371fce91709932df51d276aaac4f90dc004df2 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 01:52:34 +0200 Subject: [PATCH 08/12] nixpart: Bump version to 1.0.0 and mark as broken. We don't want Hydra to even try and build this, because we're going to fill in the right sha256 as soon as the the new nixpart version is released. Signed-off-by: aszlig --- pkgs/tools/filesystems/nixpart/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/filesystems/nixpart/default.nix b/pkgs/tools/filesystems/nixpart/default.nix index f0c580b7990..895ae99c309 100644 --- a/pkgs/tools/filesystems/nixpart/default.nix +++ b/pkgs/tools/filesystems/nixpart/default.nix @@ -2,7 +2,7 @@ buildPythonPackage rec { name = "nixpart-${version}"; - version = "0.4.1"; + version = "1.0.0"; src = fetchurl { url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz"; @@ -11,12 +11,11 @@ buildPythonPackage rec { propagatedBuildInputs = [ blivet ]; - doCheck = false; - meta = { description = "NixOS storage manager/partitioner"; license = stdenv.lib.licenses.gpl2Plus; maintainers = [ stdenv.lib.maintainers.aszlig ]; platforms = stdenv.lib.platforms.linux; + broken = true; }; } From cff26e2d384bb43022eaced9ca0682b4f671b1ab Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 05:50:33 +0200 Subject: [PATCH 09/12] nixos: Add VM test for blivet. I'm really not sure whether these tests are actually run upstream, because there are quite a few oddities which either are my fault by just missing something important or upstream really doesn't bother to run those tests. One example of this are testDiskChunk1 and testDiskChunk2, which create two non-existing partitions and tries to allocate them. Now, in allocatePartitions(), the partedPartition attributes are reset to None and shortly afterwards a for loop is expecting it to be NOT None. So, for now I'm disabling these tests and will see if we stumble on them during work on nixpart 1.0, so we're really sure whether it's my fault or a real bug in blivet. Signed-off-by: aszlig --- nixos/release.nix | 1 + nixos/tests/blivet.nix | 85 +++++++++++++++++++ .../python-modules/blivet/default.nix | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/blivet.nix diff --git a/nixos/release.nix b/nixos/release.nix index e782b0b7c63..cb79dd3a226 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -234,6 +234,7 @@ in rec { # ‘nix-build tests/login.nix -A result’. tests.avahi = callTest tests/avahi.nix {}; tests.bittorrent = callTest tests/bittorrent.nix {}; + tests.blivet = callTest tests/blivet.nix {}; tests.containers = callTest tests/containers.nix {}; tests.firefox = callTest tests/firefox.nix {}; tests.firewall = callTest tests/firewall.nix {}; diff --git a/nixos/tests/blivet.nix b/nixos/tests/blivet.nix new file mode 100644 index 00000000000..acaf4fec614 --- /dev/null +++ b/nixos/tests/blivet.nix @@ -0,0 +1,85 @@ +import ./make-test.nix ({ pkgs, ... }: with pkgs.pythonPackages; rec { + name = "blivet"; + + machine = { + environment.systemPackages = [ pkgs.python blivet mock ]; + boot.supportedFilesystems = [ "btrfs" "jfs" "reiserfs" "xfs" ]; + virtualisation.memorySize = 768; + }; + + debugBlivet = false; + debugProgramCalls = false; + + pythonTestRunner = pkgs.writeText "run-blivet-tests.py" '' + import sys + import logging + + from unittest import TestLoader + from unittest.runner import TextTestRunner + + ${pkgs.lib.optionalString debugProgramCalls '' + blivet_program_log = logging.getLogger("program") + blivet_program_log.setLevel(logging.DEBUG) + blivet_program_log.addHandler(logging.StreamHandler(sys.stderr)) + ''} + + ${pkgs.lib.optionalString debugBlivet '' + blivet_log = logging.getLogger("blivet") + blivet_log.setLevel(logging.DEBUG) + blivet_log.addHandler(logging.StreamHandler(sys.stderr)) + ''} + + runner = TextTestRunner(verbosity=2, failfast=False, buffer=False) + result = runner.run(TestLoader().discover('tests/', pattern='*_test.py')) + sys.exit(not result.wasSuccessful()) + ''; + + blivetTest = pkgs.writeScript "blivet-test.sh" '' + #!${pkgs.stdenv.shell} -e + + # Use the hosts temporary directory, because we have a tmpfs within the VM + # and we don't want to increase the memory size of the VM for no reason. + mkdir -p /tmp/xchg/bigtmp + TMPDIR=/tmp/xchg/bigtmp + export TMPDIR + + mkPythonPath() { + nix-store -qR "$@" \ + | sed -e 's|$|/lib/${pkgs.python.libPrefix}/site-packages|' + } + + cp -Rd "${blivet.src}/tests" . + + # Skip SELinux tests + rm -f tests/formats_test/selinux_test.py + + # Race conditions in growing/shrinking during resync + rm -f tests/devicelibs_test/mdraid_* + + # Deactivate small BTRFS device test, because it fails with newer btrfsprogs + sed -i -e '/^class *BTRFSAsRootTestCase3(/,/^[^ ]/ { + /^class *BTRFSAsRootTestCase3(/d + /^$/d + /^ /d + }' tests/devicelibs_test/btrfs_test.py + + # How on earth can these tests ever work even upstream? O_o + sed -i -e '/def testDiskChunk[12]/,/^ *[^ ]/{n; s/^ */&return # /}' \ + tests/partitioning_test.py + + # fix hardcoded temporary directory + sed -i \ + -e '1i import tempfile' \ + -e 's|_STORE_FILE_PATH = .*|_STORE_FILE_PATH = tempfile.gettempdir()|' \ + tests/loopbackedtestcase.py + + PYTHONPATH=".:$(mkPythonPath "${blivet}" "${mock}" | paste -sd :)" \ + python "${pythonTestRunner}" + ''; + + testScript = '' + $machine->waitForUnit("multi-user.target"); + $machine->succeed("${blivetTest}"); + $machine->execute("rm -rf /tmp/xchg/bigtmp"); + ''; +}) diff --git a/pkgs/development/python-modules/blivet/default.nix b/pkgs/development/python-modules/blivet/default.nix index 9942c092d75..f84c836c056 100644 --- a/pkgs/development/python-modules/blivet/default.nix +++ b/pkgs/development/python-modules/blivet/default.nix @@ -36,7 +36,7 @@ in buildPythonPackage rec { six ]; - # Tests in coming soon. + # Tests are in . doCheck = false; meta = { From 9d2e514f4631f5cd5ad7831710abcb384bc87a09 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 06:03:39 +0200 Subject: [PATCH 10/12] nixos/tests/partition: Fix typo in F2FS tests. Signed-off-by: aszlig --- nixos/tests/partition.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix index afe6b8d4a0d..5e94b263d5b 100644 --- a/nixos/tests/partition.nix +++ b/nixos/tests/partition.nix @@ -209,7 +209,7 @@ in { ensurePartition("swap", "swap"); ensurePartition("boot", "f2fs"); ensurePartition("root", "f2fs"); - remoteAndCheck; + remountAndCheck; ensureMountPoint("/mnt/boot", "f2fs"); }; From 7676ff5973edf14292d4de94a5c5353a5ebb5fae Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 07:14:48 +0200 Subject: [PATCH 11/12] nixpart: Bring back requirements for version 0.4. Quite a mess but at least the mdraid tests succeed now. However, the lvm2 tests are still failing, so we need to bring back a few more old crap :-( Signed-off-by: aszlig --- nixos/tests/partition.nix | 2 +- pkgs/os-specific/linux/dmraid/rc15.nix | 26 ++++++++ pkgs/os-specific/linux/lvm2/2.02.106.nix | 58 +++++++++++++++++ pkgs/tools/misc/parted/3.1.nix | 57 +++++++++++++++++ pkgs/top-level/all-packages.nix | 24 +++++++ pkgs/top-level/python-packages.nix | 79 +++++++++++++++++++++++- 6 files changed, 244 insertions(+), 2 deletions(-) create mode 100644 pkgs/os-specific/linux/dmraid/rc15.nix create mode 100644 pkgs/os-specific/linux/lvm2/2.02.106.nix create mode 100644 pkgs/tools/misc/parted/3.1.nix diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix index 5e94b263d5b..9a4246e0421 100644 --- a/nixos/tests/partition.nix +++ b/nixos/tests/partition.nix @@ -68,7 +68,7 @@ in { machine = { config, pkgs, ... }: { environment.systemPackages = [ pkgs.pythonPackages.nixpart0 - pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2 + pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2_2_02_106 ]; virtualisation.emptyDiskImages = [ 4096 4096 ]; }; diff --git a/pkgs/os-specific/linux/dmraid/rc15.nix b/pkgs/os-specific/linux/dmraid/rc15.nix new file mode 100644 index 00000000000..35efa8533ab --- /dev/null +++ b/pkgs/os-specific/linux/dmraid/rc15.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchurl, devicemapper }: + +stdenv.mkDerivation rec { + name = "dmraid-1.0.0.rc15"; + + src = fetchurl { + url = "http://people.redhat.com/~heinzm/sw/dmraid/src/old/${name}.tar.bz2"; + sha256 = "01bcaq0sc329ghgj7f182xws7jgjpdc41bvris8fsiprnxc7511h"; + }; + + preConfigure = "cd */"; + + buildInputs = [ devicemapper ]; + + meta = { + description = "Old-style RAID configuration utility"; + longDescritipn = '' + Old RAID configuration utility (still under development, though). + It is fully compatible with modern kernels and mdadm recognizes + its volumes. May be needed for rescuing an older system or nuking + the metadata when reformatting. + ''; + maintainers = [ stdenv.lib.maintainers.raskin ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/lvm2/2.02.106.nix b/pkgs/os-specific/linux/lvm2/2.02.106.nix new file mode 100644 index 00000000000..9e2b0c90079 --- /dev/null +++ b/pkgs/os-specific/linux/lvm2/2.02.106.nix @@ -0,0 +1,58 @@ +{ stdenv, fetchurl, pkgconfig, udev, utillinux, coreutils }: + +let + v = "2.02.106"; +in + +stdenv.mkDerivation { + name = "lvm2-${v}"; + + src = fetchurl { + url = "ftp://sources.redhat.com/pub/lvm2/releases/LVM2.${v}.tgz"; + sha256 = "0nr833bl0q4zq52drjxmmpf7bs6kqxwa5kahwwxm9411khkxz0vc"; + }; + + configureFlags = + "--disable-readline --enable-udev_rules --enable-udev_sync --enable-pkgconfig --enable-applib"; + + buildInputs = [ pkgconfig udev ]; + + preConfigure = + '' + substituteInPlace scripts/lvmdump.sh \ + --replace /usr/bin/tr ${coreutils}/bin/tr + substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \ + --replace /usr/sbin/lvm $out/sbin/lvm \ + --replace /usr/bin/udevadm ${udev}/bin/udevadm + + sed -i /DEFAULT_SYS_DIR/d Makefile.in + sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in + ''; + + enableParallelBuilding = true; + + #patches = [ ./purity.patch ]; + + # To prevent make install from failing. + preInstall = "installFlags=\"OWNER= GROUP= confdir=$out/etc\""; + + # Install systemd stuff. + #installTargets = "install install_systemd_generators install_systemd_units install_tmpfiles_configuration"; + + postInstall = + '' + substituteInPlace $out/lib/udev/rules.d/13-dm-disk.rules \ + --replace $out/sbin/blkid ${utillinux}/sbin/blkid + + # Systemd stuff + mkdir -p $out/etc/systemd/system $out/lib/systemd/system-generators + cp scripts/blk_availability_systemd_red_hat.service $out/etc/systemd/system + cp scripts/lvm2_activation_generator_systemd_red_hat $out/lib/systemd/system-generators + ''; + + meta = { + homepage = http://sourceware.org/lvm2/; + descriptions = "Tools to support Logical Volume Management (LVM) on Linux"; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/tools/misc/parted/3.1.nix b/pkgs/tools/misc/parted/3.1.nix new file mode 100644 index 00000000000..01b9f391a44 --- /dev/null +++ b/pkgs/tools/misc/parted/3.1.nix @@ -0,0 +1,57 @@ +{ stdenv, fetchurl, devicemapper, libuuid, gettext, readline +, utillinux, check, enableStatic ? false, hurd ? null }: + +stdenv.mkDerivation rec { + name = "parted-3.1"; + + src = fetchurl { + url = "mirror://gnu/parted/${name}.tar.xz"; + sha256 = "05fa4m1bky9d13hqv91jlnngzlyn7y4rnnyq6d86w0dg3vww372y"; + }; + + buildInputs = [ libuuid ] + ++ stdenv.lib.optional (readline != null) readline + ++ stdenv.lib.optional (gettext != null) gettext + ++ stdenv.lib.optional (devicemapper != null) devicemapper + ++ stdenv.lib.optional (hurd != null) hurd + ++ stdenv.lib.optional doCheck check; + + configureFlags = + (if (readline != null) + then [ "--with-readline" ] + else [ "--without-readline" ]) + ++ stdenv.lib.optional (devicemapper == null) "--disable-device-mapper" + ++ stdenv.lib.optional enableStatic "--enable-static"; + + doCheck = true; + + preCheck = + stdenv.lib.optionalString doCheck + # The `t0400-loop-clobber-infloop.sh' test wants `mkswap'. + "export PATH=\"${utillinux}/sbin:$PATH\""; + + meta = { + description = "Create, destroy, resize, check, and copy partitions"; + + longDescription = '' + GNU Parted is an industrial-strength package for creating, destroying, + resizing, checking and copying partitions, and the file systems on + them. This is useful for creating space for new operating systems, + reorganising disk usage, copying data on hard disks and disk imaging. + + It contains a library, libparted, and a command-line frontend, parted, + which also serves as a sample implementation and script backend. + ''; + + homepage = http://www.gnu.org/software/parted/; + license = stdenv.lib.licenses.gpl3Plus; + + maintainers = [ + # Add your name here! + stdenv.lib.maintainers.ludo + ]; + + # GNU Parted requires libuuid, which is part of util-linux-ng. + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0c165cb4ee4..e290a7334f9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1937,6 +1937,12 @@ let parted = callPackage ../tools/misc/parted { hurd = null; }; + # Needed for blivet 0.17 and nixpart 0.4 + parted_3_1 = callPackage ../tools/misc/parted/3.1.nix { + hurd = null; + devicemapper = lvm2_2_02_106; + }; + pitivi = callPackage ../applications/video/pitivi { gst = gst_all_1; clutter-gtk = clutter_gtk; @@ -7659,6 +7665,11 @@ let cryptsetup = callPackage ../os-specific/linux/cryptsetup { }; + # Needed for nixpart 0.4 and blivet 0.17 + cryptsetup_oldlvm2 = callPackage ../os-specific/linux/cryptsetup { + devicemapper = lvm2_2_02_106; + }; + cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; darwin = let @@ -7706,6 +7717,11 @@ let devicemapper = devicemapper.override {enable_dmeventd = true;}; }; + # Needed for nixpart 0.4 and blivet 0.17 + dmraid_rc15 = callPackage ../os-specific/linux/dmraid/rc15.nix { + devicemapper = lvm2_2_02_106; + }; + drbd = callPackage ../os-specific/linux/drbd { }; dstat = callPackage ../os-specific/linux/dstat { @@ -8136,6 +8152,9 @@ let lvm2 = callPackage ../os-specific/linux/lvm2 { }; + # Needed for nixpart 0.4 and blivet 0.17 + lvm2_2_02_106 = callPackage ../os-specific/linux/lvm2/2.02.106.nix { }; + mdadm = callPackage ../os-specific/linux/mdadm { }; mingetty = callPackage ../os-specific/linux/mingetty { }; @@ -8149,6 +8168,11 @@ let multipath_tools = callPackage ../os-specific/linux/multipath-tools { }; + # Needed for nixpart 0.4 and blivet 0.17 + multipath_tools_oldlvm2 = callPackage ../os-specific/linux/multipath-tools { + lvm2 = lvm2_2_02_106; + }; + musl = callPackage ../os-specific/linux/musl { }; nettools = callPackage ../os-specific/linux/net-tools { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fea5f8d6e5b..7445c8b61bd 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -65,7 +65,12 @@ let blivet = callPackage ../development/python-modules/blivet { }; - blivet_0_17 = callPackage ../development/python-modules/blivet/0.17.nix { }; + blivet_0_17 = callPackage ../development/python-modules/blivet/0.17.nix { + pyblock = self.pyblock_0_53; + pyparted = self.pyparted_3_10; + multipath_tools = pkgs.multipath_tools_oldlvm2; + cryptsetup = pkgs.cryptsetup_oldlvm2; + }; dbus = callPackage ../development/python-modules/dbus { dbus = pkgs.dbus; @@ -6521,6 +6526,35 @@ let }; }; + # pyblock 0.53 with old LVM, needed for blivet 0.17 and nixpart 0.4 + pyblock_0_53 = stdenv.mkDerivation rec { + name = "pyblock-${version}"; + version = "0.53"; + + src = pkgs.fetchurl rec { + url = "http://pkgs.fedoraproject.org/repo/pkgs/python-pyblock/" + + "${name}.tar.bz2/${md5}/${name}.tar.bz2"; + md5 = "f6d33a8362dee358517d0a9e2ebdd044"; + }; + + postPatch = '' + sed -i -e 's|/usr/include/python|${python}/include/python|' \ + -e 's/-Werror *//' -e 's|/usr/|'"$out"'/|' Makefile + ''; + + buildInputs = with self; [ python pkgs.lvm2_2_02_106 pkgs.dmraid_rc15 ]; + + makeFlags = [ + "USESELINUX=0" + "SITELIB=$(out)/lib/${python.libPrefix}/site-packages" + ]; + + meta = { + description = "Interface for working with block devices"; + license = stdenv.lib.licenses.gpl2Plus; + }; + }; + pycapnp = buildPythonPackage rec { name = "pycapnp-0.4.4"; disabled = isPyPy || isPy3k; @@ -6903,6 +6937,49 @@ let }; }; + # Needed for blivet 0.17 and nixpart 0.4 + pyparted_3_10 = buildPythonPackage rec { + name = "pyparted-${version}"; + version = "3.10"; + disabled = isPyPy; + + src = pkgs.fetchurl { + url = "https://fedorahosted.org/releases/p/y/pyparted/${name}.tar.gz"; + sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv"; + }; + + postPatch = '' + sed -i -e 's|/sbin/mke2fs|${pkgs.e2fsprogs}&|' tests/baseclass.py + sed -i -e ' + s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path| + ' tests/test__ped_ped.py + '' + optionalString stdenv.isi686 '' + # remove some integers in this test case which overflow on 32bit systems + sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \ + tests/test__ped_ped.py + ''; + + preConfigure = '' + PATH="${pkgs.parted}/sbin:$PATH" + ''; + + buildInputs = with self; [ pkgs.pkgconfig ]; + + propagatedBuildInputs = with self; [ pkgs.parted_3_1 ]; + + checkPhase = '' + patchShebangs Makefile + make test PYTHON=${python.executable} + ''; + + meta = { + homepage = "https://fedorahosted.org/pyparted/"; + description = "Python interface for libparted"; + license = stdenv.lib.licenses.gpl2Plus; + platforms = stdenv.lib.platforms.linux; + }; + }; + pyptlib = buildPythonPackage (rec { name = "pyptlib-${version}"; From 78ef5f9c14785d99a9670c65c2735610735a0bc4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 22 Oct 2014 08:15:30 +0200 Subject: [PATCH 12/12] nixpart: Move all 0.4 dependencies into one dir. Once nixpart 1.0 is released we then only need to delete one single directory rather than searching for needles in a haystack, that is, all of . Also, it keeps my sanity at an almost healthy level. Signed-off-by: aszlig --- nixos/tests/partition.nix | 2 +- pkgs/tools/filesystems/nixpart/0.4.nix | 29 ------- .../filesystems/nixpart/0.4/blivet.nix} | 8 +- .../filesystems/nixpart/0.4/cryptsetup.nix | 28 +++++++ .../tools/filesystems/nixpart/0.4/default.nix | 76 +++++++++++++++++ .../filesystems/nixpart/0.4/dmraid.nix} | 0 .../filesystems/nixpart/0.4/lvm2.nix} | 0 .../nixpart/0.4/multipath-tools.nix | 34 ++++++++ .../nixpart/0.4/parted.nix} | 0 .../tools/filesystems/nixpart/0.4/pyblock.nix | 29 +++++++ .../filesystems/nixpart/0.4/pykickstart.nix | 30 +++++++ .../filesystems/nixpart/0.4/pyparted.nix | 42 ++++++++++ pkgs/top-level/all-packages.nix | 24 ------ pkgs/top-level/python-packages.nix | 82 +------------------ 14 files changed, 243 insertions(+), 141 deletions(-) delete mode 100644 pkgs/tools/filesystems/nixpart/0.4.nix rename pkgs/{development/python-modules/blivet/0.17.nix => tools/filesystems/nixpart/0.4/blivet.nix} (87%) create mode 100644 pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix create mode 100644 pkgs/tools/filesystems/nixpart/0.4/default.nix rename pkgs/{os-specific/linux/dmraid/rc15.nix => tools/filesystems/nixpart/0.4/dmraid.nix} (100%) rename pkgs/{os-specific/linux/lvm2/2.02.106.nix => tools/filesystems/nixpart/0.4/lvm2.nix} (100%) create mode 100644 pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix rename pkgs/tools/{misc/parted/3.1.nix => filesystems/nixpart/0.4/parted.nix} (100%) create mode 100644 pkgs/tools/filesystems/nixpart/0.4/pyblock.nix create mode 100644 pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix create mode 100644 pkgs/tools/filesystems/nixpart/0.4/pyparted.nix diff --git a/nixos/tests/partition.nix b/nixos/tests/partition.nix index 9a4246e0421..5e94b263d5b 100644 --- a/nixos/tests/partition.nix +++ b/nixos/tests/partition.nix @@ -68,7 +68,7 @@ in { machine = { config, pkgs, ... }: { environment.systemPackages = [ pkgs.pythonPackages.nixpart0 - pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2_2_02_106 + pkgs.file pkgs.btrfsProgs pkgs.xfsprogs pkgs.lvm2 ]; virtualisation.emptyDiskImages = [ 4096 4096 ]; }; diff --git a/pkgs/tools/filesystems/nixpart/0.4.nix b/pkgs/tools/filesystems/nixpart/0.4.nix deleted file mode 100644 index 633f04320c3..00000000000 --- a/pkgs/tools/filesystems/nixpart/0.4.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ stdenv, fetchurl, buildPythonPackage, blivet -# Propagated to blivet -, useNixUdev ? null, udevSoMajor ? null -}: - -let - blivetOverrides = stdenv.lib.filterAttrs (k: v: v != null) { - inherit useNixUdev udevSoMajor; - }; -in buildPythonPackage rec { - name = "nixpart-${version}"; - version = "0.4.1"; - - src = fetchurl { - url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz"; - sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp"; - }; - - propagatedBuildInputs = [ (blivet.override blivetOverrides) ]; - - doCheck = false; - - meta = { - description = "NixOS storage manager/partitioner"; - license = stdenv.lib.licenses.gpl2Plus; - maintainers = [ stdenv.lib.maintainers.aszlig ]; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/development/python-modules/blivet/0.17.nix b/pkgs/tools/filesystems/nixpart/0.4/blivet.nix similarity index 87% rename from pkgs/development/python-modules/blivet/0.17.nix rename to pkgs/tools/filesystems/nixpart/0.4/blivet.nix index c1b36bf909d..44333b519cb 100644 --- a/pkgs/development/python-modules/blivet/0.17.nix +++ b/pkgs/tools/filesystems/nixpart/0.4/blivet.nix @@ -7,11 +7,7 @@ assert useNixUdev -> udev != null; -let - pyenable = { enablePython = true; }; - selinuxWithPython = libselinux.override pyenable; - cryptsetupWithPython = cryptsetup.override pyenable; -in buildPythonPackage rec { +buildPythonPackage rec { name = "blivet-${version}"; version = "0.17-1"; @@ -43,7 +39,7 @@ in buildPythonPackage rec { ''); propagatedBuildInputs = [ - pykickstart pyparted pyblock selinuxWithPython cryptsetupWithPython + pykickstart pyparted pyblock libselinux cryptsetup ] ++ stdenv.lib.optional useNixUdev udev; # tests are currently _heavily_ broken upstream diff --git a/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix b/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix new file mode 100644 index 00000000000..c612512b8cc --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/cryptsetup.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchurl, devicemapper, libgcrypt, libuuid, pkgconfig, popt +, enablePython ? true, python ? null +}: + +assert enablePython -> python != null; + +stdenv.mkDerivation rec { + name = "cryptsetup-1.6.3"; + + src = fetchurl { + url = "http://cryptsetup.googlecode.com/files/${name}.tar.bz2"; + sha256 = "1n1qk5chyjspbiianrdb55fhb4wl0vfyqz2br05vfb24v4qlgbx2"; + }; + + configureFlags = [ "--enable-cryptsetup-reencrypt" ] + ++ stdenv.lib.optional enablePython "--enable-python"; + + buildInputs = [ devicemapper libgcrypt libuuid pkgconfig popt ] + ++ stdenv.lib.optional enablePython python; + + meta = { + homepage = http://code.google.com/p/cryptsetup/; + description = "LUKS for dm-crypt"; + license = stdenv.lib.licenses.gpl2; + maintainers = with stdenv.lib.maintainers; [ viric chaoflow ]; + platforms = with stdenv.lib.platforms; linux; + }; +} diff --git a/pkgs/tools/filesystems/nixpart/0.4/default.nix b/pkgs/tools/filesystems/nixpart/0.4/default.nix new file mode 100644 index 00000000000..9ea2f9bfdc7 --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/default.nix @@ -0,0 +1,76 @@ +{ stdenv, fetchurl, python, buildPythonPackage +# Propagated to blivet +, useNixUdev ? true, udevSoMajor ? null +# Propagated dependencies +, pkgs, urlgrabber +}: + +let + blivet = import ./blivet.nix { + inherit stdenv fetchurl buildPythonPackage; + inherit pykickstart pyparted pyblock cryptsetup multipath_tools; + inherit useNixUdev udevSoMajor; + inherit (pkgs) lsof utillinux udev; + libselinux = pkgs.libselinux.override { enablePython = true; }; + }; + + cryptsetup = import ./cryptsetup.nix { + inherit stdenv fetchurl python; + inherit (pkgs) pkgconfig libgcrypt libuuid popt; + devicemapper = lvm2; + }; + + dmraid = import ./dmraid.nix { + inherit stdenv fetchurl; + devicemapper = lvm2; + }; + + lvm2 = import ./lvm2.nix { + inherit stdenv fetchurl; + inherit (pkgs) pkgconfig utillinux udev coreutils; + }; + + multipath_tools = import ./multipath-tools.nix { + inherit stdenv fetchurl lvm2; + inherit (pkgs) readline udev libaio gzip; + }; + + parted = import ./parted.nix { + inherit stdenv fetchurl; + inherit (pkgs) utillinux readline libuuid gettext check; + devicemapper = lvm2; + }; + + pyblock = import ./pyblock.nix { + inherit stdenv fetchurl python lvm2 dmraid; + }; + + pykickstart = import ./pykickstart.nix { + inherit stdenv fetchurl python buildPythonPackage urlgrabber; + }; + + pyparted = import ./pyparted.nix { + inherit stdenv fetchurl python buildPythonPackage parted; + inherit (pkgs) pkgconfig e2fsprogs; + }; + +in buildPythonPackage rec { + name = "nixpart-${version}"; + version = "0.4.1"; + + src = fetchurl { + url = "https://github.com/aszlig/nixpart/archive/v${version}.tar.gz"; + sha256 = "0avwd8p47xy9cydlbjxk8pj8q75zyl68gw2w6fnkk78dcb1a3swp"; + }; + + propagatedBuildInputs = [ blivet ]; + + doCheck = false; + + meta = { + description = "NixOS storage manager/partitioner"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/dmraid/rc15.nix b/pkgs/tools/filesystems/nixpart/0.4/dmraid.nix similarity index 100% rename from pkgs/os-specific/linux/dmraid/rc15.nix rename to pkgs/tools/filesystems/nixpart/0.4/dmraid.nix diff --git a/pkgs/os-specific/linux/lvm2/2.02.106.nix b/pkgs/tools/filesystems/nixpart/0.4/lvm2.nix similarity index 100% rename from pkgs/os-specific/linux/lvm2/2.02.106.nix rename to pkgs/tools/filesystems/nixpart/0.4/lvm2.nix diff --git a/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix b/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix new file mode 100644 index 00000000000..90722d74ace --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/multipath-tools.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl, lvm2, libaio, gzip, readline, udev }: + +stdenv.mkDerivation rec { + name = "multipath-tools-0.4.9"; + + src = fetchurl { + url = "http://christophe.varoqui.free.fr/multipath-tools/${name}.tar.bz2"; + sha256 = "04n7kazp1zrlqfza32phmqla0xkcq4zwn176qff5ida4a60whi4d"; + }; + + sourceRoot = "."; + + buildInputs = [ lvm2 libaio readline ]; + + preBuild = + '' + makeFlagsArray=(GZIP="${gzip}/bin/gzip -9 -c" prefix=$out mandir=$out/share/man/man8 man5dir=$out/share/man/man5 LIB=lib) + + substituteInPlace multipath/Makefile --replace /etc $out/etc + substituteInPlace kpartx/Makefile --replace /etc $out/etc + + substituteInPlace kpartx/kpartx.rules --replace /sbin/kpartx $out/sbin/kpartx + substituteInPlace kpartx/kpartx_id --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup + + substituteInPlace libmultipath/defaults.h --replace /lib/udev/scsi_id ${udev}/lib/udev/scsi_id + substituteInPlace libmultipath/hwtable.c --replace /lib/udev/scsi_id ${udev}/lib/udev/scsi_id + ''; + + meta = { + description = "Tools for the Linux multipathing driver"; + homepage = http://christophe.varoqui.free.fr/; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/tools/misc/parted/3.1.nix b/pkgs/tools/filesystems/nixpart/0.4/parted.nix similarity index 100% rename from pkgs/tools/misc/parted/3.1.nix rename to pkgs/tools/filesystems/nixpart/0.4/parted.nix diff --git a/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix b/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix new file mode 100644 index 00000000000..2ce126d7169 --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/pyblock.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, python, lvm2, dmraid }: + +stdenv.mkDerivation rec { + name = "pyblock-${version}"; + version = "0.53"; + + src = fetchurl rec { + url = "http://pkgs.fedoraproject.org/repo/pkgs/python-pyblock/" + + "${name}.tar.bz2/${md5}/${name}.tar.bz2"; + md5 = "f6d33a8362dee358517d0a9e2ebdd044"; + }; + + postPatch = '' + sed -i -e 's|/usr/include/python|${python}/include/python|' \ + -e 's/-Werror *//' -e 's|/usr/|'"$out"'/|' Makefile + ''; + + buildInputs = [ python lvm2 dmraid ]; + + makeFlags = [ + "USESELINUX=0" + "SITELIB=$(out)/lib/${python.libPrefix}/site-packages" + ]; + + meta = { + description = "Interface for working with block devices"; + license = stdenv.lib.licenses.gpl2Plus; + }; +} diff --git a/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix b/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix new file mode 100644 index 00000000000..7bc3f54c236 --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/pykickstart.nix @@ -0,0 +1,30 @@ +{ stdenv, python, buildPythonPackage, fetchurl, urlgrabber }: + +buildPythonPackage rec { + name = "pykickstart-${version}"; + version = "1.99.39"; + + src = fetchurl rec { + url = "http://pkgs.fedoraproject.org/repo/pkgs/pykickstart/" + + "${name}.tar.gz/${md5}/${name}.tar.gz"; + md5 = "d249f60aa89b1b4facd63f776925116d"; + }; + + postPatch = '' + sed -i -e "s/for tst in tstList/for tst in sorted(tstList, \ + key=lambda m: m.__name__)/" tests/baseclass.py + ''; + + propagatedBuildInputs = [ urlgrabber ]; + + checkPhase = '' + export PYTHONPATH="$PYTHONPATH:." + ${python}/bin/${python.executable} tests/baseclass.py -vv + ''; + + meta = { + homepage = "http://fedoraproject.org/wiki/Pykickstart"; + description = "Read and write Fedora kickstart files"; + license = stdenv.lib.licenses.gpl2Plus; + }; +} diff --git a/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix b/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix new file mode 100644 index 00000000000..67f318c863e --- /dev/null +++ b/pkgs/tools/filesystems/nixpart/0.4/pyparted.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl, pkgconfig, python, buildPythonPackage, parted, e2fsprogs }: + +buildPythonPackage rec { + name = "pyparted-${version}"; + version = "3.10"; + + src = fetchurl { + url = "https://fedorahosted.org/releases/p/y/pyparted/${name}.tar.gz"; + sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv"; + }; + + postPatch = '' + sed -i -e 's|/sbin/mke2fs|${e2fsprogs}&|' tests/baseclass.py + sed -i -e ' + s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path| + ' tests/test__ped_ped.py + '' + stdenv.lib.optionalString stdenv.isi686 '' + # remove some integers in this test case which overflow on 32bit systems + sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \ + tests/test__ped_ped.py + ''; + + preConfigure = '' + PATH="${parted}/sbin:$PATH" + ''; + + buildInputs = [ pkgconfig ]; + + propagatedBuildInputs = [ parted ]; + + checkPhase = '' + patchShebangs Makefile + make test PYTHON=${python.executable} + ''; + + meta = { + homepage = "https://fedorahosted.org/pyparted/"; + description = "Python interface for libparted"; + license = stdenv.lib.licenses.gpl2Plus; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e290a7334f9..0c165cb4ee4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1937,12 +1937,6 @@ let parted = callPackage ../tools/misc/parted { hurd = null; }; - # Needed for blivet 0.17 and nixpart 0.4 - parted_3_1 = callPackage ../tools/misc/parted/3.1.nix { - hurd = null; - devicemapper = lvm2_2_02_106; - }; - pitivi = callPackage ../applications/video/pitivi { gst = gst_all_1; clutter-gtk = clutter_gtk; @@ -7665,11 +7659,6 @@ let cryptsetup = callPackage ../os-specific/linux/cryptsetup { }; - # Needed for nixpart 0.4 and blivet 0.17 - cryptsetup_oldlvm2 = callPackage ../os-specific/linux/cryptsetup { - devicemapper = lvm2_2_02_106; - }; - cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; darwin = let @@ -7717,11 +7706,6 @@ let devicemapper = devicemapper.override {enable_dmeventd = true;}; }; - # Needed for nixpart 0.4 and blivet 0.17 - dmraid_rc15 = callPackage ../os-specific/linux/dmraid/rc15.nix { - devicemapper = lvm2_2_02_106; - }; - drbd = callPackage ../os-specific/linux/drbd { }; dstat = callPackage ../os-specific/linux/dstat { @@ -8152,9 +8136,6 @@ let lvm2 = callPackage ../os-specific/linux/lvm2 { }; - # Needed for nixpart 0.4 and blivet 0.17 - lvm2_2_02_106 = callPackage ../os-specific/linux/lvm2/2.02.106.nix { }; - mdadm = callPackage ../os-specific/linux/mdadm { }; mingetty = callPackage ../os-specific/linux/mingetty { }; @@ -8168,11 +8149,6 @@ let multipath_tools = callPackage ../os-specific/linux/multipath-tools { }; - # Needed for nixpart 0.4 and blivet 0.17 - multipath_tools_oldlvm2 = callPackage ../os-specific/linux/multipath-tools { - lvm2 = lvm2_2_02_106; - }; - musl = callPackage ../os-specific/linux/musl { }; nettools = callPackage ../os-specific/linux/net-tools { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7445c8b61bd..616fb967544 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -65,13 +65,6 @@ let blivet = callPackage ../development/python-modules/blivet { }; - blivet_0_17 = callPackage ../development/python-modules/blivet/0.17.nix { - pyblock = self.pyblock_0_53; - pyparted = self.pyparted_3_10; - multipath_tools = pkgs.multipath_tools_oldlvm2; - cryptsetup = pkgs.cryptsetup_oldlvm2; - }; - dbus = callPackage ../development/python-modules/dbus { dbus = pkgs.dbus; }; @@ -130,9 +123,7 @@ let # This is used for NixOps to make sure we won't break it with the next major # version of nixpart. - nixpart0 = callPackage ../tools/filesystems/nixpart/0.4.nix { - blivet = self.blivet_0_17; - }; + nixpart0 = callPackage ../tools/filesystems/nixpart/0.4 { }; pitz = callPackage ../applications/misc/pitz { }; @@ -6526,34 +6517,6 @@ let }; }; - # pyblock 0.53 with old LVM, needed for blivet 0.17 and nixpart 0.4 - pyblock_0_53 = stdenv.mkDerivation rec { - name = "pyblock-${version}"; - version = "0.53"; - - src = pkgs.fetchurl rec { - url = "http://pkgs.fedoraproject.org/repo/pkgs/python-pyblock/" - + "${name}.tar.bz2/${md5}/${name}.tar.bz2"; - md5 = "f6d33a8362dee358517d0a9e2ebdd044"; - }; - - postPatch = '' - sed -i -e 's|/usr/include/python|${python}/include/python|' \ - -e 's/-Werror *//' -e 's|/usr/|'"$out"'/|' Makefile - ''; - - buildInputs = with self; [ python pkgs.lvm2_2_02_106 pkgs.dmraid_rc15 ]; - - makeFlags = [ - "USESELINUX=0" - "SITELIB=$(out)/lib/${python.libPrefix}/site-packages" - ]; - - meta = { - description = "Interface for working with block devices"; - license = stdenv.lib.licenses.gpl2Plus; - }; - }; pycapnp = buildPythonPackage rec { name = "pycapnp-0.4.4"; @@ -6937,49 +6900,6 @@ let }; }; - # Needed for blivet 0.17 and nixpart 0.4 - pyparted_3_10 = buildPythonPackage rec { - name = "pyparted-${version}"; - version = "3.10"; - disabled = isPyPy; - - src = pkgs.fetchurl { - url = "https://fedorahosted.org/releases/p/y/pyparted/${name}.tar.gz"; - sha256 = "17wq4invmv1nfazaksf59ymqyvgv3i8h4q03ry2az0s9lldyg3dv"; - }; - - postPatch = '' - sed -i -e 's|/sbin/mke2fs|${pkgs.e2fsprogs}&|' tests/baseclass.py - sed -i -e ' - s|e\.path\.startswith("/tmp/temp-device-")|"temp-device-" in e.path| - ' tests/test__ped_ped.py - '' + optionalString stdenv.isi686 '' - # remove some integers in this test case which overflow on 32bit systems - sed -i -r -e '/class *UnitGetSizeTestCase/,/^$/{/[0-9]{11}/d}' \ - tests/test__ped_ped.py - ''; - - preConfigure = '' - PATH="${pkgs.parted}/sbin:$PATH" - ''; - - buildInputs = with self; [ pkgs.pkgconfig ]; - - propagatedBuildInputs = with self; [ pkgs.parted_3_1 ]; - - checkPhase = '' - patchShebangs Makefile - make test PYTHON=${python.executable} - ''; - - meta = { - homepage = "https://fedorahosted.org/pyparted/"; - description = "Python interface for libparted"; - license = stdenv.lib.licenses.gpl2Plus; - platforms = stdenv.lib.platforms.linux; - }; - }; - pyptlib = buildPythonPackage (rec { name = "pyptlib-${version}";