From 8c897dda7178ba6cabad59d1b99831628a09abd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 9 Apr 2025 13:32:14 +0200 Subject: [PATCH] gather: Resolve symlinks before linking packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ář (cherry picked from commit 859b968483b75f630bb9c7e15a90767eb0b68d95) --- pungi/phases/gather/link.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pungi/phases/gather/link.py b/pungi/phases/gather/link.py index 1e7d6413..71371d58 100644 --- a/pungi/phases/gather/link.py +++ b/pungi/phases/gather/link.py @@ -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"]]