forked from pool/python-parted
- Add patch to tweak features detected in tests (parted changes
from suse): * python-parted-featurestest.patch - Add patch python-parted-parted-binary.patch to run parted full path as user does not see sbin binaries - Add patch no-last-flag-check.patch from debian - Add patch python-parted-unittests.patch from ubuntu to fix tests - Implement singlespec version for python3 - Refresh patch pyparted-3.10.patch to work with python3 - Enable testsuite to validate it somehow OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-parted?expand=0&rev=8
This commit is contained in:
committed by
Git OBS Bridge
parent
ae81501588
commit
d7e8562b4a
27
no-last-flag-check.patch
Normal file
27
no-last-flag-check.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
Description: Remove *_LAST_FLAG checks
|
||||
The last flag in an enumeration is not really part of the ABI. Checking it
|
||||
here means that changes to parted may unexpectedly break pyparted.
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Reviewed-by: Herbert Parentes Fortes Neto <hpfn@ig.com.br>
|
||||
Bug-Debian: http://bugs.debian.org/697588
|
||||
Last-Update: 2014-11-30
|
||||
--- a/src/pydisk.c
|
||||
+++ b/src/pydisk.c
|
||||
@@ -1020,7 +1020,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if ((flag < PED_DISK_FIRST_FLAG) || (flag > PED_DISK_LAST_FLAG)) {
|
||||
+ if ((flag < PED_DISK_FIRST_FLAG)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid flag provided.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1404,7 +1404,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if ((flag < PED_PARTITION_FIRST_FLAG) || (flag > PED_PARTITION_LAST_FLAG)) {
|
||||
+ if ((flag < PED_PARTITION_FIRST_FLAG)) {
|
||||
PyErr_SetString(PyExc_ValueError, "Invalid flag provided.");
|
||||
return NULL;
|
||||
}
|
||||
@@ -9,4 +9,4 @@ diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache
|
||||
+ try:
|
||||
+ diskFlag[__flag] = _ped.disk_flag_get_name(__flag)
|
||||
+ except:
|
||||
+ print "Bad disk flag:", __flag
|
||||
+ print("Bad disk flag: {}".format(__flag))
|
||||
|
||||
26
python-parted-featurestest.patch
Normal file
26
python-parted-featurestest.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
Index: pyparted-3.11.1/tests/test__ped_disktype.py
|
||||
===================================================================
|
||||
--- pyparted-3.11.1.orig/tests/test__ped_disktype.py
|
||||
+++ pyparted-3.11.1/tests/test__ped_disktype.py
|
||||
@@ -80,7 +80,7 @@ class DiskTypeStrTestCase(RequiresDiskTy
|
||||
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')
|
||||
- self.assertEqual(str(self.disktype['mac']), '_ped.DiskType instance --\n name: mac features: 2')
|
||||
+ self.assertEqual(str(self.disktype['mac']), '_ped.DiskType instance --\n name: mac features: 6')
|
||||
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')
|
||||
self.assertEqual(str(self.disktype['loop']), '_ped.DiskType instance --\n name: loop features: 0')
|
||||
Index: pyparted-3.11.1/tests/test_parted_partition.py
|
||||
===================================================================
|
||||
--- pyparted-3.11.1.orig/tests/test_parted_partition.py
|
||||
+++ pyparted-3.11.1/tests/test_parted_partition.py
|
||||
@@ -179,7 +179,7 @@ class PartitionGetFlagsAsStringTestCase(
|
||||
as comma separated list.
|
||||
'''
|
||||
def runTest(self):
|
||||
- self.assertEqual(self.part.getFlagsAsString(), 'boot, raid')
|
||||
+ self.assertEqual(self.part.getFlagsAsString(), 'boot, raid, type')
|
||||
|
||||
@unittest.skip("Unimplemented test case.")
|
||||
class PartitionGetMaxGeometryTestCase(unittest.TestCase):
|
||||
31
python-parted-parted-binary.patch
Normal file
31
python-parted-parted-binary.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
Index: pyparted-3.11.1/tests/baseclass.py
|
||||
===================================================================
|
||||
--- pyparted-3.11.1.orig/tests/baseclass.py
|
||||
+++ pyparted-3.11.1/tests/baseclass.py
|
||||
@@ -68,7 +68,7 @@ class RequiresFileSystem(unittest.TestCa
|
||||
os.write(fd, b"0")
|
||||
f.close()
|
||||
|
||||
- os.system("mke2fs -F -q %s" % (self.path,))
|
||||
+ os.system("/usr/sbin/mke2fs -F -q %s" % (self.path,))
|
||||
|
||||
self._device = _ped.device_get(self.path)
|
||||
self._geometry = _ped.Geometry(self._device, 0, self._device.length - 1)
|
||||
@@ -133,7 +133,7 @@ class RequiresDeviceAlignment(RequiresDe
|
||||
class RequiresLabeledDevice(RequiresDevice):
|
||||
def setUp(self):
|
||||
RequiresDevice.setUp(self)
|
||||
- os.system("parted -s %s mklabel msdos" % (self.path,))
|
||||
+ os.system("/usr/sbin/parted -s %s mklabel msdos" % (self.path,))
|
||||
|
||||
# Base class for any test case that requires a _ped.Disk or parted.Disk.
|
||||
class RequiresDisk(RequiresDevice):
|
||||
@@ -150,7 +150,7 @@ class RequiresMount(RequiresDevice):
|
||||
self.mountpoint = None
|
||||
|
||||
def mkfs(self):
|
||||
- os.system("mkfs.ext2 -F -q %s" % self.path)
|
||||
+ os.system("/usr/sbin/mkfs.ext2 -F -q %s" % self.path)
|
||||
|
||||
def doMount(self):
|
||||
self.mountpoint = tempfile.mkdtemp()
|
||||
33
python-parted-unittests.patch
Normal file
33
python-parted-unittests.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 52762a217fdc702e3f8ed869d1d8ccf30babed05 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?=
|
||||
<lukasz.zemczak@ubuntu.com>
|
||||
Date: Mon, 17 Jul 2017 12:36:01 +0200
|
||||
Subject: [PATCH] _ped's *_flag_get_name methods now throw a PartedException
|
||||
instead of ValueError on unsupported flags.
|
||||
|
||||
---
|
||||
tests/test__ped_ped.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/test__ped_ped.py b/tests/test__ped_ped.py
|
||||
index 79046ab..e7ce116 100755
|
||||
--- a/tests/test__ped_ped.py
|
||||
+++ b/tests/test__ped_ped.py
|
||||
@@ -48,7 +48,7 @@ def runTest(self):
|
||||
self.assertNotEqual(_ped.partition_flag_get_name(attr), "", "Could not get name for flag _ped.%s" % f)
|
||||
|
||||
self.assertRaises(ValueError, _ped.partition_flag_get_name, -1)
|
||||
- self.assertRaises(ValueError, _ped.partition_flag_get_name, 1000)
|
||||
+ self.assertRaises(_ped.PartedException, _ped.partition_flag_get_name, 1000)
|
||||
|
||||
class PartitionFlagGetByNameTestCase(unittest.TestCase):
|
||||
def runTest(self):
|
||||
@@ -82,7 +82,7 @@ def runTest(self):
|
||||
self.assertNotEqual(_ped.disk_flag_get_name(f), "", "Could not get name for flag %s" % f)
|
||||
|
||||
self.assertRaises(ValueError, _ped.disk_flag_get_name, -1)
|
||||
- self.assertRaises(ValueError, _ped.disk_flag_get_name, 1000)
|
||||
+ self.assertRaises(_ped.PartedException, _ped.disk_flag_get_name, 1000)
|
||||
|
||||
class DiskFlagGetByNameTestCase(unittest.TestCase):
|
||||
def runTest(self):
|
||||
@@ -1,3 +1,21 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu May 24 15:26:23 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Add patch to tweak features detected in tests (parted changes
|
||||
from suse):
|
||||
* python-parted-featurestest.patch
|
||||
- Add patch python-parted-parted-binary.patch to run parted full
|
||||
path as user does not see sbin binaries
|
||||
- Add patch no-last-flag-check.patch from debian
|
||||
- Add patch python-parted-unittests.patch from ubuntu to fix tests
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 24 14:49:05 UTC 2018 - tchvatal@suse.com
|
||||
|
||||
- Implement singlespec version for python3
|
||||
- Refresh patch pyparted-3.10.patch to work with python3
|
||||
- Enable testsuite to validate it somehow
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 24 12:08:12 UTC 2018 - bwiedemann@suse.com
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-parted
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -16,24 +16,34 @@
|
||||
#
|
||||
|
||||
|
||||
Summary: Python module for GNU parted
|
||||
License: GPL-2.0+
|
||||
Group: Development/Languages/Python
|
||||
Name: python-parted
|
||||
%define srcname pyparted
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-parted
|
||||
Version: 3.11.1
|
||||
Release: 0
|
||||
Url: http://fedorahosted.org/pyparted
|
||||
|
||||
Summary: Python module for GNU parted
|
||||
License: GPL-2.0-or-later
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/dcantrell/pyparted/
|
||||
Source0: https://github.com/dcantrell/pyparted/archive/v3.11.1.tar.gz#/%{srcname}-%{version}.tar.gz
|
||||
# catch exception for unknown 'disk flag', kkaempf@suse.de
|
||||
Patch: pyparted-3.10.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Patch0: pyparted-3.10.patch
|
||||
# do not check for PED_PARTITION)_LAST_FLAG as it is not part of ABI
|
||||
Patch1: no-last-flag-check.patch
|
||||
Patch2: python-parted-unittests.patch
|
||||
Patch3: python-parted-parted-binary.patch
|
||||
Patch4: python-parted-featurestest.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module six}
|
||||
# tests requires
|
||||
BuildRequires: e2fsprogs
|
||||
BuildRequires: parted
|
||||
Requires: parted
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: parted-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: python-devel >= 2.7
|
||||
BuildRequires: python-rpm-macros
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Python module for the parted library. It is used for manipulating
|
||||
@@ -41,20 +51,22 @@ partition tables.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{srcname}-%{version}
|
||||
%patch -p1
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags}
|
||||
%python_build
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot}
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
|
||||
%fdupes %{buildroot}
|
||||
%check
|
||||
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m unittest discover -v
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc AUTHORS COPYING NEWS README TODO
|
||||
%{python_sitearch}/_ped.so
|
||||
%files %{python_files}
|
||||
%license COPYING
|
||||
%doc AUTHORS NEWS README TODO
|
||||
%{python_sitearch}/_ped*.so
|
||||
%{python_sitearch}/parted
|
||||
%{python_sitearch}/%{srcname}-%{version}-*.egg-info
|
||||
|
||||
|
||||
Reference in New Issue
Block a user