1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

detachbranch: remove _link when link target got removed

This commit is contained in:
Adrian Schröter 2021-09-14 14:09:27 +02:00
parent 5fdcecfbab
commit f98083df5c
No known key found for this signature in database
GPG Key ID: 918D8C954C08DB67
2 changed files with 9 additions and 2 deletions

View File

@ -2855,7 +2855,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
li = Linkinfo()
li.read(root.find('linkinfo'))
if li.islink() and li.haserror():
raise oscerr.LinkExpandError(project, package, li.error)
try:
show_package_meta(apiurl, li.project, li.package)
except HTTPError as e:
if e.code == 404:
print("Link target got removed, dropping link. WARNING: latest submissions in link target might be lost!")
delete_files(apiurl, project, package, ['_link'])
else:
raise oscerr.LinkExpandError(project, package, li.error)
elif not li.islink():
print('package \'%s/%s\' is no link' % (project, package), file=sys.stderr)
else:

View File

@ -540,7 +540,7 @@ class Linkinfo:
def islink(self):
"""returns True if the linkinfo is not empty, otherwise False"""
if self.xsrcmd5 or self.lsrcmd5:
if self.xsrcmd5 or self.lsrcmd5 or self.error is not None:
return True
return False