Report errors if weakremover.inc status is inconsistent between staging and parent projects.

This commit is contained in:
Frederic Crozat 2024-02-07 14:35:23 +01:00 committed by Fabian Vogt
parent af9319f0fe
commit 899d24fa4e

View File

@ -243,13 +243,22 @@ class FreezeCommand(object):
targeturl = self.api.makeurl(['source', self.prj, '000release-packages', 'weakremovers.inc'], targeturl = self.api.makeurl(['source', self.prj, '000release-packages', 'weakremovers.inc'],
{'comment': 'Update weakremovers.inc'}) {'comment': 'Update weakremovers.inc'})
oldinc = osc.core.http_GET(targeturl).read() oldinc = osc.core.http_GET(targeturl).read()
targeturl_exists=True
except HTTPError:
targeturl_exists=False
try:
sourceurl = self.api.makeurl(['source', self.api.project, '000release-packages', 'weakremovers.inc']) sourceurl = self.api.makeurl(['source', self.api.project, '000release-packages', 'weakremovers.inc'])
inc = osc.core.http_GET(sourceurl).read() inc = osc.core.http_GET(sourceurl).read()
if inc != oldinc: sourceurl_exists=True
osc.core.http_PUT(targeturl, data=inc)
except HTTPError: except HTTPError:
# if it doesn't exist, don't update sourceurlurl_exists=False
if targeturl_exists != sourceurl_exists:
raise Exception("weakremover.inc doesn't exist in both Staging and Parent project, please fix")
if not(targeturl_exists) and not(sourceurl_exists):
# nothing to do
return return
if inc != oldinc:
osc.core.http_PUT(targeturl, data=inc)
def is_bootstrap(self): def is_bootstrap(self):
"""Check if there is a bootstrap copy repository.""" """Check if there is a bootstrap copy repository."""