Skip to content

Commit

Permalink
Update to 3.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Aug 11, 2024
1 parent ab9cfd4 commit ed0c945
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 95 deletions.
10 changes: 5 additions & 5 deletions .qubesbuilder
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
host-fc37:
host-fc41:
rpm:
build:
- python-blivet.spec
source:
files:
- url: https://ftp.qubes-os.org/distfiles/blivet-3.5.0-tests.tar.gz
sha512: blivet-3.5.0-tests.tar.gz.sha512
- url: https://ftp.qubes-os.org/distfiles/blivet-3.5.0.tar.gz
sha512: blivet-3.5.0.tar.gz.sha512
- url: https://ftp.qubes-os.org/distfiles/blivet-@VERSION@-tests.tar.gz
sha512: blivet-@VERSION@-tests.tar.gz.sha512
- url: https://ftp.qubes-os.org/distfiles/blivet-@VERSION@.tar.gz
sha512: blivet-@VERSION@.tar.gz.sha512
61 changes: 61 additions & 0 deletions 0002-guard-against-pyparted-type_uuid-being-None.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From 9fc508fe315c994c9f65ce85d50df6a0cbb17577 Mon Sep 17 00:00:00 2001
From: Adam Williamson <[email protected]>
Date: Fri, 26 Jul 2024 08:45:14 -0700
Subject: [PATCH] part_type_uuid: guard against pyparted type_uuid being None

It's possible for the pyparted partition's `type_uuid` to be None
in several ways: see all the NULL returns in
https://github.com/dcantrell/pyparted/blob/d5870bb7a5d512c17c92a4e4fe7e9a8e7c8c3528/src/pydisk.c#L1481
In the specific case we hit, anaconda since 41.26 will try to get
the `part_type_uuid` of a partition on an msdos-labeled disk when
looking for Windows installations; as msdos-labeled disks do not
support partition type UUIDs, pyparted's call to
ped_partition_get_type_uuid gets a "msdos disk labels do not
support partition type-uuids" error from parted and returns NULL,
so pyparted tries to forward that error somehow then return
NULL itself (though the error gets swallowed somewhere along the
line, I had to patch pyparted to find out what was going on).

That means we try to do `UUID(bytes=None)`, which blows up:

TypeError: one of the hex, bytes, bytes_le, fields, or int arguments must be given

due to a check at the start of `UUID.__init__` that the value of
exactly one of those args is not `None`.

To avoid this, let's check both that our pyparted supports
`type_uuid` (which I think is the point of the existing condition
here) *and* that the current pyparted partition's `type_uuid` is
truth-y before trying to get a `UUID`.

Let's also catch TypeError and ValueError here, as we do in the
other two cases where we get a `UUID`. I'm not sure why this one
also catches AttributeError, but it can't hurt anything, so let's
keep it.

Arguably anaconda shouldn't even try to get a type UUID for a
device on an msdos-labeled disk, but it seems reasonable to make
blivet not blow up if it or something else does.

Signed-off-by: Adam Williamson <[email protected]>
---
blivet/devices/partition.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
index 2d67be81f..3d46ecc84 100644
--- a/blivet/devices/partition.py
+++ b/blivet/devices/partition.py
@@ -377,10 +377,10 @@ def part_type_uuid(self):
if not self.exists:
return self.part_type_uuid_req
else:
- if hasattr(parted.Partition, "type_uuid"):
+ if hasattr(parted.Partition, "type_uuid") and self.parted_partition.type_uuid:
try:
return UUID(bytes=self.parted_partition.type_uuid)
- except AttributeError:
+ except (TypeError, ValueError, AttributeError):
pass
return self._part_type_uuid

1 change: 1 addition & 0 deletions blivet-3.10.1-tests.tar.gz.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bd9dfc02ff6e3371f59c697377543a6104f744527b710bc139838f351d2cbc01f04ac4839a9b74872cf02cae34a96cbd453c953d28f1047d669909ac5177a971
1 change: 1 addition & 0 deletions blivet-3.10.1.tar.gz.sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de4c95a9b8afe59fc8e51f48ecd2916891e3294f8c584852035102a9e0f7f61d34cdbff6156adad6f0ba465d54e9e236a12a01bc0a9b3030cb1b8922f967aaf2
1 change: 0 additions & 1 deletion blivet-3.5.0-tests.tar.gz.sha512

This file was deleted.

1 change: 0 additions & 1 deletion blivet-3.5.0.tar.gz.sha512

This file was deleted.

94 changes: 7 additions & 87 deletions python-blivet.spec.in
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
%define is_rhel 0%{?rhel} != 0

# python3 is not available on RHEL <=7
%if %{is_rhel} && 0%{?rhel} <= 7
# disable python3 by default
%bcond_with python3
%else
%bcond_without python3
%endif

# python2 is not available on RHEL > 7 and not needed on Fedora > 28
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
# disable python2 by default
%bcond_with python2
%else
%bcond_without python2
%endif

