Upgrade to pyparted-3.13.0

Signed-off-by: David Cantrell <dcantrell@redhat.com>
This commit is contained in:
David Cantrell 2023-06-22 07:19:58 -04:00
parent 5cc8e359da
commit a4238a2a12
5 changed files with 27 additions and 223 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@
/pyparted-3.11.7.tar.gz.asc
/pyparted-3.12.0.tar.gz
/pyparted-3.12.0.tar.gz.asc
/pyparted-3.13.0.tar.gz
/pyparted-3.13.0.tar.gz.asc

View File

@ -1,12 +0,0 @@
diff -up pyparted-3.12.0/tests/test__ped_disktype.py.orig pyparted-3.12.0/tests/test__ped_disktype.py
--- pyparted-3.12.0/tests/test__ped_disktype.py.orig 2023-03-02 09:08:37.322713489 -0500
+++ pyparted-3.12.0/tests/test__ped_disktype.py 2023-03-02 09:10:06.248488694 -0500
@@ -96,7 +96,7 @@ class DiskTypeStrTestCase(RequiresDiskTy
self.assertEqual(str(self.disktype['amiga']), '_ped.DiskType instance --\n name: amiga features: 2')
if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_UUID"):
- self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 10')
+ self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 58')
else:
self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 2')

View File

@ -1,85 +0,0 @@
diff -up pyparted-3.12.0/src/parted/__init__.py.orig pyparted-3.12.0/src/parted/__init__.py
--- pyparted-3.12.0/src/parted/__init__.py.orig 2022-03-07 12:38:56.000000000 -0500
+++ pyparted-3.12.0/src/parted/__init__.py 2022-06-21 15:05:10.318939409 -0400
@@ -217,6 +217,14 @@ from _ped import DISK_GPT_PMBR_BOOT
from _ped import DISK_TYPE_EXTENDED
from _ped import DISK_TYPE_PARTITION_NAME
+if hasattr(_ped, 'DISK_TYPE_PARTITION_TYPE_ID'):
+ # pylint: disable=E0611
+ from _ped import DISK_TYPE_PARTITION_TYPE_ID
+
+if hasattr(_ped, 'DISK_TYPE_PARTITION_TYPE_UUID'):
+ # pylint: disable=E0611
+ from _ped import DISK_TYPE_PARTITION_TYPE_UUID
+
from _ped import EXCEPTION_TYPE_INFORMATION
from _ped import EXCEPTION_TYPE_WARNING
from _ped import EXCEPTION_TYPE_ERROR
diff -up pyparted-3.12.0/src/_pedmodule.c.orig pyparted-3.12.0/src/_pedmodule.c
--- pyparted-3.12.0/src/_pedmodule.c.orig 2022-03-07 12:49:11.000000000 -0500
+++ pyparted-3.12.0/src/_pedmodule.c 2022-06-21 15:04:57.863977820 -0400
@@ -685,6 +685,14 @@ MOD_INIT(_ped) {
PyModule_AddIntConstant(m, "DISK_TYPE_EXTENDED", PED_DISK_TYPE_EXTENDED);
PyModule_AddIntConstant(m, "DISK_TYPE_PARTITION_NAME", PED_DISK_TYPE_PARTITION_NAME);
+#if PED_DISK_TYPE_LAST_FEATURE > 2
+ PyModule_AddIntConstant(m, "DISK_TYPE_PARTITION_TYPE_ID", PED_DISK_TYPE_PARTITION_TYPE_ID);
+#endif
+
+#if PED_DISK_TYPE_LAST_FEATURE > 4
+ PyModule_AddIntConstant(m, "DISK_TYPE_PARTITION_TYPE_UUID", PED_DISK_TYPE_PARTITION_TYPE_UUID);
+#endif
+
/* add PedFileSystemType as _ped.FileSystemType */
if (PyType_Ready(&_ped_FileSystemType_Type_obj) < 0)
return MOD_ERROR_VAL;
diff -up pyparted-3.12.0/tests/test__ped_disktype.py.orig pyparted-3.12.0/tests/test__ped_disktype.py
--- pyparted-3.12.0/tests/test__ped_disktype.py.orig 2018-01-12 13:31:40.000000000 -0500
+++ pyparted-3.12.0/tests/test__ped_disktype.py 2022-06-21 15:04:57.863977820 -0400
@@ -63,11 +63,22 @@ class DiskTypeCheckFeatureTestCase(Requi
self.assertTrue(self.disktype[name].check_feature(_ped.DISK_TYPE_EXTENDED))
self.assertFalse(self.disktype[name].check_feature(_ped.DISK_TYPE_PARTITION_NAME))
+ if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_ID"):
+ self.assertTrue(self.disktype[name].check_feature(_ped.DISK_TYPE_PARTITION_TYPE_ID))
+
+ if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_UUID"):
+ self.assertFalse(self.disktype[name].check_feature(_ped.DISK_TYPE_PARTITION_TYPE_UUID))
+
# The following types support DISK_TYPE_PARTITION_NAME
for name in ['amiga', 'gpt', 'mac', 'pc98']:
self.assertFalse(self.disktype[name].check_feature(_ped.DISK_TYPE_EXTENDED))
self.assertTrue(self.disktype[name].check_feature(_ped.DISK_TYPE_PARTITION_NAME))
+ # The following types support DISK_TYPE_PARTITION_TYPE_UUID
+ for name in ['gpt']:
+ if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_UUID"):
+ self.assertTrue(self.disktype[name].check_feature(_ped.DISK_TYPE_PARTITION_TYPE_UUID))
+
# The following types support all features
for name in ['dvh']:
self.assertTrue(self.disktype[name].check_feature(_ped.DISK_TYPE_EXTENDED))
@@ -75,11 +86,20 @@ class DiskTypeCheckFeatureTestCase(Requi
class DiskTypeStrTestCase(RequiresDiskTypes):
def runTest(self):
- self.assertEqual(str(self.disktype['msdos']), '_ped.DiskType instance --\n name: msdos features: 1')
+ if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_ID"):
+ self.assertEqual(str(self.disktype['msdos']), '_ped.DiskType instance --\n name: msdos features: 5')
+ else:
+ self.assertEqual(str(self.disktype['msdos']), '_ped.DiskType instance --\n name: msdos features: 1')
+
self.assertEqual(str(self.disktype['aix']), '_ped.DiskType instance --\n name: aix features: 0')
self.assertEqual(str(self.disktype['sun']), '_ped.DiskType instance --\n name: sun features: 0')
self.assertEqual(str(self.disktype['amiga']), '_ped.DiskType instance --\n name: amiga features: 2')
- self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 2')
+
+ if hasattr(_ped, "DISK_TYPE_PARTITION_TYPE_UUID"):
+ self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 10')
+ else:
+ self.assertEqual(str(self.disktype['gpt']), '_ped.DiskType instance --\n name: gpt features: 2')
+
self.assertEqual(str(self.disktype['mac']), '_ped.DiskType instance --\n name: mac features: 2')
self.assertEqual(str(self.disktype['bsd']), '_ped.DiskType instance --\n name: bsd features: 0')
self.assertEqual(str(self.disktype['pc98']), '_ped.DiskType instance --\n name: pc98 features: 2')

View File

@ -1,164 +1,63 @@
%if 0%{?rhel}
%if %{rhel} <= 7
# disable python3 by default
%bcond_with python3
%else
%bcond_without python3
%endif
Summary: Python module for GNU parted
Name: pyparted
Epoch: 1
Version: 3.13.0
Release: 1%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/dcantrell/pyparted
%if %{rhel} > 7
# disable python2 by default
%bcond_with python2
%else
%bcond_without python2
%endif
%endif
%if 0%{?fedora}
%if %{fedora} < 23
# disable python3 by default
%bcond_with python3
%else
%bcond_without python3
%endif
%if %{fedora} > 31
# disable python2 by default
%bcond_with python2
%else
%bcond_without python2
%endif
%endif
Summary: Python module for GNU parted
Name: pyparted
Epoch: 1
Version: 3.12.0
Release: 11%{?dist}
License: GPL-2.0-or-later
URL: https://github.com/dcantrell/pyparted
Source0: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
Source2: keyring.gpg
Source3: trustdb.gpg
# Support new disk type features from parted 3.5:
# https://bugzilla.redhat.com/show_bug.cgi?id=2098792
# https://github.com/dcantrell/pyparted/issues/91
Patch0: pyparted-3.12.0-partition-types.patch
Patch1: pyparted-3.12.0-gpt-disktype-test.patch
Source0: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
Source2: keyring.gpg
Source3: trustdb.gpg
BuildRequires: make
BuildRequires: gcc
BuildRequires: parted-devel >= 3.3
BuildRequires: parted-devel >= 3.4
BuildRequires: pkgconfig
BuildRequires: e2fsprogs
BuildRequires: gnupg2
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-six
BuildRequires: python3-setuptools
%endif
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-six
%endif
%global _description\
Python module for the parted library. It is used for manipulating\
%description
Python module for the parted library. It is used for manipulating
partition tables.
%description %_description
%if %{with python2}
%package -n python2-pyparted
Summary: %summary
%{?python_provide:%python_provide python2-pyparted}
# Remove before F30
Provides: pyparted = %{epoch}:%{version}-%{release}
Provides: pyparted%{?_isa} = %{epoch}:%{version}-%{release}
Obsoletes: pyparted < %{epoch}:%{version}-%{release}
%description -n python2-pyparted %_description
%endif
%if %{with python3}
%package -n python3-pyparted
Summary: Python 3 module for GNU parted
%description -n python3-pyparted
Python module for the parted library. It is used for manipulating
partition tables. This package provides Python 3 bindings for parted.
%endif
%prep
# Verify source archive signature
gpg --no-default-keyring --keyring %{SOURCE2} --trustdb-name %{SOURCE3} --verify %{SOURCE1} %{SOURCE0} || exit 1
%setup -q
%patch -P 0 -p1
%patch -P 1 -p1
%if %{with python3}
everything=$(ls)
mkdir -p py3dir
cp -a $everything py3dir
%endif
%autosetup
%build
%if %{with python2}
PYTHON=python2 %make_build CFLAGS="%{optflags} -fcommon"
%endif
%if %{with python3}
pushd py3dir
PYTHON=python3 %make_build CFLAGS="%{optflags} -fcommon"
popd
%endif
%make_build CFLAGS="%{optflags} -fcommon"
%check
%if %{with python2}
PYTHON=python2 make test
%endif
%if %{with python3}
pushd py3dir
PYTHON=python3 make test
popd
%endif
make test
%install
%if %{with python2}
PYTHON=python2 %make_install
%endif
%make_install
%if %{with python3}
pushd py3dir
PYTHON=python3 %make_install
popd
%endif
%if %{with python2}
%files -n python2-pyparted
%doc AUTHORS COPYING NEWS README TODO
%{python2_sitearch}/_ped.so
%{python2_sitearch}/parted
%{python2_sitearch}/%{name}-%{version}-*.egg-info
%endif
%if %{with python3}
%files -n python3-pyparted
%doc AUTHORS COPYING NEWS README TODO
%doc AUTHORS HACKING NEWS README.md RELEASE TODO
%license LICENSE
%{python3_sitearch}/_ped.*.so
%{python3_sitearch}/parted
%{python3_sitearch}/%{name}-%{version}-*.egg-info
%endif
%changelog
* Wed Jun 21 2023 David Cantrell <dcantrell@redhat.com> - 1:3.13.0-1
- Upgrade to pyparted-3.13.0
* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1:3.12.0-11
- Rebuilt for Python 3.12

View File

@ -1,2 +1,2 @@
SHA512 (pyparted-3.12.0.tar.gz) = 0179e5334be8c04287b10b47d407ad339933cd3e20514d2142fe968acf8a36c40e541ee5165e2b3699a40b133d8f1948d8d12ccf307d3a1736090fb33f28b7e7
SHA512 (pyparted-3.12.0.tar.gz.asc) = 452d386fbc8b84fa0dc186bb75c6c12eb051c8a37575e5a3a0cf504d13c4b2a0134d7e486928f9af7d142d25802bda05c97fd95ff80721ae6f6c0abedb8b1614
SHA512 (pyparted-3.13.0.tar.gz) = a9162afdbee48de5474de98ae8c08df028d485e122fcafae8421dddd47c9ed00d8dd9f40d854b14d4582483d8ea3469128a912491371385e4f18a0dbbbafbfd5
SHA512 (pyparted-3.13.0.tar.gz.asc) = 6f3e973b52584450c3eed97d64266df832d8820a6a72f731fbb9fbd9be06f93f2d53b47bcae01b78a831e3e3cedca3ae8629dc5f9fe35dcc3ed11226a11fd952