10 commits - data/fedorausb.png liveusb-creator liveusb/creator.py liveusb-creator.spec README.rst setup.py

Luke Macken lmacken at fedoraproject.org
Fri May 22 18:45:05 UTC 2015


 README.rst           |    2 
 data/fedorausb.png   |binary
 liveusb-creator      |    2 
 liveusb-creator.spec |    7 +
 liveusb/creator.py   |  218 +++++++++++++++++++++++++++------------------------
 setup.py             |    2 
 6 files changed, 127 insertions(+), 104 deletions(-)

New commits:
commit 2b3ba8fc6d302610a328c932a5433e8e238ff5db
Merge: b0107b6 23f0907
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri May 22 12:41:28 2015 -0600

    Merge branch 'release/3.14.0'



commit 23f0907bf8f6c6a94e5d4658ab4444320f687dac
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri May 22 12:31:52 2015 -0600

    3.14.0

diff --git a/liveusb-creator b/liveusb-creator
index ccac468..00b6e15 100755
--- a/liveusb-creator
+++ b/liveusb-creator
@@ -23,7 +23,7 @@ import sys
 
 from liveusb import _
 
-__version__ = '3.13.3'
+__version__ = '3.14.0'
 
 def parse_args():
     from optparse import OptionParser
diff --git a/liveusb-creator.spec b/liveusb-creator.spec
index b58e288..554f4dc 100644
--- a/liveusb-creator.spec
+++ b/liveusb-creator.spec
@@ -7,7 +7,7 @@
 %endif
 
 Name:           liveusb-creator
-Version:        3.13.3
+Version:        3.14.0
 Release:        1%{?dist}
 Summary:        A liveusb creator
 
@@ -90,7 +90,7 @@ rm -rf %{buildroot}
 %{_datadir}/polkit-1/actions/org.fedoraproject.pkexec.run-liveusb-creator.policy
 
 %changelog
-* Fri May 22 2015 Luke Macken <lmacken at redhat.com>
+* Fri May 22 2015 Luke Macken <lmacken at redhat.com> - 3.14.0-1
 - Require udisks2
 
 * Thu Nov 27 2014 Luke Macken <lmacken at redhat.com> - 3.13.1-1
diff --git a/setup.py b/setup.py
index 8ea643c..ae88ace 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from distutils.core import setup
 import sys, os
 
-VERSION = '3.13.3'
+VERSION = '3.14.0'
 
 LOCALE_DIR= '/usr/share/locale'
 


commit 52b548e0922559ad955756fd8492ea358efbf145
Merge: 1bc9210 d55c003
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri May 22 12:30:03 2015 -0600

    Merge branch 'feature/udisks2' into develop



commit d55c003dfe57a4a43bac30a9a9a50068c250ce36
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri May 22 12:29:53 2015 -0600

    rpm: Require udisks2

diff --git a/liveusb-creator.spec b/liveusb-creator.spec
index b71ddc4..b58e288 100644
--- a/liveusb-creator.spec
+++ b/liveusb-creator.spec
@@ -30,7 +30,7 @@ Requires:       isomd5sum
 Requires:       python-urlgrabber
 Requires:       pyparted >= 2.0
 Requires:       syslinux-extlinux
-Requires:       udisks
+Requires:       udisks2
 Requires:       polkit
 Requires:       polkit-gnome
 
@@ -90,6 +90,9 @@ rm -rf %{buildroot}
 %{_datadir}/polkit-1/actions/org.fedoraproject.pkexec.run-liveusb-creator.policy
 
 %changelog
+* Fri May 22 2015 Luke Macken <lmacken at redhat.com>
+- Require udisks2
+
 * Thu Nov 27 2014 Luke Macken <lmacken at redhat.com> - 3.13.1-1
 - Latest upstream release
 


