1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 14:56:14 +01:00

Export a real name for vc to consume

This commit is contained in:
Neal Gompa 2018-07-25 10:19:50 -04:00
parent bc57f89e9e
commit ef13d67208
2 changed files with 31 additions and 7 deletions

View File

@ -8787,18 +8787,40 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
apiurl = self.get_api_url()
# set user's email if the mailaddr env variable is not set
if 'mailaddr' in os.environ:
# set user's full name and email if the realname and mailaddr env variables are not set
vc_id_missing = { 'realname': False, 'email': False }
if 'VC_REALNAME' in os.environ:
pass
elif 'realname' in conf.config['api_host_options'][apiurl]:
os.environ['VC_REALNAME'] = conf.config['api_host_options'][apiurl]['realname']
else:
vc_id_missing['realname'] = True
if 'VC_MAILADDR' in os.environ or 'mailaddr' in os.environ:
pass
elif 'email' in conf.config['api_host_options'][apiurl]:
os.environ['VC_MAILADDR'] = conf.config['api_host_options'][apiurl]['email']
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
else:
vc_id_missing['email'] = True
if True in list(vc_id_missing.values()):
user = conf.get_apiurl_usr(apiurl)
data = get_user_data(apiurl, user, 'email')
data = get_user_data(apiurl, user, 'realname', 'email')
if data:
os.environ['mailaddr'] = data[0]
else:
print('Try env mailaddr=...', file=sys.stderr)
if vc_id_missing['realname'] and (data[0] != "-"):
os.environ['VC_REALNAME'] = data[0]
else:
print('Try env VC_REALNAME=...', file=sys.stderr)
if vc_id_missing['email'] and (data[1] != "-"):
os.environ['VC_MAILADDR'] = data[1]
os.environ['mailaddr'] = data[1]
else:
print('Try env VC_MAILADDR=...', file=sys.stderr)
if meego_style:
if opts.message or opts.just_edit:

View File

@ -203,7 +203,7 @@ boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'tr
'status_mtime_heuristic']
integer_opts = ['build-jobs']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj']
new_conf_template = """
[general]
@ -362,6 +362,8 @@ user = %(user)s
pass = %(pass)s
# set aliases for this apiurl
# aliases = foo, bar
# real name used in .changes, unless the one from osc meta prj <user> will be used
# realname =
# email used in .changes, unless the one from osc meta prj <user> will be used
# email =
# additional headers to pass to a request, e.g. for special authentication