gather: Add all srpms to variant lookaside repo
The original code could cause a source RPM to be present in two variants that have a dependency relation. There is always only one source repo for a variant in the final compose. When gathering packages for a variant that depends on another variant, we need to build a temporary lookaside repo that has similar content to the parent variant. This lookaside only contained source RPMs for packages present the the architecture. This could result in duplicated SRPMs in the compose. Example situation: * Variant B depends on variant A. * A contains foo.x86_64.rpm (only on x86_64) * B pulls in subpackage foo-bar.s390x.rpm (on s390x) Source repo for A will correctly contain foo.src.rpm. With original code the srpm would also end up in B.src. By adding all sources to the temporary lookaside Pungi will know that source repo for B doesn't need to duplicate the package. The refactoring to use a set to store the packages is meant to avoid listing the same SRPM multiple times in the repo in the most common situation when SRPM is listed in multiple architectures. JIRA: RHELCMP-6002 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
edb091b7b1
commit
a435fd58da
@ -639,13 +639,21 @@ def _make_lookaside_repo(compose, variant, arch, pkg_map, package_sets=None):
|
|||||||
+ "/",
|
+ "/",
|
||||||
}
|
}
|
||||||
path_prefix = prefixes[compose.conf["pkgset_source"]]()
|
path_prefix = prefixes[compose.conf["pkgset_source"]]()
|
||||||
pkglist = compose.paths.work.lookaside_package_list(arch=arch, variant=variant)
|
package_list = set()
|
||||||
with open(pkglist, "w") as f:
|
for pkg_arch in pkg_map.keys():
|
||||||
for packages in pkg_map[arch][variant.uid].values():
|
for pkg_type, packages in pkg_map[pkg_arch][variant.uid].items():
|
||||||
|
# We want all packages for current arch, and SRPMs for any
|
||||||
|
# arch. Ultimately there will only be one source repository, so
|
||||||
|
# we need a union of all SRPMs.
|
||||||
|
if pkg_type == "srpm" or pkg_arch == arch:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
pkg = pkg["path"]
|
pkg = pkg["path"]
|
||||||
if path_prefix and pkg.startswith(path_prefix):
|
if path_prefix and pkg.startswith(path_prefix):
|
||||||
pkg = pkg[len(path_prefix) :]
|
pkg = pkg[len(path_prefix) :]
|
||||||
|
package_list.add(pkg)
|
||||||
|
pkglist = compose.paths.work.lookaside_package_list(arch=arch, variant=variant)
|
||||||
|
with open(pkglist, "w") as f:
|
||||||
|
for pkg in sorted(package_list):
|
||||||
f.write("%s\n" % pkg)
|
f.write("%s\n" % pkg)
|
||||||
|
|
||||||
cr = CreaterepoWrapper(compose.conf["createrepo_c"])
|
cr = CreaterepoWrapper(compose.conf["createrepo_c"])
|
||||||
|
Loading…
Reference in New Issue
Block a user