commit 667a54bf2ee167a8f907e2e06324cf5f79247ba2
Author: Martin Briza <mbriza at redhat.com>
Date:   Fri May 22 15:23:02 2015 +0200

    Determine the parent of the drive too and get better information on portability

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 3640c08..9c562bb 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -515,14 +515,17 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
 
         for name, device in self.udisks.GetManagedObjects().iteritems():
             if ('org.freedesktop.UDisks2.Block' in device and
-                'org.freedesktop.UDisks2.Filesystem' in device):
+                'org.freedesktop.UDisks2.Filesystem' in device and
+                'org.freedesktop.UDisks2.Partition' in device):
                 self.log.debug('Found block device with filesystem on %s' % name)
             else:
                 continue
 
+            partition = device['org.freedesktop.UDisks2.Partition']
             fs = device['org.freedesktop.UDisks2.Filesystem']
             blk = device['org.freedesktop.UDisks2.Block']
 
+            """
             if blk['HintAuto'] is False:
                 self.log.debug('Skipping non-automounting filesystem: %s' % name)
                 continue
@@ -538,10 +541,22 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             if blk['HintIgnore'] is True:
                 self.log.debug('Skipping ignorable device: %s' % name)
                 continue
+            """
             if blk['Drive'] == '/':
                 self.log.debug('Skipping root drive: %s' % name)
                 continue
 
