Branch 'develop' - 7 commits - data/liveusb-creator.desktop liveusb-creator liveusb-creator.console liveusb-creator.pam liveusb-creator_polkit liveusb/creator.py liveusb-creator.spec liveusb/gui.py MANIFEST.in org.fedoraproject.pkexec.run-liveusb-creator.policy setup.py

Luke Macken lmacken at fedoraproject.org
Thu Nov 27 07:16:18 UTC 2014


 MANIFEST.in                                         |    4 -
 data/liveusb-creator.desktop                        |    2 
 liveusb-creator                                     |    2 
 liveusb-creator.console                             |    5 --
 liveusb-creator.pam                                 |    5 --
 liveusb-creator.spec                                |   40 ++++++++++++------
 liveusb-creator_polkit                              |    6 ++
 liveusb/creator.py                                  |   43 +++++++++++---------
 liveusb/gui.py                                      |    6 --
 org.fedoraproject.pkexec.run-liveusb-creator.policy |   19 ++++++++
 setup.py                                            |    2 
 11 files changed, 82 insertions(+), 52 deletions(-)

New commits:
commit c66449c9e5766f764b9d0d1cbd77384c8c5de17d
Merge: a44fbfd 6609ea9
Author: Luke Macken <lmacken at redhat.com>
Date:   Thu Nov 27 00:14:16 2014 -0700

    Merge branch 'release/3.13.1' into develop



commit 6609ea99e5dd0539d632a4b147d50e203b01e043
Author: Luke Macken <lmacken at redhat.com>
Date:   Thu Nov 27 00:10:52 2014 -0700

    Version bump

diff --git a/liveusb-creator b/liveusb-creator
index a6ad31c..c03c2cf 100755
--- a/liveusb-creator
+++ b/liveusb-creator
@@ -23,7 +23,7 @@ import sys
 
 from liveusb import _
 
-__version__ = '3.13.0'
+__version__ = '3.13.1'
 
 def parse_args():
     from optparse import OptionParser
diff --git a/liveusb-creator.spec b/liveusb-creator.spec
index 912ce88..2eb90d7 100644
--- a/liveusb-creator.spec
+++ b/liveusb-creator.spec
@@ -7,8 +7,8 @@
 %endif
 
 Name:           liveusb-creator
-Version:        3.13.0
-Release:        2%{?dist}
+Version:        3.13.1
+Release:        1%{?dist}
 Summary:        A liveusb creator
 
 Group:          Applications/System
@@ -90,6 +90,9 @@ rm -rf %{buildroot}
 %{_datadir}/polkit-1/actions/org.fedoraproject.pkexec.run-liveusb-creator.policy
 
 %changelog
+* Thu Nov 27 2014 Luke Macken <lmacken at redhat.com> - 3.13.1-1
+- Latest upstream release
+
 * Thu Nov 27 2014 Gene Czarcinski <gczarcinski at gmail.com> 3.13.0-2
 - convert to using polkit (pkexec) instead of consolehelper
 
diff --git a/setup.py b/setup.py
index 702e151..ac45ca2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from distutils.core import setup
 import sys, os
 
-VERSION = '3.13.0'
+VERSION = '3.13.1'
 
 LOCALE_DIR= '/usr/share/locale'
 


commit a44fbfd5153e0b9b2eb41226719fce7d70fe6e12
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 26 23:57:42 2014 -0700

    Ensure our destination path exists before checking for the liveos (#1006270)

diff --git a/liveusb/creator.py b/liveusb/creator.py
index ac3e8c1..205d853 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -370,6 +370,8 @@ class LiveUSBCreator(object):
         return os.path.exists(self.get_liveos())
 
     def get_liveos(self):
+        if not os.path.exists(self.dest):
+            raise LiveUSBError(_('Cannot find path %r') % self.dest)
         return os.path.join(self.dest + os.path.sep, "LiveOS")
 
     def existing_overlay(self):


commit a4ac598beec059cb29f918bc508b479b9d5a6d9a
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 26 23:46:53 2014 -0700

    More robust handling of exception messages (#1098725)
    
    This should hopefully fix a lot of random unicode errors in our exception
    message handling.

diff --git a/liveusb/creator.py b/liveusb/creator.py
index e679900..ac3e8c1 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -199,9 +199,9 @@ class LiveUSBCreator(object):
             filename = self.write_log()
             if not passive:
                 raise LiveUSBError(_("There was a problem executing the "
-                                     "following command: `%s`\n%s\nA more detailed "
+                                     "following command: %r\n%r\nA more detailed "
                                      "error log has been written to "
-                                     "'%s'" % (cmd, err.decode('utf-8', errors='replace'), filename)))
+                                     "'%r'" % (cmd, err, filename)))
         return proc
 
     def verify_iso_sha1(self, progress=None):
