5 commits - liveusb/creator.py

Luke Macken lmacken at fedoraproject.org
Mon Jun 13 19:24:11 UTC 2011


 liveusb/creator.py |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit e701dd8917e0b14f228f647ef1d88bfb95a3006b
Author: Luke Macken <lmacken at redhat.com>
Date:   Mon Jun 13 15:23:54 2011 -0400

    Make our get_mbr method handle devices without any partitions

diff --git a/liveusb/creator.py b/liveusb/creator.py
index 52390cc..2891896 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -845,7 +845,10 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         self.popen('mkfs.vfat -F 32 %s' % self._drive)
 
     def get_mbr(self):
-        parent = str(self.drive.get('parent', self._drive))
+        parent = self.drive.get('parent', self._drive)
+        if parent is None:
+            parent = self._drive
+        parent = str(parent)
         self.log.debug('Checking the MBR of %s' % parent)
         drive = open(parent, 'rb')
         mbr = ''.join(['%02X' % ord(x) for x in drive.read(2)])


commit 0338c182773d65b2f3b65dc4fb40d4fe8094efc8
Author: Luke Macken <lmacken at redhat.com>
Date:   Mon Jun 13 15:23:27 2011 -0400

    Don't attempt to mark any partitions as bootable if we're dealing with a full-device format

diff --git a/liveusb/creator.py b/liveusb/creator.py
index d2b5c49..52390cc 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -786,6 +786,10 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
 
     def bootable_partition(self):
         """ Ensure that the selected partition is flagged as bootable """
+        if self.drive.get('parent') is None:
+            self.log.debug('No partitions on device; not attempting to mark '
+                           'any paritions as bootable')
+            return
         import parted
         try:
             disk, partition = self.get_disk_partition()


commit 6fdad9340e4c0e7606a3d083c83cb6f6591d1259
Author: intrigeri <intrigeri at boum.org>
Date:   Mon Jun 13 15:11:15 2011 -0400

    Use the built-in set type that supports a difference operator.
    
    This means depending on Python 2.4 - hope this this OK.

diff --git a/liveusb/creator.py b/liveusb/creator.py
index dae51bb..d2b5c49 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -63,8 +63,8 @@ class LiveUSBCreator(object):
     _drive = None       # mountpoint of the currently selected drive
     mb_per_sec = 0      # how many megabytes per second we can write
     log = None
-    ext_fstypes = ['ext2', 'ext3', 'ext4']
-    valid_fstypes = ['vfat', 'msdos'] + ext_fstypes
+    ext_fstypes = set(['ext2', 'ext3', 'ext4'])
+    valid_fstypes = set(['vfat', 'msdos']) | ext_fstypes
 
     drive = property(fget=lambda self: self.drives[self._drive],
                      fset=lambda self, d: self._set_drive(d))
@@ -425,9 +425,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
         super(LinuxLiveUSBCreator, self).__init__(*args, **kw)
         extlinux = self.get_extlinux_version()
         if extlinux is None:
-            for type in self.ext_fstypes:
-                # FIXME: more Python-ic way of doing this
-                self.valid_fstypes.remove(type)
+            self.valid_fstypes -= self.ext_fstypes
         elif extlinux < 4:
             self.log.debug(_('You are using an old version of syslinux-extlinux '
                     'that does not support the ext4 filesystem'))


commit 43e292f881dd90530b4fd0edf73d24fdeb2d26cb
Author: intrigeri <intrigeri at boum.org>
Date:   Mon Jun 13 15:10:43 2011 -0400

    Actually support extlinux not being installed.
    
    get_extlinux_version now avoids modifying self.valid_fstypes itself, and returns
    the extlinux version. All actions involved by such and such extlinux version (or
    absence) are now done by the (only) get_extlinux_version's caller.

diff --git a/liveusb/creator.py b/liveusb/creator.py
index efd08ca..dae51bb 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -424,10 +424,13 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
     def __init__(self, *args, **kw):
         super(LinuxLiveUSBCreator, self).__init__(*args, **kw)
         extlinux = self.get_extlinux_version()
-        if extlinux < 4:
+        if extlinux is None:
+            for type in self.ext_fstypes:
+                # FIXME: more Python-ic way of doing this
+                self.valid_fstypes.remove(type)
+        elif extlinux < 4:
             self.log.debug(_('You are using an old version of syslinux-extlinux '
                     'that does not support the ext4 filesystem'))
-
             self.valid_fstypes.remove('ext4')
 
     def detect_removable_drives(self, callback=None):
@@ -924,7 +927,6 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             version = int(err.split()[1].split('.')[0])
         elif p.returncode == 127:
             self.log.warning('extlinux not found! Only FAT filesystems will be supported')
-            self.valid_fstypes.remove('ext4')
         else:
             self.log.debug('Unknown return code from extlinux: %s' % p.returncode)
             self.log.debug('stdout: %s\nstderr: %s' % (out, err))


commit 57e0253e16a1ef12a4e6f3231a1f36ddf566befd
Author: Luke Macken <lmacken at redhat.com>
Date:   Mon Jun 13 15:06:51 2011 -0400

    Revert "Fix a bug that occurs on Linux when extlinux is missing (rhbz#712722)"
    
    This reverts commit b834b70938746cb6ec4f5453ccc49e9e501104bb.

diff --git a/liveusb/creator.py b/liveusb/creator.py
index ae47802..efd08ca 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -428,8 +428,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
             self.log.debug(_('You are using an old version of syslinux-extlinux '
                     'that does not support the ext4 filesystem'))
 
-            if 'ext4' in self.valid_fstypes:
-                self.valid_fstypes.remove('ext4')
+            self.valid_fstypes.remove('ext4')
 
     def detect_removable_drives(self, callback=None):
         """ Detect all removable USB storage devices using UDisks via D-Bus """




More information about the liveusb-creator mailing list