diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-01-11 06:31:44 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-01-11 06:31:44 +0100 |
commit | 920344fe59ae3c2ec27c3c21d6588c4f05bbae88 (patch) | |
tree | 0d9f66a8c60caafbc3465041261ceb3c66801079 /scripts/build-config | |
parent | 522ebc6250d5fd007c199396cbd046dd7134de8d (diff) | |
download | vyos-build-920344fe59ae3c2ec27c3c21d6588c4f05bbae88.tar.gz vyos-build-920344fe59ae3c2ec27c3c21d6588c4f05bbae88.zip |
Add some debugging capabilities to the build scripts.
Diffstat (limited to 'scripts/build-config')
-rwxr-xr-x | scripts/build-config | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/build-config b/scripts/build-config index 56fc7a88..a18e95ee 100755 --- a/scripts/build-config +++ b/scripts/build-config @@ -43,6 +43,12 @@ def field_to_option(s): def get_default_build_by(): return "{user}@{host}".format(user= getpass.getuser(), host=platform.node()) +def get_validator(optdict, name): + try: + return optdict[name][2] + except KeyError: + return None + # Options dict format: # '$option_name_without_leading_dashes': { ('$help_string', $default_value_generator_thunk, $value_checker_thunk) } @@ -66,12 +72,15 @@ for k, v in options.items(): else: parser.add_argument('--' + k, type=str, help=help_string, default=default_value_thunk()) +# The debug option is a bit special since it's different type +parser.add_argument('--debug', help="Enable debug output", action='store_true') + args = vars(parser.parse_args()) # Validate options for k, v in args.items(): key = field_to_option(k) - func = options[key][2] + func = get_validator(options, k) if func is not None: if not func(v): print("{v} is not a valid value for --{o} option".format(o=key, v=v)) |