Summary: A python module for system storage configuration
Name: python-blivet
Url: https://storageapis.wordpress.com/projects/blivet
Expand All @@ -35,13 +17,14 @@ Source1: https://github.com/storaged-project/blivet/archive/%{realname}-%{realve
Patch0: 0001-remove-btrfs-plugin.patch
%endif
Patch1: 0001-Double-recommended-LVM-thin-pool-metadata-space.patch
Patch2: 0002-guard-against-pyparted-type_uuid-being-None.patch

# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
%global partedver 1.8.1
%global pypartedver 3.10.4
%global utillinuxver 2.15.1
%global libblockdevver 2.24
%global libblockdevver 3.0
%global libbytesizever 0.3
%global pyudevver 0.18

Expand Down Expand Up @@ -75,19 +58,21 @@ BuildRequires: python3-devel
BuildRequires: python3-setuptools

Requires: python3
Requires: python3-six
Requires: python3-pyudev >= %{pyudevver}
Requires: parted >= %{partedver}
Requires: python3-pyparted >= %{pypartedver}
Requires: libselinux-python3
Requires: python3-libmount
Requires: python3-blockdev >= %{libblockdevver}
Recommends: libblockdev-btrfs >= %{libblockdevver}
Recommends: libblockdev-crypto >= %{libblockdevver}
Recommends: libblockdev-dm >= %{libblockdevver}
Recommends: libblockdev-fs >= %{libblockdevver}
Recommends: libblockdev-loop >= %{libblockdevver}
Recommends: libblockdev-lvm >= %{libblockdevver}
Recommends: libblockdev-mdraid >= %{libblockdevver}
Recommends: libblockdev-mpath >= %{libblockdevver}
Recommends: libblockdev-nvme >= %{libblockdevver}
Recommends: libblockdev-swap >= %{libblockdevver}

%ifarch s390 s390x
Expand All @@ -103,76 +88,19 @@ Requires: %{realname}-data = %{epoch}:%{version}-%{release}

Obsoletes: blivet-data < 1:2.0.0

%if %{without python2}
Obsoletes: python2-blivet < 1:2.0.2-2
Obsoletes: python-blivet < 1:2.0.2-2
%else
Obsoletes: python-blivet < 1:2.0.0
%endif

%description -n python3-%{realname}
The python3-%{realname} is a python3 package for examining and modifying storage
configuration.
%endif

%if %{with python2}
%package -n python2-%{realname}
Summary: A python2 package for examining and modifying storage configuration.

%{?python_provide:%python_provide python2-%{realname}}

BuildRequires: gettext
BuildRequires: python2-devel
BuildRequires: python2-setuptools

Requires: python2
Requires: python2-six
Requires: python2-pyudev >= %{pyudevver}
Requires: parted >= %{partedver}
Requires: python2-pyparted >= %{pypartedver}
Requires: python2-libselinux
Requires: python2-blockdev >= %{libblockdevver}
Recommends: libblockdev-btrfs >= %{libblockdevver}
Recommends: libblockdev-crypto >= %{libblockdevver}
Recommends: libblockdev-dm >= %{libblockdevver}
Recommends: libblockdev-fs >= %{libblockdevver}
Recommends: libblockdev-kbd >= %{libblockdevver}
Recommends: libblockdev-loop >= %{libblockdevver}
Recommends: libblockdev-lvm >= %{libblockdevver}
Recommends: libblockdev-mdraid >= %{libblockdevver}
Recommends: libblockdev-mpath >= %{libblockdevver}
Recommends: libblockdev-nvdimm >= %{libblockdevver}
Recommends: libblockdev-part >= %{libblockdevver}
Recommends: libblockdev-swap >= %{libblockdevver}
Recommends: libblockdev-s390 >= %{libblockdevver}
Requires: python2-bytesize >= %{libbytesizever}
Requires: util-linux >= %{utillinuxver}
Requires: lsof
Requires: python2-hawkey
Requires: %{realname}-data = %{epoch}:%{version}-%{release}

Requires: systemd-udev
Requires: python2-gobject-base

Obsoletes: blivet-data < 1:2.0.0
Obsoletes: python-blivet < 1:2.0.0

%description -n python2-%{realname}
The python2-%{realname} is a python2 package for examining and modifying storage
configuration.
%endif

%prep
%autosetup -n %{realname}-%{realversion} -N
%autosetup -n %{realname}-%{realversion} -b1 -p1

%build
%{?with_python2:make PYTHON=%{__python2}}
%{?with_python3:make PYTHON=%{__python3}}
make

%install
%{?with_python2:make PYTHON=%{__python2} DESTDIR=%{buildroot} install}
%{?with_python3:make PYTHON=%{__python3} DESTDIR=%{buildroot} install}
make DESTDIR=%{buildroot} install

%find_lang %{realname}

Expand All @@ -182,14 +110,6 @@ configuration.
%{_libexecdir}/*
%{_unitdir}/*

%if %{with python2}
%files -n python2-%{realname}
%license COPYING
%doc README.md ChangeLog examples
%{python2_sitelib}/*
%endif

%if %{with python3}
%files -n python3-%{realname}
%license COPYING
%doc README.md ChangeLog examples
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.0
3.10.1

0 comments on commit ed0c945

Please sign in to comment.