Skip to content

Commit

Permalink
Merge pull request #3083 from fcrozat/weakremover.inc
Browse files Browse the repository at this point in the history
Don't abort if weakremover.inc don't exist on source project
  • Loading branch information
Vogtinator committed May 16, 2024
2 parents 123ba53 + a9709dd commit 2c8dfbe
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions osclib/freeze_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,20 @@ def copy_weakremovers(self):
targeturl = self.api.makeurl(['source', self.prj, '000release-packages', 'weakremovers.inc'],
{'comment': 'Update weakremovers.inc'})
oldinc = osc.core.http_GET(targeturl).read()
targeturl_exists = True
except HTTPError:
# if it doesn't exist, don't update
targeturl_exists = False
try:
sourceurl = self.api.makeurl(['source', self.api.project, '000release-packages', 'weakremovers.inc'])
inc = osc.core.http_GET(sourceurl).read()
sourceurl_exists = True
except HTTPError:
sourceurl_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
sourceurl = self.api.makeurl(['source', self.api.project, '000release-packages', 'weakremovers.inc'])
inc = osc.core.http_GET(sourceurl).read()
if inc != oldinc:
osc.core.http_PUT(targeturl, data=inc)

Expand Down

0 comments on commit 2c8dfbe

Please sign in to comment.