mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-25 03:32:15 +01:00
Go one step further with setlinkrev, use always xsrcmd5, even when given a normal revsion, except "-R" option is used.
This commit is contained in:
parent
10d999c479
commit
492edaa794
2
NEWS
2
NEWS
@ -1,6 +1,6 @@
|
|||||||
0.130
|
0.130
|
||||||
- New "service" command to run source services locally or trigger a re-run on the server.
|
- New "service" command to run source services locally or trigger a re-run on the server.
|
||||||
- setlinkrev is setting now the revision to xsrcmd5 by default to avoid later breakage on indirect links
|
- setlinkrev is setting now the revision to xsrcmd5 by default to avoid later breakage on indirect links by default.
|
||||||
#
|
#
|
||||||
# Feature which requires OBS 2.1
|
# Feature which requires OBS 2.1
|
||||||
#
|
#
|
||||||
|
@ -1871,6 +1871,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
@cmdln.option('-r', '--revision', metavar='rev',
|
@cmdln.option('-r', '--revision', metavar='rev',
|
||||||
help='use the specified revision.')
|
help='use the specified revision.')
|
||||||
|
@cmdln.option('-R', '--use-plain-revision', action='store_true',
|
||||||
|
help='Don\'t expand revsion based on baserev, the revision which was used when commit happened.')
|
||||||
@cmdln.option('-u', '--unset', action='store_true',
|
@cmdln.option('-u', '--unset', action='store_true',
|
||||||
help='remove revision in link, it will point always to latest revision')
|
help='remove revision in link, it will point always to latest revision')
|
||||||
def do_setlinkrev(self, subcmd, opts, *args):
|
def do_setlinkrev(self, subcmd, opts, *args):
|
||||||
@ -1888,6 +1890,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
args = slash_split(args)
|
args = slash_split(args)
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
package = None
|
package = None
|
||||||
|
use_baserev = 1
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
p = findpacs(os.curdir)[0]
|
p = findpacs(os.curdir)[0]
|
||||||
project = p.prjname
|
project = p.prjname
|
||||||
@ -1909,13 +1912,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
else:
|
else:
|
||||||
packages = meta_get_packagelist(apiurl, project)
|
packages = meta_get_packagelist(apiurl, project)
|
||||||
|
|
||||||
|
if opts.use_plain_revision:
|
||||||
|
use_baserev = None
|
||||||
|
|
||||||
for p in packages:
|
for p in packages:
|
||||||
print "setting revision for package", p
|
print "setting revision for package", p
|
||||||
if opts.unset:
|
if opts.unset:
|
||||||
rev=-1
|
rev=-1
|
||||||
else:
|
else:
|
||||||
rev, dummy = parseRevisionOption(opts.revision)
|
rev, dummy = parseRevisionOption(opts.revision)
|
||||||
set_link_rev(apiurl, project, p, rev)
|
set_link_rev(apiurl, project, p, revision = rev, use_baserev = use_baserev)
|
||||||
|
|
||||||
|
|
||||||
def do_linktobranch(self, subcmd, opts, *args):
|
def do_linktobranch(self, subcmd, opts, *args):
|
||||||
|
11
osc/core.py
11
osc/core.py
@ -4854,7 +4854,7 @@ def search(apiurl, **kwargs):
|
|||||||
res[urlpath] = ET.parse(f).getroot()
|
res[urlpath] = ET.parse(f).getroot()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def set_link_rev(apiurl, project, package, revision = None):
|
def set_link_rev(apiurl, project, package, revision = None, use_baserev = None):
|
||||||
url = makeurl(apiurl, ['source', project, package, '_link'])
|
url = makeurl(apiurl, ['source', project, package, '_link'])
|
||||||
try:
|
try:
|
||||||
f = http_GET(url)
|
f = http_GET(url)
|
||||||
@ -4864,15 +4864,18 @@ def set_link_rev(apiurl, project, package, revision = None):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
# set revision element
|
# set revision element
|
||||||
|
src_project = root.attrib['project']
|
||||||
|
src_package = root.attrib['package']
|
||||||
if not revision:
|
if not revision:
|
||||||
src_project = root.attrib['project']
|
root.attrib['rev'] = show_upstream_rev(apiurl, src_project, src_package)
|
||||||
src_package = root.attrib['package']
|
|
||||||
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package)
|
|
||||||
elif revision == -1:
|
elif revision == -1:
|
||||||
del root.attrib['rev']
|
del root.attrib['rev']
|
||||||
else:
|
else:
|
||||||
root.attrib['rev'] = revision
|
root.attrib['rev'] = revision
|
||||||
|
|
||||||
|
if use_baserev:
|
||||||
|
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package, revision=root.attrib['rev'], linkrev='base' )
|
||||||
|
|
||||||
l = ET.tostring(root)
|
l = ET.tostring(root)
|
||||||
# upload _link file again
|
# upload _link file again
|
||||||
http_PUT(url, data=l)
|
http_PUT(url, data=l)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user