+            drive_obj = self.bus.get_object("org.freedesktop.UDisks2", blk['Drive'])
+            drive = dbus.Interface(drive_obj, "org.freedesktop.DBus.Properties").GetAll("org.freedesktop.UDisks2.Drive")
+
+            # this is probably the only check we need, including Drive != "/"
+            if (not drive[u'Removable'] or
+                drive[u'Optical'] or
+                    (drive[u'ConnectionBus'] != 'usb' and
+                     drive[u'ConnectionBus'] != 'sdio')):
+                self.log.debug('Skipping a device that is not removable, connected via USB or is optical: %s' % name)
+                continue
+
             data = {
                 'udi': str(blk['Drive']),
                 'label': str(blk['IdLabel']),
@@ -582,6 +597,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             data['free'] = mount and \
                     self.get_free_bytes(mount) / 1024**2 or None
 
+            print(partition[u'Table'])
+            parent_obj = self.bus.get_object("org.freedesktop.UDisks2", partition[u'Table'])
+            parent = dbus.Interface(parent_obj, "org.freedesktop.DBus.Properties").Get("org.freedesktop.UDisks2.Block", "Device")
+            data['parent'] = strify(parent)
+
             self.log.debug(pformat(data))
 
             self.drives[data['device']] = data


commit 56feb46304f197c258e8a93c97aa8a2ef71dd482
Author: Luke Macken <lmacken at redhat.com>
Date:   Tue May 19 09:22:23 2015 -0400

    udisks2: Try isolating devices with the HintAuto flag

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 4ebd89b..3640c08 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -523,6 +523,9 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             fs = device['org.freedesktop.UDisks2.Filesystem']
             blk = device['org.freedesktop.UDisks2.Block']
 
+            if blk['HintAuto'] is False:
+                self.log.debug('Skipping non-automounting filesystem: %s' % name)
+                continue
             if blk['HintSystem'] is True:
                 self.log.debug('Skipping system filesystem: %s' % name)
                 continue


commit 93e8d757dd1b198c0d81254aaecc74c57001a607
Author: Luke Macken <lmacken at redhat.com>
Date:   Sat May 16 06:39:00 2015 -0500

    Port to UDisks2
    
    https://fedorahosted.org/liveusb-creator/ticket/816

diff --git a/liveusb/creator.py b/liveusb/creator.py
index c031a12..4ebd89b 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -489,8 +489,7 @@ class LiveUSBCreator(object):
 class LinuxLiveUSBCreator(LiveUSBCreator):
 
     bus = None # the dbus.SystemBus
-    hal = None # the org.freedesktop.Hal.Manager dbus.Interface
-    udisks = None # the org.freedesktop.UDisks dbus.Interface
+    udisks = None # the org.freedesktop.UDisks2 dbus.Interface
 
     def __init__(self, *args, **kw):
         super(LinuxLiveUSBCreator, self).__init__(*args, **kw)
@@ -503,92 +502,94 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             self.valid_fstypes -= set(['ext4'])
 
     def detect_removable_drives(self, callback=None):
-        """ Detect all removable USB storage devices using UDisks via D-Bus """
+        """ Detect all removable USB storage devices using UDisks2 via D-Bus """
         import dbus
         self.drives = {}
         self.bus = dbus.SystemBus()
-        udisks_obj = self.bus.get_object("org.freedesktop.UDisks",
-                                         "/org/freedesktop/UDisks")
-        self.udisks = dbus.Interface(udisks_obj, "org.freedesktop.UDisks")
-
-        def handle_reply(devices):
-            for device in devices:
-                dev_obj = self.bus.get_object("org.freedesktop.UDisks", device)
-                dev = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties")
-
-                data = {
-                    'udi': str(device),
-                    'is_optical': bool(dev.Get(device, 'DeviceIsOpticalDisc')),
-                    'label': unicode(dev.Get(device, 'IdLabel')).replace(' ', '_'),
-                    'fstype': str(dev.Get(device, 'IdType')),
-                    'fsversion': str(dev.Get(device, 'IdVersion')),
-                    'uuid': str(dev.Get(device, 'IdUuid')),
-                    'device': str(dev.Get(device, 'DeviceFile')),
-                    'mount': map(unicode, list(dev.Get(device, 'DeviceMountPaths'))),
-                    'bootable': 'boot' in map(str,
-                        list(dev.Get(device, 'PartitionFlags'))),
-                    'parent': None,
-                    'size': int(dev.Get(device, 'DeviceSize')),
-                }
-
-                # Only pay attention to USB devices, unless --force'd
-                iface = str(dev.Get(device, 'DriveConnectionInterface'))
-                if iface != 'usb' and self.opts.force != data['device']:
-                    self.log.warning('Skipping non-usb drive: %s' % device)
-                    continue
-
-                # Skip optical drives
-                if data['is_optical'] and self.opts.force != data['device']:
-                    self.log.debug('Skipping optical device: %s' % data['device'])
-                    continue
-
-                # Skip things without a size
-                if not data['size'] and not self.opts.force:
-                    self.log.debug('Skipping device without size: %s' % device)
-                    continue
-
-                # Skip devices with unknown filesystems
-                if data['fstype'] not in self.valid_fstypes and \
-                        self.opts.force != data['device']:
-                    self.log.debug('Skipping %s with unknown filesystem: %s' % (
-                        data['device'], data['fstype']))
-                    continue
-
-                parent = dev.Get(device, 'PartitionSlave')
-                if parent and parent != '/':
-                    data['parent'] = str(dbus.Interface(self._get_device(parent),
-                            'org.freedesktop.DBus.Properties').Get(parent,
-                                'DeviceFile'))
-
-                mount = data['mount']
-                if mount:
-                    if len(mount) > 1:
-                        self.log.warning('Multiple mount points for %s' %
-                                data['device'])
-                    mount = data['mount'] = data['mount'][0]
-                else:
-                    mount = data['mount'] = None
+        udisks_obj = self.bus.get_object("org.freedesktop.UDisks2",
+                                         "/org/freedesktop/UDisks2")
+        self.udisks = dbus.Interface(udisks_obj, 'org.freedesktop.DBus.ObjectManager')
 
-                data['free'] = mount and \
-                        self.get_free_bytes(mount) / 1024**2 or None
+        def strify(s):
+            return bytearray(s).replace(b'\x00', b'').decode('utf-8')
 
-                self.log.debug(pformat(data))
+        for name, device in self.udisks.GetManagedObjects().iteritems():
+            if ('org.freedesktop.UDisks2.Block' in device and
+                'org.freedesktop.UDisks2.Filesystem' in device):
+                self.log.debug('Found block device with filesystem on %s' % name)
+            else:
+                continue
+
+            fs = device['org.freedesktop.UDisks2.Filesystem']
+            blk = device['org.freedesktop.UDisks2.Block']
+
+            if blk['HintSystem'] is True:
+                self.log.debug('Skipping system filesystem: %s' % name)
+                continue
+            if blk['ReadOnly'] is True:
+                self.log.debug('Skipping read-only filesystem: %s' % name)
+                continue
+            if blk['IdUsage'] != 'filesystem':
+                self.log.debug('Skipping non-filesystem device: %s' % name)
+                continue
+            if blk['HintIgnore'] is True:
+                self.log.debug('Skipping ignorable device: %s' % name)
+                continue
+            if blk['Drive'] == '/':
+                self.log.debug('Skipping root drive: %s' % name)
+                continue
+
+            data = {
+                'udi': str(blk['Drive']),
+                'label': str(blk['IdLabel']),
+                'fstype': str(blk['IdType']),
+                'fsversion': str(blk['IdVersion']),
+                'uuid': str(blk['IdUUID']),
+                'device': strify(blk['Device']),
+                'mount': map(strify, fs['MountPoints']),
+                'size': int(blk['Size']),
+            }
+            self.log.debug('data = %r' % data)
+
+            if '/boot' in data['mount']:
+                self.log.debug('Skipping boot device: %s' % name)
+                continue
+
+            # Skip things without a size
+            if not data['size'] and not self.opts.force:
+                self.log.debug('Skipping device without size: %s' % device)
+                continue
+
+            # Skip devices with unknown filesystems
+            if data['fstype'] not in self.valid_fstypes and \
+                    self.opts.force != data['device']:
+                self.log.debug('Skipping %s with unknown filesystem: %s' % (
+                    data['device'], data['fstype']))
+                continue
+
+            mount = data['mount']
+            if mount:
+                if len(mount) > 1:
+                    self.log.warning('Multiple mount points for %s' %
+                            data['device'])
+                mount = data['mount'] = data['mount'][0]
+            else:
+                mount = data['mount'] = None
 
-                self.drives[data['device']] = data
+            data['free'] = mount and \
+                    self.get_free_bytes(mount) / 1024**2 or None
 
-            # Remove parent drives if a valid partition exists
-            for parent in [d['parent'] for d in self.drives.values()]:
-                if parent in self.drives:
-                    del(self.drives[parent])
+            self.log.debug(pformat(data))
 
-            if callback:
-                callback()
+            self.drives[data['device']] = data
 
-        def handle_error(error):
-            self.log.error(str(error))
+        # Remove parent drives if a valid partition exists
+        #for parent in [d['parent'] for d in self.drives.values()]:
+        #    if parent in self.drives:
+        #        del(self.drives[parent])
 
-        self.udisks.EnumerateDevices(reply_handler=handle_reply,
-                                     error_handler=handle_error)
+        if callback:
+            callback()
 
     def _storage_bus(self, dev):
         storage_bus = None
@@ -633,32 +634,26 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             raise LiveUSBError(_("Unsupported filesystem: %s") %
                                  self.fstype)
         self.dest = self.drive['mount']
+        mnt = None
         if not self.dest:
             try:
-                self.log.debug("Calling %s.Mount('', %s, [], ...)" % (
-                               self.drive['udi'], self.fstype))
-                dev = self._get_device(self.drive['udi'])
-                dev.FilesystemMount('', [],
-                        dbus_interface='org.freedesktop.UDisks.Device')
+                dev = self._get_device_fs(self.drive['udi'])
+                self.log.debug("Mounting %s" % self.drive['device'])
+                bd = self.bus.get_object('org.freedesktop.UDisks2',
+                                   '/org/freedesktop/UDisks2/block_devices%s' %
+                                   self.drive['device'][4:])
+                mnt = str(bd.Mount({}, dbus_interface='org.freedesktop.UDisks2.Filesystem'))
             except dbus.exceptions.DBusException, e:
-                if e.get_dbus_name() == \
-                        'org.freedesktop.Hal.Device.Volume.AlreadyMounted':
-                    self.log.debug(_('Device already mounted'))
-                else:
-                    self.log.error(_('Unknown dbus exception while trying to '
-                                     'mount device: %s') % str(e))
+                self.log.error(_('Unknown dbus exception while trying to '
+                                 'mount device: %s') % str(e))
             except Exception, e:
                 raise LiveUSBError(_("Unable to mount device: %r" % e))
 
-            # Get the new mount point
-            udi = self.drive['udi']
-            dev_obj = self.bus.get_object("org.freedesktop.UDisks", udi)
-            dev = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties")
-            mounts = map(unicode, list(dev.Get(udi, 'DeviceMountPaths')))
-            if not mounts:
+            if not os.path.exists(mnt):
                 self.log.error(_('No mount points found after mounting attempt'))
+                self.log.error("%s doesn't exist" % mnt)
             else:
-                self.dest = self.drive['mount'] = mounts[0]
+                self.dest = self.drive['mount'] = mnt
                 self.drive['free'] = self.get_free_bytes(self.dest) / 1024**2
                 self.log.debug("Mounted %s to %s " % (self.drive['device'],
                                                       self.dest))
@@ -787,11 +782,11 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         stat = os.statvfs(device)
         return stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]
 
