From bdf0896b09a9fe10158a9226684b7be5b64e71b1 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Mon, 12 Mar 2018 11:35:58 -0400 Subject: [PATCH] Allow device specification by node to udev.get_device. (#1524700) --- ...cification-by-node-to-udev.get_devic.patch | 32 +++++++++++++++++++ python-blivet.spec | 6 +++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 0003-Allow-device-specification-by-node-to-udev.get_devic.patch diff --git a/0003-Allow-device-specification-by-node-to-udev.get_devic.patch b/0003-Allow-device-specification-by-node-to-udev.get_devic.patch new file mode 100644 index 0000000..683ba99 --- /dev/null +++ b/0003-Allow-device-specification-by-node-to-udev.get_devic.patch @@ -0,0 +1,32 @@ +From 39aa7041481f6e5cf954e67661f2cb55d43f9441 Mon Sep 17 00:00:00 2001 +From: David Lehman +Date: Thu, 8 Mar 2018 11:40:48 -0500 +Subject: [PATCH] Allow device specification by node to udev.get_device. + (#1524700) + +--- + blivet/udev.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/blivet/udev.py b/blivet/udev.py +index 6936a230..6eb7dab0 100644 +--- a/blivet/udev.py ++++ b/blivet/udev.py +@@ -56,9 +56,12 @@ def device_to_dict(device): + return result + + +-def get_device(sysfs_path): ++def get_device(sysfs_path=None, device_node=None): + try: +- device = pyudev.Devices.from_sys_path(global_udev, sysfs_path) ++ if sysfs_path is not None: ++ device = pyudev.Devices.from_sys_path(global_udev, sysfs_path) ++ elif device_node is not None: ++ device = pyudev.Devices.from_device_file(global_udev, device_node) + except pyudev.DeviceNotFoundError as e: + log.error(e) + result = None +-- +2.14.3 + diff --git a/python-blivet.spec b/python-blivet.spec index 3065bb4..ba5671a 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -14,7 +14,7 @@ Version: 3.0.0 %global prerelease .b1 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 0.3%{?prerelease}%{?dist} +Release: 0.4%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ Group: System Environment/Libraries @@ -23,6 +23,7 @@ Group: System Environment/Libraries Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}.tar.gz Patch0: 0001-Dasd-is-a-valid-label-type-on-s390x.patch Patch1: 0002-Do-not-try-to-update-potfile-during-make-all.patch +Patch2: 0003-Allow-device-specification-by-node-to-udev.get_devic.patch # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). @@ -165,6 +166,9 @@ make PYTHON=%{__python3} DESTDIR=%{buildroot} install %endif %changelog +* Mon Mar 12 2018 David Lehman - 1:3.0.0-0.4.b1 +- Allow device specification by node to udev.get_device. (#1524700) + * Tue Mar 06 2018 Vojtech Trefny - 1:3.0.0-0.3.b1 - Dasd is a valid label type on s390x (#1538550)