unified-isos: Resolve symlinks
If the compose is configured to use symlinks for packages, the unified ISO would include the symlinks which is useless. Instead, let's check and replace any symlinks pointing outside of the compose with the actual file. JIRA: RHELCMP-13802 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
4a5106375e
commit
8ced384540
1 changed files with 7 additions and 0 deletions
|
|
@ -148,6 +148,13 @@ class UnifiedISO(object):
|
|||
new_path = os.path.join(self.temp_dir, "trees", arch, old_relpath)
|
||||
|
||||
makedirs(os.path.dirname(new_path))
|
||||
# Resolve symlinks to external files. Symlinks within the
|
||||
# provided `dir` are kept.
|
||||
if os.path.islink(old_path):
|
||||
real_path = os.readlink(old_path)
|
||||
abspath = os.path.normpath(os.path.join(os.path.dirname(old_path), real_path))
|
||||
if not abspath.startswith(dir):
|
||||
old_path = real_path
|
||||
try:
|
||||
self.linker.link(old_path, new_path)
|
||||
except OSError as exc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue