65
68
shutil.rmtree(self.tempdir)
67
70
def get_path(self, package_file_name, file_name=''):
68
"Get package or file path in unpacker tmp dir."
71
"""Get package or file path in unpacker tmp dir."""
69
72
package_dir = os.path.basename(package_file_name)
70
73
return os.path.join(self.tempdir, package_dir, file_name)
214
217
self.foreach_boards_and_bootloaders(
215
218
self.do_find_copy_files_packages)
216
219
packages = self.copy_files_packages
217
del(self.copy_files_packages)
220
del self.copy_files_packages
328
331
manifest_name += '.manifest.txt'
329
332
with open(manifest_name, 'w') as f:
330
333
f.write(self.hwpack.manifest_text())
335
logger.debug("Extracting build-info")
336
build_info_dir = os.path.join(fetcher.cache.tempdir,
338
build_info_available = 0
339
for deb_pkg in self.packages:
340
# Extract Build-Info attribute from debian control
341
deb_pkg_file_path = deb_pkg.filepath
343
DebFile(deb_pkg_file_path).control.debcontrol()
344
build_info = deb_control.get('Build-Info')
345
if build_info is not None:
346
build_info_available += 1
347
# Extract debian packages with build
351
env['NO_PKG_MANGLE'] = '1'
352
proc = cmd_runner.Popen(['dpkg-deb', '-x',
353
deb_pkg_file_path, build_info_dir],
354
env=env, stdout=subprocess.PIPE,
355
stderr=subprocess.PIPE)
356
(stdoutdata, stderrdata) = proc.communicate()
358
raise ValueError('dpkg-deb extract failed!'
361
raise ValueError('dpkg-deb extract had '
362
'warnings:\n%s' % stderrdata)
364
# Concatenate BUILD-INFO.txt files
365
if build_info_available > 0:
366
dst_file = open('BUILD-INFO.txt', 'wb')
368
r'%s/usr/share/doc/*/BUILD-INFO.txt' % \
370
for src_file in iglob(build_info_path):
371
with open(src_file, 'rb') as f:
372
dst_file.write('Files-Pattern: %s\n' % \
374
shutil.copyfileobj(f, dst_file)