mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
build: make --dry-run all work
This commit is contained in:
@@ -54,7 +54,7 @@ Build crosstool-NG with Newlib for bare metal compilation
|
||||
'defconfig', LF,
|
||||
],
|
||||
)
|
||||
os.unlink(defconfig_dest)
|
||||
self.sh.rmrf(defconfig_dest)
|
||||
self.sh.run_cmd(
|
||||
[
|
||||
self.env['crosstool_ng_executable'], LF,
|
||||
|
||||
@@ -99,7 +99,7 @@ class Main(common.BuildCliFunction):
|
||||
# Otherwise self.sh.cp would fail with "Text file busy" if you
|
||||
# tried to rebuild while running m5term:
|
||||
# https://stackoverflow.com/questions/16764946/what-generates-the-text-file-busy-message-in-unix/52427512#52427512
|
||||
os.unlink(self.env['gem5_m5term'])
|
||||
self.sh.rmrf(self.env['gem5_m5term'])
|
||||
self.sh.cp(m5term_build, self.env['gem5_m5term'])
|
||||
|
||||
def get_build_dir(self):
|
||||
|
||||
@@ -721,7 +721,12 @@ Valid emulators: {}
|
||||
tried.append('{}-{}'.format(prefix, tool))
|
||||
if exists:
|
||||
return prefix
|
||||
raise Exception('Tool not found. Tried:\n' + '\n'.join(tried))
|
||||
error_message = 'Tool not found. Tried:\n' + '\n'.join(tried)
|
||||
if self.env['dry_run']:
|
||||
self.log_error(error_message)
|
||||
return ''
|
||||
else:
|
||||
raise Exception(error_message)
|
||||
|
||||
def get_toolchain_tool(self, tool, allowed_toolchains=None):
|
||||
return '{}-{}'.format(self.get_toolchain_prefix(tool, allowed_toolchains), tool)
|
||||
|
||||
@@ -14,7 +14,7 @@ from shell_helpers import LF
|
||||
def main():
|
||||
os.makedirs(self.env['release_dir'], exist_ok=True)
|
||||
if os.path.exists(self.env['release_zip_file']):
|
||||
os.unlink(self.env['release_zip_file'])
|
||||
self.sh.rmrf(self.env['release_zip_file'])
|
||||
zipf = zipfile.ZipFile(self.env['release_zip_file'], 'w', zipfile.ZIP_DEFLATED)
|
||||
for arch in self.env['all_long_archs']:
|
||||
self.setup(common.get_argparse(default_args={'arch': arch}))
|
||||
|
||||
@@ -269,11 +269,12 @@ class ShellHelpers:
|
||||
'''
|
||||
if config_fragments is None:
|
||||
config_fragments = []
|
||||
with open(config_path, 'a') as config_file:
|
||||
for config_fragment in config_fragments:
|
||||
with open(config_fragment, 'r') as config_fragment_file:
|
||||
self.print_cmd(['cat', config_fragment, '>>', config_path])
|
||||
if not self.dry_run:
|
||||
for config_fragment in config_fragments:
|
||||
self.print_cmd(['cat', config_fragment, '>>', config_path])
|
||||
if not self.dry_run:
|
||||
with open(config_path, 'a') as config_file:
|
||||
for config_fragment in config_fragments:
|
||||
with open(config_fragment, 'r') as config_fragment_file:
|
||||
for line in config_fragment_file:
|
||||
config_file.write(line)
|
||||
self.write_string_to_file(config_path, '\n'.join(configs), mode='a')
|
||||
|
||||
Reference in New Issue
Block a user