@@ -322,7 +322,7 @@ class LiveUSBCreator(object):
                 try:
                     shutil.copyfile(infile, outfile)
                 except Exception, e:
-                    self.log.warning(_("Unable to copy %s to %s: %s") % (infile, outfile, str(e)))
+                    self.log.warning(_("Unable to copy %r to %r: %r") % (infile, outfile, e))
 
     def delete_ldlinux(self):
         # Don't prompt about overwriting files from mtools (#491234)
@@ -349,12 +349,12 @@ class LiveUSBCreator(object):
                         try:
                             os.chmod(os.path.join(path, f), 0777)
                         except OSError, e:
-                            self.log.debug(_("Unable to delete %s: %s") % (f, e))
+                            self.log.debug(_("Unable to delete %r: %r") % (f, e))
                 try:
                     shutil.rmtree(path)
                 except OSError, e:
                     raise LiveUSBError(_("Unable to remove previous LiveOS: "
-                                         "%s" % str(e)))
+                                         "%r" % e))
 
     def write_log(self):
         """ Write out our subprocess stdout/stderr to a log file """
@@ -646,7 +646,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
                     self.log.error(_('Unknown dbus exception while trying to '
                                      'mount device: %s') % str(e))
             except Exception, e:
-                raise LiveUSBError(_("Unable to mount device: %s" % str(e)))
+                raise LiveUSBError(_("Unable to mount device: %r" % e))
 
             # Get the new mount point
             udi = self.drive['udi']
@@ -696,7 +696,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
                     self.popen('/sbin/e2label %s %s' % (self.drive['device'],
                                                         self.label))
             except LiveUSBError, e:
-                self.log.error(_("Unable to change volume label: %s") % e)
+                self.log.error(_("Unable to change volume label: %r") % e)
 
     def extract_iso(self):
         """ Extract self.iso to self.dest """
@@ -797,7 +797,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
                 os.kill(pid, signal.SIGHUP)
                 self.log.debug("Killed process %d" % pid)
             except OSError, e:
