[pyparted/f19] Do an updated pyparted-3.9 for Fedora 19.

clumens clumens at fedoraproject.org
Mon Jun 24 20:00:41 UTC 2013


commit 3f28e2dc9a8512f33f4c2bdd2faf6624a6d4265e
Author: Chris Lumens <clumens at redhat.com>
Date:   Mon Jun 24 14:42:03 2013 -0400

    Do an updated pyparted-3.9 for Fedora 19.
    
    We are seeing an awful lot of UnicodeDecodeError tracebacks during installation
    of Fedora 19.  Turns out it's related to the changes in this package where
    pyparted is now returning unicode in various places.  Nothing else is set up
    to handle that yet, and it's too late in the cycle to fix it.
    
    I've backed out all the stuff from pyparted-3.10 except a couple bug fixes,
    which I am applying here as patches.  This all necessitates adding an epoch
    to the spec file.
    
    Note that this is only for F19, and master still includes the unicode stuff that
    anaconda and blivet will need to figure out how to deal with.

 ...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                                      |   12 ++-
 4 files changed, 210 insertions(+), 1 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 5a8b455..2699422 100644
--- a/pyparted.spec
+++ b/pyparted.spec
@@ -1,12 +1,16 @@
 Summary: Python module for GNU parted
 Name:    pyparted
+Epoch:   1
 Version: 3.9
-Release: 2%{?dist}
+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}
@@ -38,6 +45,9 @@ rm -rf %{buildroot}
 %{python_sitearch}/%{name}-%{version}-*.egg-info
 
 %changelog
+* Mon Jun 24 2013 Chris Lumens <clumens at redhat.com> 3.9-3
+- Fix a bunch of unicode-related tracebacks during installation.
+
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.9-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 


More information about the scm-commits mailing list