mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- set vrev on current links in link files
This commit is contained in:
parent
15da5e9580
commit
6860e7edff
1
NEWS
1
NEWS
@ -2,6 +2,7 @@
|
||||
- patchinfo call can work without checked out copy now
|
||||
- use qemu as fallback for building not directly supported architectures
|
||||
- "results --watch" option to watch build results until they finished building
|
||||
- setlinkrev and linkpac ---current is setting vrev. this requires OBS 2.1.17 or 2.3
|
||||
#
|
||||
# Features which requires OBS 2.3
|
||||
#
|
||||
|
@ -2351,6 +2351,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
+ self.get_cmd_help('linkpac'))
|
||||
|
||||
rev, dummy = parseRevisionOption(opts.revision)
|
||||
vrev = None
|
||||
|
||||
src_project = args[0]
|
||||
src_package = args[1]
|
||||
@ -2369,13 +2370,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
opts.cicount = "copy"
|
||||
|
||||
if opts.current and not opts.new_package:
|
||||
rev = show_upstream_rev(apiurl, src_project, src_package)
|
||||
rev, vrev = show_upstream_rev_vrev(apiurl, src_project, src_package, expand=1)
|
||||
if rev == None or len(rev) < 32:
|
||||
# vrev is only needed for srcmd5 and OBS instances < 2.1.17 do not support it
|
||||
vrev = None
|
||||
|
||||
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, opts.force, rev, opts.cicount, opts.disable_publish, opts.new_package)
|
||||
link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount, opts.disable_publish, opts.new_package, vrev)
|
||||
|
||||
@cmdln.option('--nosources', action='store_true',
|
||||
help='ignore source packages when copying build results to destination project')
|
||||
|
29
osc/core.py
29
osc/core.py
@ -3238,6 +3238,11 @@ def show_upstream_xsrcmd5(apiurl, prj, pac, revision=None, linkrev=None, linkrep
|
||||
return li.xsrcmd5
|
||||
|
||||
|
||||
def show_upstream_rev_vrev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False):
|
||||
m = show_files_meta(apiurl, prj, pac, revision=revision, expand=expand, linkrev=linkrev, meta=meta)
|
||||
et = ET.fromstring(''.join(m))
|
||||
return et.get('rev'), et.get('vrev')
|
||||
|
||||
def show_upstream_rev(apiurl, prj, pac, revision=None, expand=False, linkrev=None, meta=False, include_service_files=False):
|
||||
m = show_files_meta(apiurl, prj, pac, revision=revision, expand=expand, linkrev=linkrev, meta=meta)
|
||||
et = ET.fromstring(''.join(m))
|
||||
@ -4193,7 +4198,7 @@ def link_to_branch(apiurl, project, package):
|
||||
else:
|
||||
raise oscerr.OscIOError(None, 'no _link file inside project \'%s\' package \'%s\'' % (project, package))
|
||||
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish = False, missing_target = False):
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish = False, missing_target = False, vrev=''):
|
||||
"""
|
||||
create a linked package
|
||||
- "src" is the original package
|
||||
@ -4246,16 +4251,21 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
sys.exit(1)
|
||||
|
||||
if rev:
|
||||
rev = 'rev="%s"' % rev
|
||||
rev = ' rev="%s"' % rev
|
||||
else:
|
||||
rev = ''
|
||||
|
||||
if vrev:
|
||||
vrev = ' vrev="%s"' % vrev
|
||||
else:
|
||||
vrev = ''
|
||||
|
||||
missingok = ''
|
||||
if missing_target:
|
||||
missingok = 'missingok="true"'
|
||||
missingok = ' missingok="true"'
|
||||
|
||||
if cicount:
|
||||
cicount = 'cicount="%s"' % cicount
|
||||
cicount = ' cicount="%s"' % cicount
|
||||
else:
|
||||
cicount = ''
|
||||
|
||||
@ -4266,15 +4276,16 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
project = 'project="%s"' % src_project
|
||||
|
||||
link_template = """\
|
||||
<link %s package="%s" %s %s %s>
|
||||
<link %s package="%s"%s%s%s%s>
|
||||
<patches>
|
||||
<!-- <branch /> for a full copy, default case -->
|
||||
<!-- <apply name="patch" /> apply a patch on the source directory -->
|
||||
<!-- <topadd>%%define build_with_feature_x 1</topadd> add a line on the top (spec file only) -->
|
||||
<!-- <add>file.patch</add> add a patch to be applied after %%setup (spec file only) -->
|
||||
<!-- <delete>filename</delete> delete a file -->
|
||||
</patches>
|
||||
</link>
|
||||
""" % (project, src_package, missingok, rev, cicount)
|
||||
""" % (project, src_package, missingok, rev, vrev, cicount)
|
||||
|
||||
u = makeurl(apiurl, ['source', dst_project, dst_package, '_link'])
|
||||
http_PUT(u, data=link_template)
|
||||
@ -5600,6 +5611,7 @@ def set_link_rev(apiurl, project, package, revision='', expand=False, baserev=Fa
|
||||
src_project = root.get('project', project)
|
||||
src_package = root.get('package', package)
|
||||
linkrev=None
|
||||
vrev = None
|
||||
if baserev:
|
||||
linkrev = 'base'
|
||||
expand = True
|
||||
@ -5607,10 +5619,13 @@ def set_link_rev(apiurl, project, package, revision='', expand=False, baserev=Fa
|
||||
if 'rev' in root.keys():
|
||||
del root.attrib['rev']
|
||||
elif revision == '' or expand:
|
||||
revision = show_upstream_rev(apiurl, src_project, src_package, revision=revision, linkrev=linkrev, expand=expand)
|
||||
revision, vrev = show_upstream_rev_vrev(apiurl, src_project, src_package, revision=revision, linkrev=linkrev, expand=expand)
|
||||
|
||||
if revision:
|
||||
root.set('rev', revision)
|
||||
# add vrev when revision is a srcmd5
|
||||
if vrev and revision and len(revision) >= 32:
|
||||
root.set('vrev', vrev)
|
||||
|
||||
l = ET.tostring(root)
|
||||
http_PUT(url, data=l)
|
||||
|
Loading…
Reference in New Issue
Block a user