Prepare link collection
This commit is contained in:
@@ -61,24 +61,30 @@ class OBSRevision:
|
||||
def __repr__(self):
|
||||
return f"[{self.__str__()}]"
|
||||
|
||||
def check_link(self):
|
||||
"""Add 'linkrev' attribute into the revision. Returns False if the link is invalid"""
|
||||
def read_link(self):
|
||||
try:
|
||||
root = self.obs._xml(
|
||||
return self.obs._xml(
|
||||
f"source/{self.project}/{self.package}/_link", rev=self.srcmd5
|
||||
)
|
||||
except HTTPError as e:
|
||||
if e.code == 404:
|
||||
logging.debug("No _link for the revision")
|
||||
return True
|
||||
return None
|
||||
raise e
|
||||
|
||||
def check_link(self):
|
||||
"""Add 'linkrev' attribute into the revision. Returns False if the link is invalid"""
|
||||
try:
|
||||
root = self.read_link()
|
||||
if root is None:
|
||||
return True
|
||||
target_project = root.get("project")
|
||||
except ET.ParseError:
|
||||
logging.error(
|
||||
f"_link can't be parsed [{self.project}/{self.package} rev={self.srcmd5}]"
|
||||
)
|
||||
return False
|
||||
|
||||
target_project = root.get("project")
|
||||
rev = self.history.find_last_rev_after_time(target_project, self.time)
|
||||
if rev:
|
||||
logging.debug(f"Linkrev found: {rev}")
|
||||
|
Reference in New Issue
Block a user