summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-01-26 15:41:47 -0500
committerDaniil Baturin <daniil@baturin.org>2016-01-26 15:41:47 -0500
commitb0c41b26b9435a3a834bee7cc16a1ae1cb03a5fa (patch)
tree619a34b7ecf608b2e852eff431e329ffdad33f8a /scripts
parent38a250d62763a85e41cfe57b120ab380ad42fa55 (diff)
downloadvyos-build-b0c41b26b9435a3a834bee7cc16a1ae1cb03a5fa.tar.gz
vyos-build-b0c41b26b9435a3a834bee7cc16a1ae1cb03a5fa.zip
Add support for --build-type and --version options to configure script.
Image version will now be passed in configure option. As a collateral damage, add support for options without default values.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-config17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/build-config b/scripts/build-config
index b350f692..685d79f2 100755
--- a/scripts/build-config
+++ b/scripts/build-config
@@ -50,13 +50,18 @@ options = {
'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, None),
'debian-mirror': ('Debian repository mirror for ISO build', lambda: defaults.DEBIAN_MIRROR, None),
'pbuilder-debian-mirror': ('Debian repository mirror for pbuilder env bootstrap', lambda: defaults.DEBIAN_MIRROR, None),
- 'build-type': ('Build type, release or development', lambda: 'development', lambda x: x in ['release', 'development'])
+ 'build-type': ('Build type, release or development', lambda: 'development', lambda x: x in ['release', 'development']),
+ 'version': ('Version number (release builds only)', None, None)
}
# Create the option parser
parser = argparse.ArgumentParser()
for k, v in options.items():
- parser.add_argument('--' + k, type=str, help=v[0], default=v[1]())
+ help_string, default_value_thunk = v[0], v[1]
+ if default_value_thunk is None:
+ parser.add_argument('--' + k, type=str, help=help_string)
+ else:
+ parser.add_argument('--' + k, type=str, help=help_string, default=default_value_thunk())
args = vars(parser.parse_args())
@@ -76,6 +81,14 @@ if (args['debian_mirror'] != defaults.DEBIAN_MIRROR) and \
(args['pbuilder_debian_mirror'] == defaults.DEBIAN_MIRROR):
args['pbuilder_debian_mirror'] = args['debian-mirror']
+# Version can only be set for release builds,
+# for dev builds it hardly makes any sense
+if args['build_type'] == 'development':
+ if args['version'] is not None:
+ print("Version can only be set for release builds")
+ print("Use --build-type=release option if you want to set version number")
+ sys.exit(1)
+
# Populate some defaults that are not configurable,
# but that are handy to have in the options hash
args['distribution'] = defaults.DEBIAN_DISTRIBUTION