Add configure script support for Debian mirror options.

This commit is contained in:
Daniil Baturin 2015-12-24 16:06:34 -05:00
parent daf94a4bab
commit c0cae8b7fe
2 changed files with 13 additions and 2 deletions

View File

@ -23,7 +23,9 @@ def get_default_build_by():
options = { options = {
'architecture': ('Image target architecture (amd64 or i586)', lambda: 'amd64', lambda x: x in ['amd64', 'i586']), 'architecture': ('Image target architecture (amd64 or i586)', lambda: 'amd64', lambda x: x in ['amd64', 'i586']),
'build-by': ('Builder identifier (e.g. jrandomhacker@example.net)', get_default_build_by, None) '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)
} }
# Create the option parser # Create the option parser
@ -42,8 +44,14 @@ for k, v in args.items():
print("{v} is not a valid value for --{o} option".format(o=key, v=v)) print("{v} is not a valid value for --{o} option".format(o=key, v=v))
sys.exit(1) sys.exit(1)
# Save to file # Some fixup for mirror settings.
# The idea is: if --debian-mirror is specified but --pbuilder-debian-mirror is not,
# use the --debian-mirror value for both lb and pbuilder bootstrap
if (args['debian_mirror'] != defaults.DEBIAN_MIRROR) and \
(args['pbuilder_debian_mirror'] == defaults.DEBIAN_MIRROR):
args['pbuilder_debian_mirror'] = args['debian-mirror']
# Save to file
distutils.dir_util.mkpath(defaults.BUILD_DIR) distutils.dir_util.mkpath(defaults.BUILD_DIR)
with open(defaults.BUILD_CONFIG, 'w') as f: with open(defaults.BUILD_CONFIG, 'w') as f:

View File

@ -2,3 +2,6 @@ import os
BUILD_DIR = 'build' BUILD_DIR = 'build'
BUILD_CONFIG = os.path.join(BUILD_DIR, 'build-config.json') BUILD_CONFIG = os.path.join(BUILD_DIR, 'build-config.json')
# The default mirror was chosen entirely at random
DEBIAN_MIRROR = 'http://ftp.nl.debian.org/debian/'