From 5a6a55868fcaddb475932a7fc1bc287ed5bc9cc1 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Thu, 24 Jul 2025 13:20:00 +0200 Subject: [PATCH] Look at deleted packages if they are not found --- lib/obs.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/obs.py b/lib/obs.py index d36c56b..ec75019 100644 --- a/lib/obs.py +++ b/lib/obs.py @@ -148,12 +148,21 @@ class OBS: ] def _download(self, project, package, name, revision): - url = osc.core.makeurl( - self.url, - ["source", project, package, name], - {"rev": revision, "expand": 1}, - ) - return osc.core.http_GET(url) + try: + url = osc.core.makeurl( + self.url, + ["source", project, package, name], + {"rev": revision, "expand": 1}, + ) + return osc.core.http_GET(url) + except HTTPError as e: + if e.status == 404: + url = osc.core.makeurl( + self.url, + ["source", project, package, name], + {"rev": revision, "expand": 1, "deleted": 1}, + ) + return osc.core.http_GET(url) def download( self, @@ -189,7 +198,7 @@ class OBS: try: root = self._xml(f"source/{project}/{package}", **params) except HTTPError as e: - if e.code == 400: + if e.code == 400 or e.code == 404: logging.error( f"Package [{project}/{package} {params}] can't be expanded: {e}" )