git.iko.soy/typeable/nixpkgs
on master help sign in
nixpart0: Don't search for libudev using SO major.

The SO major is going to change in the upcoming update of the Hetzner rescue system, which will cause NixOps to break because it's statically using the SO major 0 while the new rescue system will have the major number 1. I'm still keeping the udevSoMajor attribute to retain backwards- compatibility with older NixOps versions. Signed-off-by: aszlig <aszlig@redmoonstudios.org>

commit3bf3d1975922b8956565e10ccc5f4caea0fdbcf6 authoraszlig <aszlig@redmoonstudios.org> dateWed 21 Oct 2015, 16:43 (11 years ago) parentb7f3d55
3 files changed+47−11
pkgs/tools/filesystems/nixpart/0.4/blivet.nix+4−9 pkgs/tools/filesystems/nixpart/0.4/blivet.patch+39 pkgs/tools/filesystems/nixpart/0.4/default.nix+4−2
pkgs/tools/filesystems/nixpart/0.4/blivet.nix+4−9
@@ -1,8 +1,6 @@
11{ stdenv, fetchurl, buildPythonPackage, pykickstart, pyparted, pyblock
22, libselinux, cryptsetup, multipath_tools, lsof, utillinux
33, useNixUdev ? true, udev ? null
4−# This is only used when useNixUdev is false
5−, udevSoMajor ? 1
64}:
75
86assert useNixUdev -> udev != null;
@@ -17,6 +15,8 @@ buildPythonPackage rec {
1715 sha256 = "1k3mws2q0ryb7422mml6idmaasz2i2v6ngyvg6d976dx090qnmci";
1816 };
1917
18+ patches = [ ./blivet.patch ];
19+
2020 postPatch = ''
2121 sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \
2222 blivet/devicelibs/mpath.py blivet/devices.py
@@ -27,16 +27,11 @@ buildPythonPackage rec {
2727 sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py
2828 sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py
2929 sed -i '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py
30− '' + (if useNixUdev then ''
30+ '' + stdenv.lib.optionalString useNixUdev ''
3131 sed -i -e '/find_library/,/find_library/ {
3232 c libudev = "${udev}/lib/libudev.so.1"
3333 }' blivet/pyudev.py
34− '' else ''
35− sed -i \
36− -e '/^somajor *=/s/=.*/= ${toString udevSoMajor}/p' \
37− -e 's|common =.*|& + ["/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]|' \
38− blivet/pyudev.py
39− '');
34+ '';
4035
4136 propagatedBuildInputs = [
4237 pykickstart pyparted pyblock libselinux cryptsetup
pkgs/tools/filesystems/nixpart/0.4/blivet.patchnew file+39
@@ -0,0 +1,39 @@
1+diff --git a/blivet/pyudev.py b/blivet/pyudev.py
2+index 705b93d..7268d71 100644
3+--- a/blivet/pyudev.py
4++++ b/blivet/pyudev.py
5+@@ -7,9 +7,9 @@ from ctypes import *
6+
7+
8+ # XXX this one may need some tweaking...
9+-def find_library(name, somajor=0):
10++def find_library(name):
11+ env = os.environ.get("LD_LIBRARY_PATH")
12+- common = ["/lib64", "/lib"]
13++ common = ["/lib64", "/lib", "/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]
14+
15+ if env:
16+ libdirs = env.split(":") + common
17+@@ -19,7 +19,7 @@ def find_library(name, somajor=0):
18+ libdirs = filter(os.path.isdir, libdirs)
19+
20+ for dir in libdirs:
21+- files = fnmatch.filter(os.listdir(dir), "lib%s.so.%d" % (name, somajor))
22++ files = fnmatch.filter(os.listdir(dir), "lib%s.so.*" % name)
23+ files = [os.path.join(dir, file) for file in files]
24+
25+ if files:
26+@@ -32,11 +32,10 @@ def find_library(name, somajor=0):
27+
28+ # find the udev library
29+ name = "udev"
30+-somajor = 1
31+-libudev = find_library(name=name, somajor=somajor)
32++libudev = find_library(name)
33+
34+ if not libudev or not os.path.exists(libudev):
35+- raise ImportError, "No library named %s.%d" % (name, somajor)
36++ raise ImportError, "No library named lib%s.so" % name
37+
38+ # load the udev library
39+ libudev = CDLL(libudev)
pkgs/tools/filesystems/nixpart/0.4/default.nix+4−2
@@ -1,6 +1,8 @@
11{ stdenv, fetchurl, python, buildPythonPackage
22# Propagated to blivet
3−, useNixUdev ? true, udevSoMajor ? null
3+, useNixUdev ? true
4+# No longer needed, but kept for backwards-compatibility with older NixOps.
5+, udevSoMajor ? null
46# Propagated dependencies
57, pkgs, urlgrabber
68}:
@@ -9,7 +11,7 @@ let
911 blivet = import ./blivet.nix {
1012 inherit stdenv fetchurl buildPythonPackage;
1113 inherit pykickstart pyparted pyblock cryptsetup multipath_tools;
12− inherit useNixUdev udevSoMajor;
14+ inherit useNixUdev;
1315 inherit (pkgs) lsof utillinux udev;
1416 libselinux = pkgs.libselinux.override { enablePython = true; };
1517 };