nixpkgs/pkgs/tools/filesystems/nixpart/0.4/blivet.patch
aszlig 3bf3d19759
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>
2015-10-21 17:15:17 +02:00

39 lines
1.2 KiB
Diff

diff --git a/blivet/pyudev.py b/blivet/pyudev.py
index 705b93d..7268d71 100644
--- a/blivet/pyudev.py
+++ b/blivet/pyudev.py
@@ -7,9 +7,9 @@ from ctypes import *
# XXX this one may need some tweaking...
-def find_library(name, somajor=0):
+def find_library(name):
env = os.environ.get("LD_LIBRARY_PATH")
- common = ["/lib64", "/lib"]
+ common = ["/lib64", "/lib", "/lib/x86_64-linux-gnu", "/lib/i686-linux-gnu"]
if env:
libdirs = env.split(":") + common
@@ -19,7 +19,7 @@ def find_library(name, somajor=0):
libdirs = filter(os.path.isdir, libdirs)
for dir in libdirs:
- files = fnmatch.filter(os.listdir(dir), "lib%s.so.%d" % (name, somajor))
+ files = fnmatch.filter(os.listdir(dir), "lib%s.so.*" % name)
files = [os.path.join(dir, file) for file in files]
if files:
@@ -32,11 +32,10 @@ def find_library(name, somajor=0):
# find the udev library
name = "udev"
-somajor = 1
-libudev = find_library(name=name, somajor=somajor)
+libudev = find_library(name)
if not libudev or not os.path.exists(libudev):
- raise ImportError, "No library named %s.%d" % (name, somajor)
+ raise ImportError, "No library named lib%s.so" % name
# load the udev library
libudev = CDLL(libudev)