forked from importers/git-importer
Merge pull request 'Add a list of packages no longer existing' (#22) from add_gone into main
Reviewed-on: https://gitea.opensuse.org/importers/git-importer/pulls/22
This commit is contained in:
commit
3797ea178a
1355
gone-packages.txt
Normal file
1355
gone-packages.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
|||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
import logging
|
import logging
|
||||||
|
import pathlib
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
from lib.db import DB
|
from lib.db import DB
|
||||||
@ -31,6 +32,7 @@ class Importer:
|
|||||||
self.obs = OBS(api_url)
|
self.obs = OBS(api_url)
|
||||||
assert project == "openSUSE:Factory"
|
assert project == "openSUSE:Factory"
|
||||||
self.refreshed_packages = set()
|
self.refreshed_packages = set()
|
||||||
|
self.gone_packages_set = None
|
||||||
|
|
||||||
def import_request(self, number):
|
def import_request(self, number):
|
||||||
self.obs.request(number).import_into_db(self.db)
|
self.obs.request(number).import_into_db(self.db)
|
||||||
@ -208,6 +210,8 @@ class Importer:
|
|||||||
if key in self.refreshed_packages:
|
if key in self.refreshed_packages:
|
||||||
# refreshing once is good enough
|
# refreshing once is good enough
|
||||||
return
|
return
|
||||||
|
if self.package_gone(key):
|
||||||
|
return
|
||||||
logging.debug(f"Refresh {project}/{package}")
|
logging.debug(f"Refresh {project}/{package}")
|
||||||
self.refreshed_packages.add(key)
|
self.refreshed_packages.add(key)
|
||||||
self.update_db_package(project, package)
|
self.update_db_package(project, package)
|
||||||
@ -254,3 +258,11 @@ class Importer:
|
|||||||
|
|
||||||
self.fill_file_lists()
|
self.fill_file_lists()
|
||||||
self.db.conn.commit()
|
self.db.conn.commit()
|
||||||
|
|
||||||
|
def package_gone(self, key):
|
||||||
|
if not self.gone_packages_set:
|
||||||
|
self.gone_packages_set = set()
|
||||||
|
with open(pathlib.Path(__file__).parent.parent / "gone-packages.txt") as f:
|
||||||
|
for line in f.readlines():
|
||||||
|
self.gone_packages_set.add(line.strip())
|
||||||
|
return key in self.gone_packages_set
|
||||||
|
Loading…
Reference in New Issue
Block a user