-    def _get_device(self, udi):
+    def _get_device_fs(self, udi):
         """ Return a dbus Interface to a specific UDisks device UDI """
         import dbus
-        dev_obj = self.bus.get_object("org.freedesktop.UDisks", udi)
-        return dbus.Interface(dev_obj, "org.freedesktop.UDisks.Device")
+        dev_obj = self.bus.get_object("org.freedesktop.UDisks2", udi)
+        return dbus.Interface(dev_obj, "org.freedesktop.UDisks2.Filesystem")
 
     def terminate(self):
         for pid in self.pids:


commit 1bc9210577cdb1e544768effad1c273b222cb02b
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri May 8 09:49:01 2015 -0600

    docs: The logo is licensed under CC-BY-SA 4.0
    
    Per the original author, Kushal Das.
    
    11:32  lmacken> kushal: you made this, right?
    https://fedoraproject.org/wiki/Archive:Artwork/DesignService/Archive?rd=Artwork/DesignService/Archive#Fedora_LiveUSB
                    -- debian folks are asking me about the license of the art
    11:34 <      kushal> | CC share alike
    11:34  lmacken> kushal: cool, CC-BY-SA 3.0?
    11:34  lmacken> https://creativecommons.org/licenses/by-sa/3.0/
    11:34  kushal> lmacken, you can choose one for me :)
    11:35  kushal> lmacken, I am ok with your choice :)
    11:35  lmacken> okay, I'll do the latest

diff --git a/README.rst b/README.rst
index 548704c..dd83b17 100644
--- a/README.rst
+++ b/README.rst
@@ -22,6 +22,8 @@ License
 
 The liveusb-creator is licensed under the GPLv2.
 
+The liveusb-creator logo is licensed under the `CC-BY-SA 4.0 <https://creativecommons.org/licenses/by-sa/4.0/>`_ license.
+
 This tool is distributed with the following open source software::
 
    Python


commit 97097c89c60f26a52a3e58c64eaf1aba3137cdf4
Author: Luke Macken <lmacken at redhat.com>
Date:   Thu Mar 19 11:52:44 2015 -0600

    Fix the dimensions of the desktop icon (issue #17)

diff --git a/data/fedorausb.png b/data/fedorausb.png
index fe02c84..496707f 100644
Binary files a/data/fedorausb.png and b/data/fedorausb.png differ


commit b6a608af7ea7eb090469d3605b6f8e4a9716dfd4
Merge: 5585fac 9a07f7d
Author: Luke Macken <lmacken at redhat.com>
Date:   Fri Mar 6 10:52:41 2015 -0700

    Merge branch 'release/3.13.3' into develop





More information about the liveusb-creator mailing list