cleanup context managers

This commit is contained in:
Nico Krapp 2022-10-26 13:46:02 +02:00
parent 1656d73340
commit dbeb534108
No known key found for this signature in database
GPG Key ID: AC35CFFF55212BC7

View File

@ -160,26 +160,26 @@ class Importer:
(lproject, lpackage) = row (lproject, lpackage) = row
self.update_db_package(db, lproject, lpackage) self.update_db_package(db, lproject, lpackage)
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 DBRevision.all_revisions(db, project, self.package): for rev in DBRevision.all_revisions(db, project, self.package):
# TODO move into SELECT # TODO move into SELECT
if rev.broken or rev.expanded_srcmd5: if rev.broken or rev.expanded_srcmd5:
continue continue
linked_rev = rev.linked_rev(db) linked_rev = rev.linked_rev(db)
if linked_rev: if linked_rev:
linked_rev = linked_rev.unexpanded_srcmd5 linked_rev = linked_rev.unexpanded_srcmd5
list = self.obs.list( list = self.obs.list(
project, self.package, rev.unexpanded_srcmd5, linked_rev project, self.package, rev.unexpanded_srcmd5, linked_rev
) )
if list: if list:
rev.import_dir_list(db, list) rev.import_dir_list(db, list)
else: else:
rev.set_broken(db) rev.set_broken(db)
for number in DBRevision.requests_to_fetch(db, project, self.package): for number in DBRevision.requests_to_fetch(db, project, self.package):
self.obs.request(number).import_into_db(db) self.obs.request(number).import_into_db(db)