mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-27 02:16:12 +01:00
- applied slightly modified version of Node's patch which added a --revision option to do_linkpac
This commit is contained in:
parent
f16fb793e3
commit
5768e35047
@ -589,6 +589,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
return 2
|
||||
|
||||
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='link the specified revision.')
|
||||
def do_linkpac(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: "Link" a package to another package
|
||||
|
||||
@ -616,6 +618,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
raise oscerr.WrongArgs('Incorrect number of arguments.\n\n' \
|
||||
+ self.get_cmd_help('linkpac'))
|
||||
|
||||
rev, dummy = parseRevisionOption(opts.revision)
|
||||
|
||||
src_project = args[0]
|
||||
src_package = args[1]
|
||||
dst_project = args[2]
|
||||
@ -627,7 +631,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if src_project == dst_project and src_package == dst_package:
|
||||
print >>sys.stderr, 'Error: source and destination are the same.'
|
||||
return 1
|
||||
link_pac(src_project, src_package, dst_project, dst_package)
|
||||
|
||||
if rev and not checkRevision(src_project, src_package, rev):
|
||||
print >>sys.stderr, 'Revision \'%s\' does not exist' % rev
|
||||
sys.exit(1)
|
||||
|
||||
link_pac(src_project, src_package, dst_project, dst_package, rev)
|
||||
|
||||
def do_aggregatepac(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: "Aggregate" a package to another package
|
||||
|
11
osc/core.py
11
osc/core.py
@ -2267,7 +2267,7 @@ def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False):
|
||||
userid = conf.config['user'], role = 'maintainer')
|
||||
return ET.tostring(root)
|
||||
|
||||
def link_pac(src_project, src_package, dst_project, dst_package):
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, rev=''):
|
||||
"""
|
||||
create a linked package
|
||||
- "src" is the original package
|
||||
@ -2288,15 +2288,20 @@ def link_pac(src_project, src_package, dst_project, dst_package):
|
||||
print >>sys.stderr, '_link file already exists...! Aborting'
|
||||
sys.exit(1)
|
||||
|
||||
if rev:
|
||||
rev = 'rev="%s"' % rev
|
||||
else:
|
||||
rev = ''
|
||||
|
||||
print 'Creating _link...',
|
||||
link_template = """\
|
||||
<link project="%s" package="%s">
|
||||
<link project="%s" package="%s" %s>
|
||||
<patches>
|
||||
<!-- <apply name="patch" /> -->
|
||||
<!-- <topadd>%%define build_with_feature_x 1</topadd> -->
|
||||
</patches>
|
||||
</link>
|
||||
""" % (src_project, src_package)
|
||||
""" % (src_project, src_package, rev)
|
||||
|
||||
u = makeurl(conf.config['apiurl'], ['source', dst_project, dst_package, '_link'])
|
||||
http_PUT(u, data=link_template)
|
||||
|
Loading…
Reference in New Issue
Block a user