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 <jkonecny@redhat.com>
This commit is contained in:
Jiri Konecny 2020-08-19 14:11:23 +02:00 committed by Lubomír Sedlář
parent b557bf160f
commit 981b69c699
3 changed files with 11 additions and 11 deletions

View File

@ -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"]:

View File

@ -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"])

View File

@ -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