From 981b69c6994a879665c87368fb7e47ce432aca87 Mon Sep 17 00:00:00 2001 From: Jiri Konecny Date: Wed, 19 Aug 2020 14:11:23 +0200 Subject: [PATCH] Don't use compose in get_graft_points Not all usage of the get_graft_points have access to the compose object. Signed-off-by: Jiri Konecny --- pungi/phases/createiso.py | 5 +++-- pungi/phases/extra_isos.py | 10 +++++----- pungi/wrappers/iso.py | 7 +++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pungi/phases/createiso.py b/pungi/phases/createiso.py index 2b993c50..96c92ce2 100644 --- a/pungi/phases/createiso.py +++ b/pungi/phases/createiso.py @@ -508,10 +508,11 @@ def prepare_iso( write_discinfo(new_di_path, **data) if not disc_count or disc_count == 1: - data = iso.get_graft_points(compose, [tree_dir, iso_dir]) + data = iso.get_graft_points(compose.paths.compose.topdir(), [tree_dir, iso_dir]) else: data = iso.get_graft_points( - compose, [iso._paths_from_list(tree_dir, split_iso_data["files"]), iso_dir] + compose.paths.compose.topdir(), + [iso._paths_from_list(tree_dir, split_iso_data["files"]), iso_dir] ) if compose.conf["createiso_break_hardlinks"]: diff --git a/pungi/phases/extra_isos.py b/pungi/phases/extra_isos.py index 18db40ea..437375eb 100644 --- a/pungi/phases/extra_isos.py +++ b/pungi/phases/extra_isos.py @@ -199,7 +199,7 @@ def get_iso_contents( buildinstall_dir = os.path.join(buildinstall_dir, variant.uid) copy_boot_images(buildinstall_dir, iso_dir) - files = iso.get_graft_points(compose, [buildinstall_dir, iso_dir]) + files = iso.get_graft_points(compose.paths.compose.topdir(), [buildinstall_dir, iso_dir]) # We need to point efiboot.img to compose/ tree, because it was # modified in buildinstall phase and the file in work/ has different @@ -215,19 +215,19 @@ def get_iso_contents( # Get packages... package_dir = compose.paths.compose.packages(arch, var) - for k, v in iso.get_graft_points(compose, [package_dir]).items(): + for k, v in iso.get_graft_points(compose.paths.compose.topdir(), [package_dir]).items(): files[os.path.join(var.uid, "Packages", k)] = v # Get repodata... tree_dir = compose.paths.compose.repository(arch, var) repo_dir = os.path.join(tree_dir, "repodata") - for k, v in iso.get_graft_points(compose, [repo_dir]).items(): + for k, v in iso.get_graft_points(compose.paths.compose.topdir(), [repo_dir]).items(): files[os.path.join(var.uid, "repodata", k)] = v if inherit_extra_files: # Get extra files... extra_files_dir = compose.paths.work.extra_files_dir(arch, var) - for k, v in iso.get_graft_points(compose, [extra_files_dir]).items(): + for k, v in iso.get_graft_points(compose.paths.compose.topdir(), [extra_files_dir]).items(): files[os.path.join(var.uid, k)] = v extra_files_dir = compose.paths.work.extra_iso_extra_files_dir(arch, variant) @@ -243,7 +243,7 @@ def get_iso_contents( ) # Add extra files specific for the ISO - files.update(iso.get_graft_points(compose, [extra_files_dir])) + files.update(iso.get_graft_points(compose.paths.compose.topdir(), [extra_files_dir])) gp = "%s-graft-points" % iso_dir iso.write_graft_points(gp, files, exclude=["*/lost+found", "*/boot.iso"]) diff --git a/pungi/wrappers/iso.py b/pungi/wrappers/iso.py index da172c0b..2849db7a 100644 --- a/pungi/wrappers/iso.py +++ b/pungi/wrappers/iso.py @@ -273,7 +273,7 @@ def get_volume_id(path): raise RuntimeError("Could not read Volume ID") -def get_graft_points(compose, paths, exclusive_paths=None, exclude=None): +def get_graft_points(compose_top_dir, paths, exclusive_paths=None, exclude=None): # path priority in ascending order (1st = lowest prio) # paths merge according to priority # exclusive paths override whole dirs @@ -293,18 +293,17 @@ def get_graft_points(compose, paths, exclusive_paths=None, exclude=None): tree = _scan_tree(i) result = _merge_trees(result, tree, exclusive=True) - # Resolve possible symlinks pointing outside of the compose.topdir. + # Resolve possible symlinks pointing outside of the compose top dir. # This fixes an issue if link_type is set to "symlink" and therefore # the RPM packages are symbolic links to /mnt/koji filesystem. # Without this, the symbolic links would be simply copied into the ISO # without the real RPMs. - topdir = compose.paths.compose.topdir() for key in result.keys(): path = result[key] if os.path.islink(path): real_path = os.readlink(path) abspath = os.path.normpath(os.path.join(os.path.dirname(path), real_path)) - if not abspath.startswith(topdir): + if not abspath.startswith(compose_top_dir): result[key] = abspath # TODO: exclude