[pyparted] Revert to pyparted-3.9 plus critical patches due to issues with the 3.10

David Cantrell dcantrel at fedoraproject.org
Wed Jul 3 15:21:36 UTC 2013


commit 6427527f2b1029245be131b9ecfd856f28e352b0
Author: David Cantrell <david.l.cantrell at gmail.com>
Date:   Wed Jul 3 11:22:22 2013 -0400

    Revert to pyparted-3.9 plus critical patches due to issues with the 3.10
    
      release which are actively being worked on.  The 3.10 release does not
      work with the installer right now.

 ...t-traceback-when-calling-setlocale-875354.patch |   42 ++++++
 ...straint-to-__ped.Constraint-in-partition..patch |   26 ++++
 ...CH-pyparted-export-ped_disk_new-functiona.patch |  131 ++++++++++++++++++++
 pyparted.spec                                      |   18 +++-
 sources                                            |    2 +-
 5 files changed, 215 insertions(+), 4 deletions(-)
---
diff --git a/0001-Do-not-traceback-when-calling-setlocale-875354.patch b/0001-Do-not-traceback-when-calling-setlocale-875354.patch
new file mode 100644
index 0000000..6f8123f
--- /dev/null
+++ b/0001-Do-not-traceback-when-calling-setlocale-875354.patch
@@ -0,0 +1,42 @@
+From a43c9ca4e0fb600d425f50d11287f7c4fddee5f3 Mon Sep 17 00:00:00 2001
+From: Chris Lumens <clumens at redhat.com>
+Date: Fri, 14 Dec 2012 13:06:43 -0500
+Subject: [PATCH 01/03] Do not traceback when calling setlocale (#875354).
+
+This is just a debugging luxury.  It's not worth additional tracebacks.
+---
+ src/parted/decorators.py | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/src/parted/decorators.py b/src/parted/decorators.py
+index 2b583ad..737f72c 100644
+--- a/src/parted/decorators.py
++++ b/src/parted/decorators.py
+@@ -24,13 +24,22 @@ import locale
+ import functools
+ 
+ def localeC(fn):
++    # setlocale is not thread-safe, and anaconda (at least) may call this from
++    # another thread.  This is just a luxury to have untranslated tracebacks,
++    # so it's not worth tracebacking itself.
++    def _setlocale(l):
++        try:
++            locale.setlocale(locale.LC_MESSAGES, l)
++        except:
++            pass
++
+     @functools.wraps(fn)
+     def new(*args, **kwds):
+         oldlocale = locale.getlocale(locale.LC_MESSAGES)
+-        locale.setlocale(locale.LC_MESSAGES, 'C')
++        _setlocale('C')
+         try:
+             ret = fn(*args, **kwds)
+         finally:
+-            locale.setlocale(locale.LC_MESSAGES, oldlocale)
++            _setlocale(oldlocale)
+         return ret
+     return new
+-- 
+1.8.1.2
+
diff --git a/0002-Convert-Constraint-to-__ped.Constraint-in-partition..patch b/0002-Convert-Constraint-to-__ped.Constraint-in-partition..patch
new file mode 100644
index 0000000..07b658e
--- /dev/null
+++ b/0002-Convert-Constraint-to-__ped.Constraint-in-partition..patch
@@ -0,0 +1,26 @@
+From 760a3b7c39a59c2e0f131b40e0a48bdf8240f637 Mon Sep 17 00:00:00 2001
+From: Chris Tyler <chris at tylers.info>
+Date: Fri, 11 Jan 2013 13:42:29 -0500
+Subject: [PATCH 02/03] Convert Constraint to __ped.Constraint in
+ partition.getMaxGeometry()
+
+---
+ src/parted/partition.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/parted/partition.py b/src/parted/partition.py
+index 20b6f41..ee3e2d0 100644
+--- a/src/parted/partition.py
++++ b/src/parted/partition.py
+@@ -166,7 +166,7 @@ class Partition(object):
+     def getMaxGeometry(self, constraint):
+         """Given a constraint, return the maximum Geometry that self can be
+            grown to.  Raises Partitionexception on error."""
+-        return parted.Geometry(PedGeometry=self.disk.getPedDisk().get_max_partition_geometry(self.__partition, constraint))
++        return parted.Geometry(PedGeometry=self.disk.getPedDisk().get_max_partition_geometry(self.__partition, constraint.getPedConstraint()))
+ 
+     @localeC
+     def isFlagAvailable(self, flag):
+-- 
+1.8.1.2
+
diff --git a/0003-Subject-PATCH-pyparted-export-ped_disk_new-functiona.patch b/0003-Subject-PATCH-pyparted-export-ped_disk_new-functiona.patch
new file mode 100644
index 0000000..39665f4
--- /dev/null
+++ b/0003-Subject-PATCH-pyparted-export-ped_disk_new-functiona.patch
@@ -0,0 +1,131 @@
+From 36384816c56d666bbf3492ddcc531bf4c4a38674 Mon Sep 17 00:00:00 2001
+From: Nageswara R Sastry <rnsastry at linux.vnet.ibm.com>
+Date: Thu, 23 May 2013 09:14:10 -0400
+Subject: [PATCH 03/03] Subject: [PATCH] pyparted: export ped_disk_new
+ functionality
+
+Fixed Block Access (FBA) DASDs are mainframe-specific disk devices
+which are layed out as a sequence of 512-byte sectors. In contrast
+to ECKD DASDs, these disks do not require formatting and resemble
+the LBA layout of non-mainframe disks. Despite this resemblance,
+the Linux kernel applies special handling during partition detection
+for FBA DASDs, resulting in a single, immutable partition being
+reported.
+
+While actual FBA DASD hardware is no longer available, the z/VM
+hypervisor can simulate FBA DASD disks, backed by either ECKD or
+SCSI devices.
+
+This patch adds support for FBA DASD partitions and successful
+installation by Anaconda.
+
+Signed-off-by: Nageswara R Sastry <rnsastry at linux.vnet.ibm.com>
+---
+ include/pydisk.h       |  1 +
+ src/_pedmodule.c       |  7 +++++++
+ src/parted/__init__.py |  9 +++++++++
+ src/pydisk.c           | 32 ++++++++++++++++++++++++++++++++
+ 4 files changed, 49 insertions(+)
+
+diff --git a/include/pydisk.h b/include/pydisk.h
+index c0bf92e..a2bcc4f 100644
+--- a/include/pydisk.h
++++ b/include/pydisk.h
+@@ -152,6 +152,7 @@ PyObject *py_ped_disk_get_partition(PyObject *, PyObject *);
+ PyObject *py_ped_disk_get_partition_by_sector(PyObject *, PyObject *);
+ PyObject *py_ped_disk_extended_partition(PyObject *, PyObject *);
+ PyObject *py_ped_disk_new_fresh(PyObject *, PyObject *);
++PyObject *py_ped_disk_new(PyObject *, PyObject *);
+ 
+ #endif /* PYDISK_H_INCLUDED */
+ 
+diff --git a/src/_pedmodule.c b/src/_pedmodule.c
+index add0e8c..efdf831 100644
+--- a/src/_pedmodule.c
++++ b/src/_pedmodule.c
+@@ -162,6 +162,11 @@ PyDoc_STRVAR(disk_new_fresh_doc,
+ "will have to use the commit_to_dev() method to write the new label to\n"
+ "the disk.");
+ 
++PyDoc_STRVAR(disk_new_doc,
++"disk_new(Device) -> Disk\n\n"
++"Given the Device, create a new Disk object. And probe, read the details of\n"
++"the disk.");
++
+ PyDoc_STRVAR(disk_flag_get_name_doc,
+ "disk_flag_get_name(integer) -> string\n\n"
+ "Return a name for a disk flag constant.  If an invalid flag is provided,\n"
+@@ -252,6 +257,8 @@ static struct PyMethodDef PyPedModuleMethods[] = {
+                             METH_VARARGS, partition_flag_next_doc},
+     {"disk_new_fresh", (PyCFunction) py_ped_disk_new_fresh,
+                        METH_VARARGS, disk_new_fresh_doc},
++    {"disk_new", (PyCFunction) py_ped_disk_new,
++                       METH_VARARGS, disk_new_doc},
+     {"disk_flag_get_name", (PyCFunction) py_ped_disk_flag_get_name,
+                                 METH_VARARGS, disk_flag_get_name_doc},
+     {"disk_flag_get_by_name", (PyCFunction) py_ped_disk_flag_get_by_name,
+diff --git a/src/parted/__init__.py b/src/parted/__init__.py
+index 01f9575..0eb23d2 100644
+--- a/src/parted/__init__.py
++++ b/src/parted/__init__.py
+@@ -418,6 +418,15 @@ def freshDisk(device, ty):
+     return Disk(PedDisk=peddisk)
+ 
+ @localeC
++def newDisk(device):
++    """Return a Disk object for this Device. Read the partition table off
++       a device (if one is found)."""
++    from _ped import disk_new
++
++    peddisk = disk_new(device.getPedDevice())
++    return Disk(PedDisk=peddisk)
++
++ at localeC
+ def version():
+     """Return a dict containing the pyparted and libparted versions."""
+     from _ped import libparted_version
+diff --git a/src/pydisk.c b/src/pydisk.c
+index f58eeef..4e70f55 100644
+--- a/src/pydisk.c
++++ b/src/pydisk.c
+@@ -2004,5 +2004,37 @@ PyObject *py_ped_disk_new_fresh(PyObject *s, PyObject *args) {
+     return (PyObject *) ret;
+ }
+ 
++PyObject *py_ped_disk_new(PyObject *s, PyObject *args) {
++    _ped_Device *in_device = NULL;
++    PedDevice *device = NULL;
++    PedDisk *disk = NULL;
++    _ped_Disk *ret = NULL;
++
++    if (!PyArg_ParseTuple(args, "O!", &_ped_Device_Type_obj, &in_device)) {
++        return NULL;
++    }
++
++    if ((device = _ped_Device2PedDevice((PyObject *) in_device)) == NULL) {
++        return NULL;
++    }
++
++    if ((disk = ped_disk_new(device)) == NULL) {
++        if (partedExnRaised) {
++            partedExnRaised = 0;
++
++            if (!PyErr_ExceptionMatches(PartedException) &&
++                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
++                PyErr_SetString(DiskException, partedExnMessage);
++        } else {
++            PyErr_Format(DiskException, "Could not create new disk label on %s", disk->dev->path);
++        }
++
++        return NULL;
++    }
++
++    ret = PedDisk2_ped_Disk(disk);
++    return (PyObject *) ret;
++}
++
+ /* vim:tw=78:ts=4:et:sw=4
+  */
+-- 
+1.8.1.2
+
diff --git a/pyparted.spec b/pyparted.spec
index c5f60d4..7b16fc6 100644
--- a/pyparted.spec
+++ b/pyparted.spec
@@ -1,12 +1,16 @@
 Summary: Python module for GNU parted
 Name:    pyparted
-Version: 3.10
-Release: 2%{?dist}
+Epoch:   1
+Version: 3.9
+Release: 3%{?dist}
 License: GPLv2+
 Group:   System Environment/Libraries
 URL:     http://fedorahosted.org/pyparted
 
 Source0: http://fedorahosted.org/releases/p/y/%{name}/%{name}-%{version}.tar.gz
+Patch1:  0001-Do-not-traceback-when-calling-setlocale-875354.patch
+Patch2:  0002-Convert-Constraint-to-__ped.Constraint-in-partition..patch
+Patch3:  0003-Subject-PATCH-pyparted-export-ped_disk_new-functiona.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
 BuildRequires: python-devel
@@ -19,6 +23,9 @@ partition tables.
 
 %prep
 %setup -q
+%patch1 -p 1
+%patch2 -p 1
+%patch3 -p 1
 
 %build
 make %{?_smp_mflags}
@@ -33,11 +40,16 @@ rm -rf %{buildroot}
 %files
 %defattr(-,root,root,-)
 %doc AUTHORS BUGS COPYING ChangeLog NEWS README TODO
-%{python_sitearch}/_ped.so
+%{python_sitearch}/_pedmodule.so
 %{python_sitearch}/parted
 %{python_sitearch}/%{name}-%{version}-*.egg-info
 
 %changelog
+* Wed Jul 08 2013 David Cantrell <dcantrell at redhat.com> - 3.9-3
+- Revert to pyparted-3.9 plus critical patches due to issues with the 3.10
+  release which are actively being worked on.  The 3.10 release does not
+  work with the installer right now.
+
 * Thu May 23 2013 David Cantrell <dcantrell at redhat.com> - 3.10-2
 - Fix build errors.
 
diff --git a/sources b/sources
index c63267a..35c66c2 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d494440b34bc9ea0afea45c4a4ac3274  pyparted-3.10.tar.gz
+f16c7ef7f5fa4a43fcb2a4654b487e39  pyparted-3.9.tar.gz


More information about the scm-commits mailing list