updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / usb-creator / 0002-remove-blackcode-using-lsb-release-and-python-debian.patch
blob421256cf51a50111e8a4822676b20fc5af01feaa
1 From d3fc3577b2c4b7b373f49b1cfcae59b847648329 Mon Sep 17 00:00:00 2001
2 From: Adaptee <adaptee@gmail.com>
3 Date: Mon, 3 Jan 2011 16:31:39 +0800
4 Subject: [PATCH] remove the blackcode using lsb-release and python-debian, because archlinux can not provide such equivalent
6 ---
7 usbcreator/install.py | 60 +++++++++++-------------------------------------
8 1 files changed, 14 insertions(+), 46 deletions(-)
10 diff --git a/usbcreator/install.py b/usbcreator/install.py
11 index bfbd817..943753d 100644
12 --- a/usbcreator/install.py
13 +++ b/usbcreator/install.py
14 @@ -79,7 +79,7 @@ class install(Thread):
16 def success(self):
17 pass
20 def _success(self):
21 if self.progress_thread and self.progress_thread.is_alive():
22 logging.debug('Shutting down the progress thread.')
23 @@ -113,7 +113,7 @@ class install(Thread):
24 '''Will be called when we need to know if the user wants to try a
25 failed operation again. Must return a boolean value.'''
26 pass
29 def join(self, timeout=None):
30 self._stopevent.set()
31 Thread.join(self, timeout)
32 @@ -124,7 +124,7 @@ class install(Thread):
33 if self.progress_thread and self.progress_thread.is_alive():
34 self.progress_thread.join()
35 sys.exit(0)
38 # Exception catching wrapper.
40 def run(self):
41 @@ -150,7 +150,7 @@ class install(Thread):
42 self._failure(_('An uncaught exception was raised:\n%s') % str(e))
44 # Helpers for core routines.
47 def initialize_progress_thread(self):
48 logging.debug('initialize_progress_thread')
49 if os.path.isfile(self.source):
50 @@ -173,7 +173,7 @@ class install(Thread):
51 self.progress_thread.progress = self.progress
52 self.progress_thread.start()
53 self.check()
56 def remove_extras(self):
57 logging.debug('remove_extras')
58 '''Remove files created by usb-creator.'''
59 @@ -235,27 +235,14 @@ class install(Thread):
60 'Maybe "%s" is not an Ubuntu image?') %
61 (self.target, e, self.source))
62 self.check()
65 # Mangle the configuration files based on the options we've selected.
66 import glob
67 - import lsb_release
68 - try:
69 - from debian import debian_support
70 - except ImportError:
71 - from debian_bundle import debian_support
73 for filename in glob.iglob(os.path.join(self.target, 'syslinux', '*.cfg')):
74 if os.path.basename(filename) == 'gfxboot.cfg':
75 continue
76 f = None
77 - target_os_ver = None
78 - our_os_ver = debian_support.Version(
79 - lsb_release.get_distro_information()['RELEASE'])
81 - if os.path.exists(os.path.join(self.target, '.disk', 'info')):
82 - with open(os.path.join(self.target, '.disk', 'info'),'r') as f:
83 - contents = f.readline().split()
84 - if len(contents) > 2:
85 - target_os_ver = debian_support.Version(contents[1])
86 try:
87 f = open(filename, 'r')
88 label = ''
89 @@ -273,25 +260,6 @@ class install(Thread):
90 line.insert(1, 'cdrom-detect/try-usb=true')
91 if label not in ('memtest', 'hd'):
92 line.insert(1, 'noprompt')
93 - #OS version specific mangles
94 - #The syntax in syslinux changed with the version
95 - #shipping in Ubuntu 10.10
96 - elif (target_os_ver and our_os_ver and
97 - target_os_ver != our_os_ver):
98 - lucid = debian_support.Version('10.04')
99 - maverick = debian_support.Version('10.10')
100 - #10.10 or newer image, burning on 10.04 or lower
101 - if (command.lower() == 'ui' and
102 - our_os_ver <= lucid and
103 - target_os_ver >= maverick):
104 - line.remove('ui')
105 - #10.04 or earlier image, burning on 10.10 or higher
106 - #Currently still broke.
107 - #elif (command.lower() == 'gfxboot' and
108 - # our_os_ver >= maverick and
109 - # target_os_ver <= lucid):
110 - # line.insert(0, 'ui')
112 to_write.append(' '.join(line) + '\n')
113 f.close()
114 f = open(filename, 'w')
115 @@ -322,7 +290,7 @@ class install(Thread):
116 else:
117 # FIXME evand 2009-07-23: Need a copy of mke2fs.exe.
118 mkfs_cmd = []
121 self.progress_message(_('Creating a persistence file...'))
122 popen(dd_cmd)
123 self.check()
124 @@ -364,7 +332,7 @@ class install(Thread):
125 self.progress_message(_('Writing disk image...'))
126 failure_msg = _('Could not write the disk image (%s) to the device'
127 ' (%s).') % (self.source, self.device)
130 cmd = ['dd', 'if=%s' % str(self.source), 'of=%s' % str(self.device),
131 'bs=1M']
132 if sys.platform == 'win32':
133 @@ -400,7 +368,7 @@ class install(Thread):
134 continue
135 listing.append(line.split())
136 self.check()
139 # Clear.
141 self.progress_message(_('Removing files...'))
142 @@ -418,11 +386,11 @@ class install(Thread):
143 shutil.rmtree(t)
144 self.check()
145 self.remove_extras()
148 self.initialize_progress_thread()
150 # Copy.
153 cmd = ['7z', 'x', self.source, 'md5sum.txt', '-so']
154 md5sums = {}
155 try:
156 @@ -511,7 +479,7 @@ class install(Thread):
157 shutil.rmtree(f)
158 self.remove_extras()
159 self.check()
162 self.initialize_progress_thread()
164 self.progress_message(_('Copying files...'))
165 @@ -557,7 +525,7 @@ class install(Thread):
167 self.create_persistence()
168 self.sync()
171 def copy_file(self, sourcepath, targetpath):
172 self.check()
173 sourcefh = None
175 1.7.3.4