[system-config-kdump] Display target partition when not explicitly chosen

mmilata mmilata at fedoraproject.org
Fri May 16 12:34:02 UTC 2014


commit 02771985838de58c48307797796f7006916d0602
Author: Martin Milata <mmilata at redhat.com>
Date:   Fri May 16 14:33:22 2014 +0200

    Display target partition when not explicitly chosen
    
    + Require kexec-tools version that supports automatic mounting

 ...fig-kdump-2.0.15-display-target-partition.patch |   83 ++++++++++++++++++++
 system-config-kdump.spec                           |   11 ++-
 2 files changed, 92 insertions(+), 2 deletions(-)
---
diff --git a/system-config-kdump-2.0.15-display-target-partition.patch b/system-config-kdump-2.0.15-display-target-partition.patch
new file mode 100644
index 0000000..6701d65
--- /dev/null
+++ b/system-config-kdump-2.0.15-display-target-partition.patch
@@ -0,0 +1,83 @@
+commit 5e11dac3575bb392f5e2580c3620a7084fb73537
+Author: Martin Milata <mmilata at redhat.com>
+Date:   Wed May 14 14:25:51 2014 +0200
+
+    Display target partition when not explicitly chosen
+    
+    Signed-off-by: Martin Milata <mmilata at redhat.com>
+
+diff --git a/src/system-config-kdump.py b/src/system-config-kdump.py
+index 606f9ae..0b1574f 100755
+--- a/src/system-config-kdump.py
++++ b/src/system-config-kdump.py
+@@ -1340,7 +1340,7 @@ class MainWindow:
+         index = 0
+         for name, (fs_type, mntpoint) in self.partitions.iteritems():
+             if (name == DEFAULT_FS):
+-                combobox.append_text(_("Root file system"))
++                combobox.append_text(_("Unspecified"))
+                 combobox.set_active(index)
+             else:
+                 combobox.append_text("%s: %s on %s" % (name, fs_type, mntpoint))
+@@ -1770,16 +1770,58 @@ class MainWindow:
+         self.update_local_hint_label(self.my_settings.local_partition, self.location_entry.get_text())
+         self.check_settings()
+ 
++    @staticmethod
++    def partition_for_dir(path):
++        """
++        Returns (device, mountpoint, fs_type) corresponding to partition on
++        which the directory resides. The directory doesn't have to exist. Returns
++        None on error.
++        """
++        if len(path) > 0 and path[-1] != '/':
++            path += '/'
++
++        with open('/proc/mounts', 'r') as fh:
++            lines = fh.read().splitlines()
++
++        mounts = []
++        for line in lines:
++            line = line.split()
++
++            dev = line[0]
++            mntpoint = line[1]
++            fstype = line[2]
++
++            if ((path.startswith(mntpoint + '/') or mntpoint == '/')
++                    and dev != 'rootfs'):
++                mounts.append((dev, mntpoint, fstype))
++
++        mounts.sort(reverse = True, key = lambda (dev, mntpoint, fstype): len(mntpoint))
++        if mounts:
++            return mounts[0]
++        else:
++            return None
++
+     def update_local_hint_label(self, partition, path):
+         """
+         Update local_hint_label text with set partition and path
+         """
+-        if partition == "":
++
++        # if the partition is not specified, try to find it out
++        if partition == '':
++            result = self.partition_for_dir(path)
++            if result:
++                (dev, mntpoint, fstype) = result
++                partition = "%s %s" % (fstype, dev)
++                if mntpoint != '/':
++                    # path relative to the partition
++                    path = path[len(mntpoint):]
++
++        if partition != '':
+             self.local_hint_label.set_text(
+-                _("core will be in %s/%%DATE on rootfs") % path)
++                 _("core will be in %s/%%DATE on %s") % (path, partition))
+         else:
+             self.local_hint_label.set_text(
+-                _("core will be in %s/%%DATE on %s") %(path, partition))
++                _("core will be in %s/%%DATE on root file system") % path)
+ 
+     def changed_raw_device(self, raw_dev_box, *args):
+         """
diff --git a/system-config-kdump.spec b/system-config-kdump.spec
index 6451d72..bf4e4ef 100644
--- a/system-config-kdump.spec
+++ b/system-config-kdump.spec
@@ -3,7 +3,7 @@
 Summary: A graphical interface for configuring kernel crash dumping
 Name: system-config-kdump
 Version: 2.0.15
-Release: 1%{?dist}
+Release: 2%{?dist}
 URL: http://fedorahosted.org/system-config-kdump/
 License: GPLv2+
 Group: System Environment/Base
@@ -15,18 +15,21 @@ BuildRequires: intltool, gettext, gnome-doc-utils, docbook-dtds, rarian-compat,
 Requires: pygtk2 >= 2.8.6
 Requires: pygtk2-libglade
 Requires: usermode >= 1.36
-Requires: kexec-tools
+Requires: kexec-tools >= 2.0.6-4
 Requires: yelp
 Requires: python-slip-dbus
 Requires(pre): gtk2 >= 2.8.20
 Requires(pre): hicolor-icon-theme
 
+Patch0: system-config-kdump-2.0.15-display-target-partition.patch
+
 %description
 system-config-kdump is a graphical tool for configuring kernel crash
 dumping via kdump and kexec.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 make
@@ -81,6 +84,10 @@ fi
 %doc %{_datadir}/omf/system-config-kdump
 
 %changelog
+* Fri May 16 2014 Martin Milata <mmilata at redhat.com> - 2.0.15-2
+- Display target partition when not explicitly chosen
+- Require kexec-tools version that supports automatic mounting
+
 * Mon May 12 2014 Martin Milata <mmilata at redhat.com> - 2.0.15-1
 - Update to 2.0.15
 


More information about the scm-commits mailing list