diff options
author | Ryan Roberts <ryan.roberts@arm.com> | 2022-10-07 12:49:06 +0100 |
---|---|---|
committer | Ryan Roberts <ryan.roberts@arm.com> | 2022-11-02 14:48:39 +0000 |
commit | 5ed251f0b8caff7db2894beef3c711f29551bbfb (patch) | |
tree | 29449389df192e4e8f07a39129e0a229480dc232 /shrinkwrap/utils/config.py | |
parent | c978779fb853adedf915d69df6415403bf6e1821 (diff) |
run: Pretty print --dry-run script output.
The FVP command is usually huge, with lots of options. So print each
option on its own line and sort alphabetically.
Diffstat (limited to 'shrinkwrap/utils/config.py')
-rw-r--r-- | shrinkwrap/utils/config.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py index ad9c497..89a5293 100644 --- a/shrinkwrap/utils/config.py +++ b/shrinkwrap/utils/config.py @@ -683,6 +683,20 @@ class Script: return f'{self.config}:{self.component} {self.summary}' +def script_preamble(echo=True): + pre = Script(None) + pre.append(f'#!/bin/bash') + pre.append(f'# SHRINKWRAP AUTOGENERATED SCRIPT.') + pre.append() + if echo: + pre.append(f'# Exit on error and echo commands.') + pre.append(f'set -ex') + else: + pre.append(f'# Exit on error.') + pre.append(f'set -e') + return pre.commands(False) + + def build_graph(configs): """ Returns a graph of scripts where the edges represent dependencies. The @@ -691,13 +705,7 @@ def build_graph(configs): """ graph = {} - pre = Script(None) - pre.append(f'#!/bin/bash') - pre.append(f'# SHRINKWRAP AUTOGENERATED SCRIPT.') - pre.append() - pre.append(f'# Exit on error and echo commands.') - pre.append(f'set -ex') - pre = pre.commands(False) + pre = script_preamble() gl1 = Script('Removing old package', preamble=pre) gl1.append(f'# Remove old package.') @@ -807,13 +815,7 @@ def clean_graph(configs, clean_repo): """ graph = {} - pre = Script(None) - pre.append(f'#!/bin/bash') - pre.append(f'# SHRINKWRAP AUTOGENERATED SCRIPT.') - pre.append() - pre.append(f'# Exit on error and echo commands.') - pre.append(f'set -ex') - pre = pre.commands(False) + pre = script_preamble() gl1 = Script('Removing old package', preamble=pre) gl1.append(f'# Remove old package.') |