lists: Read only the first of compressed pkglists

By default, genbasedir saves several copies of every
package list, compressing them with different methods
(xz, bz2, uncompressed). With this change, we read
only the first one, thus avoiding extra work
and (false) warnings about duplicate binaries.
This commit is contained in:
Ivan A. Melnikov 2023-06-02 15:49:24 +04:00
parent e2dc5736a2
commit 90d99e3882

View File

@ -86,6 +86,7 @@ def read_pkglist_headers_rpm(path):
def read_pkglist_heders_for_repo(repo_path, arches, components=None):
bin_headers = []
src_headers = []
seen = set()
for arch in arches:
basedir = os.path.join(repo_path, arch, 'base')
for pkglist in os.listdir(basedir):
@ -94,6 +95,11 @@ def read_pkglist_heders_for_repo(repo_path, arches, components=None):
continue
if components is not None and parts[1] not in components:
continue
what = basedir, parts[0], parts[1]
if what in seen:
LOG.info('Ignoring %s/%s', basedir, pkglist)
continue
seen.add(what)
(src_headers if parts[0] == 'srclist' else bin_headers).extend(
read_pkglist_headers_rpm(os.path.join(basedir, pkglist)))
return src_headers, bin_headers