-                self.log.debug(str(e))
+                self.log.debug(repr(e))
 
     def verify_iso_md5(self):
         """ Verify the ISO md5sum.
@@ -852,8 +852,8 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         import parted
         try:
             disk, partition = self.get_disk_partition()
-        except LiveUSBError, e:
-            self.log.exception(e)
+        except LiveUSBError:
+            self.log.exception(_('Unable to get disk partitions'))
             return
         if partition.isFlagAvailable(parted.PARTITION_BOOT):
             if partition.getFlag(parted.PARTITION_BOOT):
@@ -994,7 +994,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             self.log.warning('extlinux not found! Only FAT filesystems will be supported')
         else:
             self.log.debug('Unknown return code from extlinux: %s' % p.returncode)
-            self.log.debug('stdout: %s\nstderr: %s' % (out, err))
+            self.log.debug('stdout: %r\nstderr: %r' % (out, err))
         return version
 
 
@@ -1011,7 +1011,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
                     try:
                         vol = win32api.GetVolumeInformation(drive)
                     except pywintypes.error, e:
-                        self.log.error(_('Unable to get GetVolumeInformation(%s): %s') % (drive, e))
+                        self.log.error(_('Unable to get GetVolumeInformation(%r): %r') % (drive, e))
                         continue
                     self.drives[drive] = {
                         'label': vol[0],
@@ -1050,7 +1050,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
                 self.log.debug("Set %s label to %s" % (self.drive['device'],
                                                        self.label))
             except pywintypes.error, e:
-                self.log.warning(_("Unable to SetVolumeLabel: ") + e)
+                self.log.warning(_("Unable to SetVolumeLabel: %r") % e)
 
     def get_free_bytes(self, device=None):
         """ Return the number of free bytes on our selected drive """
@@ -1059,7 +1059,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
         try:
             (spc, bps, fc, tc) = win32file.GetDiskFreeSpace(device)
         except Exception, e:
-            self.log.error(_("Problem determining free space: %s") % e)
+            self.log.error(_("Problem determining free space: %r") % e)
             return 0
         return fc * (spc * bps) # free-clusters * bytes per-cluster
 
@@ -1143,7 +1143,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
             self.log.debug(_("Found UUID %s for %s") % (uuid, drive))
         except Exception, e:
             self.log.exception(e)
-            self.log.warning(_("Exception while fetching UUID: %s") % e)
+            self.log.warning(_("Exception while fetching UUID: %r") % e)
         return uuid
 
     def _get_device_size(self, drive):
@@ -1154,7 +1154,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
             self.log.debug(_("Max size of %s: %d") % (drive, size))
         except Exception, e:
             self.log.exception(e)
-            self.log.warning(_("Error getting drive size: %s") % e)
+            self.log.warning(_("Error getting drive size: %r") % e)
         return size
 
     def popen(self, cmd, **kwargs):
@@ -1218,8 +1218,8 @@ class WindowsLiveUSBCreator(LiveUSBCreator):
                     proxies['ftp'] = 'ftp://%s' % server
             settings.Close()
         except Exception, e:
-            self.log.warning(_('Unable to detect proxy settings: %s') % e)
-        self.log.debug(_('Using proxies: %s') % proxies)
+            self.log.warning(_('Unable to detect proxy settings: %r') % e)
+        self.log.debug(_('Using proxies: %r') % proxies)
         return proxies
 
     def verify_iso_md5(self):
diff --git a/liveusb/gui.py b/liveusb/gui.py
index 01992ce..730c70b 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -359,7 +359,7 @@ class LiveUSBWindow(QtGui.QMainWindow, LiveUSBInterface):
                 self.downloadCombo.addItem(release)
             self.live.log.info(_('Releases updated!'))
         except Exception, e:
-            self.live.log.error(_('Unable to fetch releases: %s') % e)
+            self.live.log.error(_('Unable to fetch releases: %r') % e)
 
     def connect_slots(self):
         self.connect(self, QtCore.SIGNAL('triggered()'), self.terminate)


commit 8dfecaa1664a082c046b4ce9042e7ebcc7d4b8b9
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 26 23:38:24 2014 -0700

    Gracefully handle missing paths (#1057640)

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 8a44e80..e679900 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -779,7 +779,10 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         """ Return the number of available bytes on our device """
         import statvfs
         device = device and device or self.dest
-        stat = os.statvfs(device.encode('utf-8'))
+        device = device.encode('utf-8')
+        if not os.path.exists(device):
+            raise LiveUSBError(_('Cannot find device: %s') % device)
+        stat = os.statvfs(device)
         return stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]
 
     def _get_device(self, udi):


commit 3050a5f0b1776df47b3daeafcac4dd9fb49f5e84
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 26 23:31:24 2014 -0700

    Gracefully handle exception messages of all types (#1044309)

diff --git a/liveusb/gui.py b/liveusb/gui.py
index 3564288..01992ce 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -483,9 +483,7 @@ class LiveUSBWindow(QtGui.QMainWindow, LiveUSBInterface):
         self.progressBar.setMaximum(value)
 
     def status(self, text):
-        if isinstance(text, Exception):
-            text = text.args[0]
-        elif isinstance(text, int):
+        if not isinstance(text, basestring):
             text = str(text)
         self.textEdit.append(text)
 


commit 0e226d98a7cc67dfa8fed7686f20db4e97e24796
Author: Luke Macken <lmacken at redhat.com>
Date:   Wed Nov 26 23:13:23 2014 -0700

    Use polkit (pkexec) instead of consolehelper, thanks to Gene Czarcinski (#1145813)

diff --git a/MANIFEST.in b/MANIFEST.in
index b6a00fe..7487d65 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,8 +3,8 @@ include Makefile
 include LICENSE.txt
 include liveusb-creator
 include setup.py
-include liveusb-creator.console
-include liveusb-creator.pam
+include org.fedoraproject.pkexec.run-liveusb-creator.policy
+include liveusb-creator_polkit
 include liveusb-creator.spec
 
 graft liveusb
diff --git a/data/liveusb-creator.desktop b/data/liveusb-creator.desktop
index 5a07de9..2fb795b 100644
--- a/data/liveusb-creator.desktop
+++ b/data/liveusb-creator.desktop
@@ -4,7 +4,7 @@ Encoding=UTF-8
 Name=Fedora LiveUSB Creator
 Comment=Write Fedora images to a USB device
 Icon=fedorausb
-Exec=liveusb-creator
+Exec=liveusb-creator_polkit
 Terminal=false
 Categories=System;
 StartupNotify=true
diff --git a/liveusb-creator.console b/liveusb-creator.console
deleted file mode 100644
index 52b46e0..0000000
--- a/liveusb-creator.console
+++ /dev/null
@@ -1,5 +0,0 @@
-USER=root
-PROGRAM=/usr/sbin/liveusb-creator
-SESSION=true
-FALLBACK=true
-
diff --git a/liveusb-creator.pam b/liveusb-creator.pam
deleted file mode 100644
index df41b4c..0000000
--- a/liveusb-creator.pam
+++ /dev/null
@@ -1,5 +0,0 @@
-#%PAM-1.0
-auth            include         config-util
-account         include         config-util
-session         include         config-util
-
diff --git a/liveusb-creator.spec b/liveusb-creator.spec
index 479d88d..912ce88 100644
--- a/liveusb-creator.spec
+++ b/liveusb-creator.spec
@@ -8,7 +8,7 @@
 
 Name:           liveusb-creator
 Version:        3.13.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A liveusb creator
 
 Group:          Applications/System
@@ -23,13 +23,16 @@ ExcludeArch:    ppc64
 ExcludeArch:    %{arm}
 
 BuildRequires:  python-devel, python-setuptools, PyQt4-devel, desktop-file-utils gettext
-Requires:       syslinux, PyQt4, usermode, isomd5sum
+
+Requires:       syslinux
+Requires:       PyQt4
+Requires:       isomd5sum
 Requires:       python-urlgrabber
 Requires:       pyparted >= 2.0
 Requires:       syslinux-extlinux
 Requires:       udisks
-# https://bugzilla.redhat.com/show_bug.cgi?id=976415
-Requires:       usermode-gtk
+Requires:       polkit
+Requires:       polkit-gnome
 
 %description
 A liveusb creator from Live Fedora images
@@ -46,14 +49,18 @@ rm -rf %{buildroot}
 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
 %{__rm} -r liveusb/urlgrabber
 
-# Adjust for console-helper magic
+# program needs root, move to sbin
 mkdir -p %{buildroot}%{_sbindir}
 mv %{buildroot}%{_bindir}/%{name} %{buildroot}%{_sbindir}/%{name}
-ln -s ../bin/consolehelper %{buildroot}%{_bindir}/%{name}
-mkdir -p %{buildroot}%{_sysconfdir}/pam.d
-cp %{name}.pam %{buildroot}%{_sysconfdir}/pam.d/%{name}
-mkdir -p %{buildroot}%{_sysconfdir}/security/console.apps
-cp %{name}.console %{buildroot}%{_sysconfdir}/security/console.apps/%{name}
+
+# polkit stuff
+mkdir -p %{buildroot}%{_datadir}/polkit-1/actions
+%{__install} -p -m644 \
+	org.fedoraproject.pkexec.run-liveusb-creator.policy \
+	%{buildroot}%{_datadir}/polkit-1/actions/
+%{__install} -p -m755 \
+	liveusb-creator_polkit \
+	%{buildroot}%{_bindir}/
 
 desktop-file-install \
 %if %{with_desktop_vendor_tag}
@@ -74,16 +81,18 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %doc README.rst LICENSE.txt
 %{python_sitelib}/*
-%{_bindir}/%{name}
-%{_sbindir}/%{name}
+%{_bindir}/*
+%{_sbindir}/*
 %{_datadir}/applications/*liveusb-creator.desktop
 %{_datadir}/pixmaps/fedorausb.png
 %{_datadir}/appdata/%{name}.appdata.xml
 #%{_datadir}/locale/*/LC_MESSAGES/liveusb-creator.mo
-%config(noreplace) %{_sysconfdir}/pam.d/%{name}
-%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}
+%{_datadir}/polkit-1/actions/org.fedoraproject.pkexec.run-liveusb-creator.policy
 
 %changelog
+* Thu Nov 27 2014 Gene Czarcinski <gczarcinski at gmail.com> 3.13.0-2
+- convert to using polkit (pkexec) instead of consolehelper
+
 * Wed Nov 26 2014 Luke Macken <lmacken at redhat.com> - 3.13.0-1
 - Latest upstream release with bug fixes and interface improvements.
 
diff --git a/liveusb-creator_polkit b/liveusb-creator_polkit
new file mode 100644
index 0000000..acaa5e0
--- /dev/null
+++ b/liveusb-creator_polkit
@@ -0,0 +1,6 @@
+#!/bin/bash
+if [ $(which pkexec) ]; then
+    pkexec --disable-internal-agent "/usr/sbin/liveusb-creator" "$@"
+else
+    /usr/sbin/liveusb-creator "$@"
+fi
diff --git a/org.fedoraproject.pkexec.run-liveusb-creator.policy b/org.fedoraproject.pkexec.run-liveusb-creator.policy
new file mode 100644
index 0000000..4796a86
--- /dev/null
+++ b/org.fedoraproject.pkexec.run-liveusb-creator.policy
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+  <action id="org.fedoraproject.pkexec.run-liveusb-creator">
+    <description>Run the liveusb-creator program</description>
+    <message>Authentication is required to run the liveusb-creator</message>
+    <defaults>
+      <allow_any>auth_admin</allow_any>
+      <allow_inactive>auth_admin</allow_inactive>
+      <allow_active>auth_admin</allow_active>
+    </defaults>
+    <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/liveusb-creator</annotate>
+    <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+  </action>
+
+</policyconfig>




More information about the liveusb-creator mailing list