mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 17:36:13 +01:00
commit
0c2238435f
@ -77,7 +77,7 @@ class Buildinfo:
|
|||||||
localpkgs = localpkgs or []
|
localpkgs = localpkgs or []
|
||||||
try:
|
try:
|
||||||
tree = ET.parse(filename)
|
tree = ET.parse(filename)
|
||||||
except:
|
except ET.ParseError:
|
||||||
print('could not parse the buildinfo:', file=sys.stderr)
|
print('could not parse the buildinfo:', file=sys.stderr)
|
||||||
print(open(filename).read(), file=sys.stderr)
|
print(open(filename).read(), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -801,7 +801,7 @@ def main(apiurl, opts, argv):
|
|||||||
try:
|
try:
|
||||||
build_root = build_root % {'repo': repo, 'arch': arch,
|
build_root = build_root % {'repo': repo, 'arch': arch,
|
||||||
'project': prj, 'package': pacname, 'apihost': apihost}
|
'project': prj, 'package': pacname, 'apihost': apihost}
|
||||||
except:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# We configure sccache after pacname, so that in default cases we can have an sccache for each
|
# We configure sccache after pacname, so that in default cases we can have an sccache for each
|
||||||
|
19
osc/conf.py
19
osc/conf.py
@ -186,28 +186,29 @@ if not os.path.isfile('/usr/bin/build') and os.path.isfile('/usr/bin/obs-build')
|
|||||||
if not os.path.isfile('/usr/lib/build/vc') and os.path.isfile('/usr/lib/obs-build/vc'):
|
if not os.path.isfile('/usr/lib/build/vc') and os.path.isfile('/usr/lib/obs-build/vc'):
|
||||||
DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
|
DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
|
||||||
|
|
||||||
boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist',
|
|
||||||
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
|
||||||
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'no_verify', 'builtin_signature_check',
|
|
||||||
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
|
|
||||||
'status_mtime_heuristic', 'print_web_links', 'ccache', 'sccache', 'build-shell-after-fail']
|
|
||||||
integer_opts = ['build-jobs']
|
|
||||||
|
|
||||||
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
|
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
|
||||||
'downloadurl', 'sshkey']
|
'downloadurl', 'sshkey']
|
||||||
|
|
||||||
|
_integer_opts = ('build-jobs',)
|
||||||
|
_boolean_opts = (
|
||||||
|
'debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'traceback', 'check_filelist',
|
||||||
|
'checkout_no_colon', 'checkout_rooted', 'check_for_request_on_action', 'linkcontrol', 'show_download_progress', 'request_show_interactive',
|
||||||
|
'request_show_source_buildstatus', 'review_inherit_group', 'use_keyring', 'no_verify', 'builtin_signature_check',
|
||||||
|
'http_full_debug', 'include_request_from_project', 'local_service_run', 'buildlog_strip_time', 'no_preinstallimage',
|
||||||
|
'status_mtime_heuristic', 'print_web_links', 'ccache', 'sccache', 'build-shell-after-fail')
|
||||||
|
|
||||||
|
|
||||||
def apply_option_types(config, conffile=""):
|
def apply_option_types(config, conffile=""):
|
||||||
"""
|
"""
|
||||||
Return a copy of `config` dictionary with values converted to their expected types
|
Return a copy of `config` dictionary with values converted to their expected types
|
||||||
according to the enumerated option types (boolean_opts, integer_opts).
|
according to the enumerated option types (_boolean_opts, _integer_opts).
|
||||||
"""
|
"""
|
||||||
config = config.copy()
|
config = config.copy()
|
||||||
|
|
||||||
cp = OscConfigParser.OscConfigParser(config)
|
cp = OscConfigParser.OscConfigParser(config)
|
||||||
cp.add_section("general")
|
cp.add_section("general")
|
||||||
|
|
||||||
typed_opts = ((boolean_opts, cp.getboolean), (integer_opts, cp.getint))
|
typed_opts = ((_boolean_opts, cp.getboolean), (_integer_opts, cp.getint))
|
||||||
for opts, meth in typed_opts:
|
for opts, meth in typed_opts:
|
||||||
for opt in opts:
|
for opt in opts:
|
||||||
try:
|
try:
|
||||||
|
@ -14,29 +14,25 @@ class TestConf(unittest.TestCase):
|
|||||||
importlib.reload(osc.conf)
|
importlib.reload(osc.conf)
|
||||||
|
|
||||||
def test_bool_opts_defaults(self):
|
def test_bool_opts_defaults(self):
|
||||||
opts = osc.conf.boolean_opts
|
|
||||||
config = osc.conf.config
|
config = osc.conf.config
|
||||||
for opt in opts:
|
for opt in osc.conf._boolean_opts:
|
||||||
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
||||||
|
|
||||||
def test_int_opts_defaults(self):
|
def test_int_opts_defaults(self):
|
||||||
opts = osc.conf.integer_opts
|
|
||||||
config = osc.conf.config
|
config = osc.conf.config
|
||||||
for opt in opts:
|
for opt in osc.conf._integer_opts:
|
||||||
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
||||||
|
|
||||||
def test_bool_opts(self):
|
def test_bool_opts(self):
|
||||||
osc.conf.get_config()
|
osc.conf.get_config()
|
||||||
opts = osc.conf.boolean_opts
|
|
||||||
config = osc.conf.config
|
config = osc.conf.config
|
||||||
for opt in opts:
|
for opt in osc.conf._boolean_opts:
|
||||||
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
self.assertIsInstance(config[opt], bool, msg=f"option: '{opt}'")
|
||||||
|
|
||||||
def test_int_opts(self):
|
def test_int_opts(self):
|
||||||
osc.conf.get_config()
|
osc.conf.get_config()
|
||||||
opts = osc.conf.integer_opts
|
|
||||||
config = osc.conf.config
|
config = osc.conf.config
|
||||||
for opt in opts:
|
for opt in osc.conf._integer_opts:
|
||||||
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
self.assertIsInstance(config[opt], int, msg=f"option: '{opt}'")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user