gather: Resolve symlinks before linking packages

If we happen to have a symlink to an RPM that should be linked into the
compose, we should first resolve it to the actual path. This avoids a
problem if the symlink is relative, as otherwise Pungi would copy/link
the actual relative symlink, which would break it in the new location.

If the path is not a symlink, resolving the real path should make no
difference.

JIRA: RHELCMP-14504
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2025-04-09 13:32:14 +02:00 committed by lsedlar
parent 004f357acb
commit 859b968483

View file

@ -87,7 +87,7 @@ def link_files(compose, arch, variant, pkg_map, pkg_sets, manifest, srpm_map={})
dst_relpath = os.path.join(packages_dir_relpath, package_path)
# link file
pool.queue_put((pkg["path"], dst))
pool.queue_put((os.path.realpath(pkg["path"]), dst))
# update rpm manifest
pkg_obj = pkg_by_path[pkg["path"]]
@ -116,7 +116,7 @@ def link_files(compose, arch, variant, pkg_map, pkg_sets, manifest, srpm_map={})
dst_relpath = os.path.join(packages_dir_relpath, package_path)
# link file
pool.queue_put((pkg["path"], dst))
pool.queue_put((os.path.realpath(pkg["path"]), dst))
# update rpm manifest
pkg_obj = pkg_by_path[pkg["path"]]
@ -146,7 +146,7 @@ def link_files(compose, arch, variant, pkg_map, pkg_sets, manifest, srpm_map={})
dst_relpath = os.path.join(packages_dir_relpath, package_path)
# link file
pool.queue_put((pkg["path"], dst))
pool.queue_put((os.path.realpath(pkg["path"]), dst))
# update rpm manifest
pkg_obj = pkg_by_path[pkg["path"]]