From f96713f6cd1366c1a0982255acbac2e951f9a670 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 9 May 2017 13:25:38 +0200 Subject: [PATCH] Look the disk up for a partition by name not sys_name (#1445302) --- python-blivet.spec | 5 ++++- rhbz1445302.patch | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 rhbz1445302.patch diff --git a/python-blivet.spec b/python-blivet.spec index ff8816b..9f2c80d 100644 --- a/python-blivet.spec +++ b/python-blivet.spec @@ -5,7 +5,7 @@ Version: 2.1.8 #%%global prerelease .b1 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 -Release: 1%{?prerelease}%{?dist} +Release: 2%{?prerelease}%{?dist} Epoch: 1 License: LGPLv2+ Group: System Environment/Libraries @@ -13,6 +13,8 @@ Group: System Environment/Libraries %global realversion %{version}%{?prerelease} Source0: http://github.com/rhinstaller/blivet/archive/%{realname}-%{realversion}.tar.gz +Patch0: rhbz1445302.patch + # Versions of required components (done so we make sure the buildrequires # match the requires versions of things). %global pykickstartver 1.99.22 @@ -62,6 +64,7 @@ configuration. %prep %setup -q -n %{realname}-%{realversion} +%patch0 -p1 rm -rf %{py3dir} cp -a . %{py3dir} diff --git a/rhbz1445302.patch b/rhbz1445302.patch new file mode 100644 index 0000000..52caafb --- /dev/null +++ b/rhbz1445302.patch @@ -0,0 +1,40 @@ +From 7ef50d3b7061353838e44c8dc202eb5f6b012f40 Mon Sep 17 00:00:00 2001 +From: Vratislav Podzimek +Date: Thu, 4 May 2017 13:03:06 +0200 +Subject: [PATCH] Look the disk up for a partition by name not sys_name + +udev.device_get_partition_disk() returns the device name as given +by device_get_name() not sys_name. So when trying to find a match +we need to compare it to the same value for devices we iterate +over. + +Also don't call resolve_devspec() on the returned value, +udev.device_get_partition_disk() is already doing it. + +Resolves: rhbz#1445302 +--- + blivet/populator/helpers/partition.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/blivet/populator/helpers/partition.py b/blivet/populator/helpers/partition.py +index 617b5e7..73b15f1 100644 +--- a/blivet/populator/helpers/partition.py ++++ b/blivet/populator/helpers/partition.py +@@ -57,13 +57,13 @@ def run(self): + return device + + disk = None +- sys_name = udev.device_get_partition_disk(self.data) +- if sys_name: +- disk_name = udev.resolve_devspec(sys_name) ++ disk_name = udev.device_get_partition_disk(self.data) ++ if disk_name: + disk = self._devicetree.get_device_by_name(disk_name) + if disk is None: + # create a device instance for the disk +- disk_info = next((i for i in udev.get_devices() if i.sys_name == sys_name), None) ++ disk_info = next((i for i in udev.get_devices() ++ if udev.device_get_name(i) == disk_name), None) + if disk_info is not None: + self._devicetree.handle_device(disk_info) + disk = self._devicetree.get_device_by_name(disk_name)