mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-04 02:26:16 +01:00
vc: to support meego changelog style if detected
need "vc" command shipped with meego-packaging-tools
This commit is contained in:
parent
5a49daa69a
commit
c61e4a514e
@ -5791,12 +5791,31 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
|
|
||||||
if not os.path.exists('/usr/lib/build/vc'):
|
meego_style = False
|
||||||
print >>sys.stderr, 'Error: you need build.rpm with version 2009.04.17 or newer'
|
if not args:
|
||||||
print >>sys.stderr, 'See http://download.opensuse.org/repositories/openSUSE:/Tools/'
|
import glob, re
|
||||||
return 1
|
try:
|
||||||
|
fn_changelog = glob.glob('*.changes')[0]
|
||||||
|
fp = file(fn_changelog)
|
||||||
|
titleline = fp.readline()
|
||||||
|
fp.close()
|
||||||
|
if re.match('^\*\W+(.+\W+\d{1,2}\W+20\d{2})\W+(.+)\W+<(.+)>\W+(.+)$', titleline):
|
||||||
|
meego_style = True
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|
||||||
cmd_list = ["/usr/lib/build/vc", ]
|
if meego_style:
|
||||||
|
if not os.path.exists('/usr/bin/vc'):
|
||||||
|
print >>sys.stderr, 'Error: you need meego-packaging-tools for /usr/bin/vc command'
|
||||||
|
return 1
|
||||||
|
cmd_list = ["/usr/bin/vc", ]
|
||||||
|
else:
|
||||||
|
if not os.path.exists('/usr/lib/build/vc'):
|
||||||
|
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/lib/build/vc", ]
|
||||||
|
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
arg = args[0]
|
arg = args[0]
|
||||||
@ -5813,24 +5832,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
user = conf.get_apiurl_usr(apiurl)
|
user = conf.get_apiurl_usr(apiurl)
|
||||||
|
|
||||||
# work with all combinations of URL with or withouth the ending slash
|
try:
|
||||||
|
os.environ['mailaddr'], os.environ['username'] = get_user_data(apiurl, user, 'email', 'realname')
|
||||||
|
except Exception, e:
|
||||||
|
sys.exit('%s\nget_user_data(email) failed. Try env mailaddr=....\n' % e)
|
||||||
|
|
||||||
|
# mailaddr can be overrided by config one
|
||||||
if conf.config['api_host_options'][apiurl].has_key('email'):
|
if conf.config['api_host_options'][apiurl].has_key('email'):
|
||||||
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
||||||
else:
|
|
||||||
try:
|
|
||||||
os.environ['mailaddr'] = get_user_data(apiurl, user, 'email')[0]
|
|
||||||
except Exception, e:
|
|
||||||
sys.exit('%s\nget_user_data(email) failed. Try env mailaddr=....\n' % e)
|
|
||||||
|
|
||||||
if opts.message:
|
if meego_style:
|
||||||
cmd_list.append("-m")
|
if opts.message or opts.just_edit:
|
||||||
cmd_list.append(opts.message)
|
print >>sys.stderr, 'Warning: to edit MeeGo style changelog, opts will be ignored.'
|
||||||
|
else:
|
||||||
|
if opts.message:
|
||||||
|
cmd_list.append("-m")
|
||||||
|
cmd_list.append(opts.message)
|
||||||
|
|
||||||
if opts.just_edit:
|
if opts.just_edit:
|
||||||
cmd_list.append("-e")
|
cmd_list.append("-e")
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
cmd_list.extend(args)
|
cmd_list.extend(args)
|
||||||
|
|
||||||
vc = Popen(cmd_list)
|
vc = Popen(cmd_list)
|
||||||
vc.wait()
|
vc.wait()
|
||||||
|
Loading…
Reference in New Issue
Block a user