Files
linux-kernel-module-cheat/release-zip
Ciro Santilli 六四事件 法轮功 635e5e3133 build-baremetal: enable parallel build and target selection just like build-userland
The factoring out also led to some small bugs being found and solved ;-)
2019-05-17 00:00:00 +00:00

40 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import zipfile
import common
class Main(common.LkmcCliFunction):
def __init__(self):
super().__init__(
description='''\
https://github.com/cirosantilli/linux-kernel-module-cheat#release-zip
''',
defaults = {
'show_time': False,
}
)
self.zip_files = []
def timed_main(self):
self.zip_files.append(self.env['qcow2_file'])
self.zip_files.append(self.env['linux_image'])
for root, dirnames, filenames in os.walk(self.env['baremetal_build_dir']):
for filename in sorted(filenames):
path = os.path.join(root, filename)
if os.path.splitext(path)[1] == self.env['baremetal_executable_ext']:
self.zip_files.append(path)
def teardown(self):
os.makedirs(self.env['release_dir'], exist_ok=True)
self.sh.rmrf(self.env['release_zip_file'])
self.log_info('Creating zip: ' + self.env['release_zip_file'])
with zipfile.ZipFile(self.env['release_zip_file'], 'w', zipfile.ZIP_DEFLATED) as zipf:
for zip_file in self.zip_files:
self.log_info('Adding file: ' + zip_file)
zipf.write(zip_file, arcname=os.path.relpath(zip_file, self.env['root_dir']))
if __name__ == '__main__':
Main().cli()