Import packages links point to
This commit is contained in:
parent
e8094cbc68
commit
fb130bbf6f
@ -127,15 +127,15 @@ class Importer:
|
|||||||
root = self.obs._history(project, package)
|
root = self.obs._history(project, package)
|
||||||
if root is None:
|
if root is None:
|
||||||
return
|
return
|
||||||
latest = DBRevision.latest_revision(db, project, self.package)
|
latest = DBRevision.latest_revision(db, project, package)
|
||||||
for r in root.findall("revision"):
|
for r in root.findall("revision"):
|
||||||
rev = OBSRevision(self.obs, self, project, self.package).parse(r)
|
rev = OBSRevision(self.obs, self, project, package).parse(r)
|
||||||
if not latest or rev.rev > latest.rev:
|
if not latest or rev.rev > latest.rev:
|
||||||
dbrev = DBRevision.import_obs_rev(db, rev)
|
dbrev = DBRevision.import_obs_rev(db, rev)
|
||||||
root = rev.read_link()
|
root = rev.read_link()
|
||||||
if root:
|
if root:
|
||||||
tprj = root.get("project") or project
|
tprj = root.get("project") or project
|
||||||
tpkg = root.get("package") or self.package
|
tpkg = root.get("package") or package
|
||||||
dbrev.links_to(db, tprj, tpkg)
|
dbrev.links_to(db, tprj, tpkg)
|
||||||
db.conn.commit()
|
db.conn.commit()
|
||||||
|
|
||||||
@ -144,6 +144,15 @@ class Importer:
|
|||||||
for project, _, api_url in self.projects:
|
for project, _, api_url in self.projects:
|
||||||
self.obs.change_url(api_url)
|
self.obs.change_url(api_url)
|
||||||
self.update_db_package(db, project, self.package)
|
self.update_db_package(db, project, self.package)
|
||||||
|
cur = db.cursor()
|
||||||
|
cur.execute(
|
||||||
|
"SELECT DISTINCT l.project, l.package from links l join revisions r on r.id=l.revision_id WHERE r.project=%s AND r.package=%s",
|
||||||
|
(project, self.package),
|
||||||
|
)
|
||||||
|
for row in cur.fetchall():
|
||||||
|
(lproject, lpackage) = row
|
||||||
|
self.update_db_package(db, lproject, lpackage)
|
||||||
|
cur.close()
|
||||||
|
|
||||||
def import_all_revisions(self, gc):
|
def import_all_revisions(self, gc):
|
||||||
# Fetch all the requests and sort them. Ideally we should
|
# Fetch all the requests and sort them. Ideally we should
|
||||||
|
@ -64,7 +64,8 @@ class OBSRevision:
|
|||||||
def read_link(self):
|
def read_link(self):
|
||||||
try:
|
try:
|
||||||
return self.obs._xml(
|
return self.obs._xml(
|
||||||
f"source/{self.project}/{self.package}/_link", rev=self.srcmd5
|
f"source/{self.project}/{self.package}/_link",
|
||||||
|
rev=self.unexpanded_srcmd5,
|
||||||
)
|
)
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
@ -81,7 +82,7 @@ class OBSRevision:
|
|||||||
target_project = root.get("project")
|
target_project = root.get("project")
|
||||||
except ET.ParseError:
|
except ET.ParseError:
|
||||||
logging.error(
|
logging.error(
|
||||||
f"_link can't be parsed [{self.project}/{self.package} rev={self.srcmd5}]"
|
f"_link can't be parsed [{self.project}/{self.package} rev={self.unexpanded_srcmd5}]"
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user