Fix the fake revisions after introduction of cache
The way I stored it in the linked_revs was the wrong way
This commit is contained in:
parent
9bd6643e8a
commit
38e4996280
@ -200,13 +200,12 @@ class DBRevision:
|
|||||||
return self._files
|
return self._files
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def requests_to_fetch(db, project, package):
|
def requests_to_fetch(db):
|
||||||
with db.cursor() as cur:
|
with db.cursor() as cur:
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"""SELECT request_number FROM revisions revs LEFT JOIN requests
|
"""SELECT request_number FROM revisions revs LEFT JOIN requests
|
||||||
reqs ON reqs.number=revs.request_number WHERE reqs.id is null AND
|
reqs ON reqs.number=revs.request_number WHERE reqs.id is null AND
|
||||||
revs.request_number IS NOT NULL and project=%s AND package=%s;""",
|
revs.request_number IS NOT NULL""",
|
||||||
(project, package),
|
|
||||||
)
|
)
|
||||||
return [row[0] for row in cur.fetchall()]
|
return [row[0] for row in cur.fetchall()]
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ class Importer:
|
|||||||
def find_fake_revisions(self, db):
|
def find_fake_revisions(self, db):
|
||||||
with db.cursor() as cur:
|
with db.cursor() as cur:
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"SELECT * from revisions WHERE id in (SELECT revision_id from linked_revs WHERE considered=FALSE)"
|
"SELECT * from revisions WHERE id in (SELECT linked_id from linked_revs WHERE considered=FALSE)"
|
||||||
)
|
)
|
||||||
for row in cur.fetchall():
|
for row in cur.fetchall():
|
||||||
self._find_fake_revision(db, DBRevision(row))
|
self._find_fake_revision(db, DBRevision(row))
|
||||||
@ -268,40 +268,40 @@ class Importer:
|
|||||||
self.fetch_all_linked_packages(db, project, self.package)
|
self.fetch_all_linked_packages(db, project, self.package)
|
||||||
# all remaining, no filtering here
|
# all remaining, no filtering here
|
||||||
self.find_linked_revs(db)
|
self.find_linked_revs(db)
|
||||||
self.find_fake_revisions(db)
|
|
||||||
|
|
||||||
missing_users = User.missing_users(db)
|
missing_users = User.missing_users(db)
|
||||||
for userid in missing_users:
|
for userid in missing_users:
|
||||||
missing_user = self.obs.user(userid)
|
missing_user = self.obs.user(userid)
|
||||||
if missing_user:
|
if missing_user:
|
||||||
missing_user.import_into_db(db)
|
missing_user.import_into_db(db)
|
||||||
|
|
||||||
for rev in self.revisions_without_files(db):
|
self.find_fake_revisions(db)
|
||||||
|
for rev in self.revisions_without_files(db):
|
||||||
|
with db.cursor() as cur:
|
||||||
|
cur.execute(
|
||||||
|
"""SELECT unexpanded_srcmd5 from revisions WHERE
|
||||||
|
id=(SELECT linked_id FROM linked_revs WHERE revision_id=%s)""",
|
||||||
|
(rev.dbid,),
|
||||||
|
)
|
||||||
|
linked_rev = cur.fetchone()
|
||||||
|
if linked_rev:
|
||||||
|
linked_rev = linked_rev[0]
|
||||||
|
list = self.obs.list(
|
||||||
|
rev.project, rev.package, rev.unexpanded_srcmd5, linked_rev
|
||||||
|
)
|
||||||
|
if list:
|
||||||
|
rev.import_dir_list(db, list)
|
||||||
|
md5 = rev.calculate_files_hash(db)
|
||||||
with db.cursor() as cur:
|
with db.cursor() as cur:
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"""SELECT unexpanded_srcmd5 from revisions WHERE
|
"UPDATE revisions SET files_hash=%s WHERE id=%s",
|
||||||
id=(SELECT linked_id FROM linked_revs WHERE revision_id=%s)""",
|
(md5, rev.dbid),
|
||||||
(rev.dbid,),
|
|
||||||
)
|
)
|
||||||
linked_rev = cur.fetchone()
|
else:
|
||||||
if linked_rev:
|
rev.set_broken(db)
|
||||||
linked_rev = linked_rev[0]
|
|
||||||
list = self.obs.list(
|
|
||||||
rev.project, rev.package, rev.unexpanded_srcmd5, linked_rev
|
|
||||||
)
|
|
||||||
if list:
|
|
||||||
rev.import_dir_list(db, list)
|
|
||||||
md5 = rev.calculate_files_hash(db)
|
|
||||||
with db.cursor() as cur:
|
|
||||||
cur.execute(
|
|
||||||
"UPDATE revisions SET files_hash=%s WHERE id=%s",
|
|
||||||
(md5, rev.dbid),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
rev.set_broken(db)
|
|
||||||
|
|
||||||
for number in DBRevision.requests_to_fetch(db, project, self.package):
|
for number in DBRevision.requests_to_fetch(db):
|
||||||
self.obs.request(number).import_into_db(db)
|
self.obs.request(number).import_into_db(db)
|
||||||
|
|
||||||
db.conn.commit()
|
db.conn.commit()
|
||||||
TreeBuilder(db).build(self.package)
|
TreeBuilder(db).build(self.package)
|
||||||
|
Loading…
Reference in New Issue
Block a user