mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 09:56:13 +01:00
osc vc command - uses a /usr/bin/buildvc from build.rpm
This commit is contained in:
parent
8b1882e7a9
commit
0bf3540cb2
@ -2727,6 +2727,70 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
for data in streamfile(u):
|
||||
sys.stdout.write(data)
|
||||
|
||||
@cmdln.option('-m', '--message',
|
||||
help='Change message')
|
||||
def do_vc(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Edit the changes file
|
||||
|
||||
osc vc [filename[.changes]|path [file_with_comment]]
|
||||
If no <filename> is given, exactly one *.changes or *.spec file has to
|
||||
be in the cwd or in path.
|
||||
|
||||
The email adress used in .changes file is read from BuildService
|
||||
instance, or should be defined in ~/.oscrc
|
||||
[https://api.opensuse.org/]
|
||||
user = login
|
||||
pass = password
|
||||
email = user@defined.email
|
||||
|
||||
or can be specified via mailaddr environment variable.
|
||||
|
||||
${cmd_usage}
|
||||
${cmd_option_list}
|
||||
"""
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
if not os.path.exists('/usr/bin/buildvc'):
|
||||
print >>sys.stderr, 'Error: you need build.rpm with version 2009.04.17 or newer'
|
||||
print >>sys.stderr, 'See http://download.opensuse.org/repositories/openSUSE:/Tools/'
|
||||
return 1
|
||||
|
||||
cmd_list = ["/usr/bin/buildvc", ]
|
||||
|
||||
if len(args) > 0:
|
||||
arg = args[0]
|
||||
else:
|
||||
arg = ""
|
||||
|
||||
# set user's email if no mailaddr exists
|
||||
if not os.environ.has_key('mailaddr'):
|
||||
|
||||
if arg and is_package_dir(arg):
|
||||
apiurl = store_read_apiurl(arg)
|
||||
elif is_package_dir(os.getcwd()):
|
||||
apiurl = store_read_apiurl(os.getcwd())
|
||||
else:
|
||||
apiurl = conf.config['apiurl']
|
||||
|
||||
user = conf.config['user']
|
||||
|
||||
if conf.config['api_host_options'][apiurl].has_key('email'):
|
||||
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
||||
else:
|
||||
os.environ['mailaddr'] = get_user_data(apiurl, user, 'email')[0]
|
||||
|
||||
if opts.message:
|
||||
cmd_list.append("-m")
|
||||
cmd_list.append("'%s'" % opts.message)
|
||||
|
||||
if arg:
|
||||
cmd_list.append(arg)
|
||||
|
||||
vc = Popen(cmd_list)
|
||||
vc.wait()
|
||||
sys.exit(vc.returncode)
|
||||
|
||||
# fini!
|
||||
###############################################################################
|
||||
|
||||
|
@ -111,6 +111,8 @@ user = %(user)s
|
||||
pass = %(pass)s
|
||||
# set aliases for this apiurl
|
||||
# aliases = foo, bar
|
||||
# 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
|
||||
#http_headers = Host: foofoobar,
|
||||
# User: mumblegack
|
||||
@ -356,6 +358,9 @@ def get_config(override_conffile = None,
|
||||
#from the general section.
|
||||
user = cp.get(url, 'user')
|
||||
password = cp.get(url, 'pass')
|
||||
email = ''
|
||||
if cp.has_option(url, 'email'):
|
||||
email = cp.get(url, 'email')
|
||||
|
||||
if cp.has_option(url, 'http_headers'):
|
||||
http_headers = cp.get(url, 'http_headers')
|
||||
@ -374,7 +379,9 @@ def get_config(override_conffile = None,
|
||||
|
||||
api_host_options[apiurl] = { 'user': user,
|
||||
'pass': password,
|
||||
'http_headers': http_headers};
|
||||
'http_headers': http_headers}
|
||||
if email:
|
||||
api_host_options[apiurl]['email'] = email
|
||||
|
||||
# add the auth data we collected to the config dict
|
||||
config['api_host_options'] = api_host_options
|
||||
|
Loading…
Reference in New Issue
Block a user