Skip dangling symlinks when staging sources for the DEB packages

os.walk classifies broken symlinks as files; external/ArcGIS is a
relative symlink to the pipeline root that resolves on the host but
dangles once the tree is staged to a flat directory, so
shutil.copy2 crashed with FileNotFoundError while building
qt6-release-sources. Skip dangling symlinks (they carry no copyable
content) instead of aborting.
This commit is contained in:
berrux-dev committed 2026-11-20 14:32:56 +01:00
1 parent 6e8e4fa287
commit e8d7aa7bd6
1 file changed
+7
@@ -100,6 +100,13 @@ def copy_src_dir_to_dest_dir(src_dir, dest_dir, file_filter=None):
prune_dirs(dirs, root, file_filter) prune_dirs(dirs, root, file_filter)
for file in files: for file in files:
src_file = os.path.join(root, file) src_file = os.path.join(root, file)
if os.path.islink(src_file) and not os.path.exists(src_file):
# Dangling symlink: os.walk reports broken links as files, but
# there is nothing to copy. These are relative links to outside
# the tree (e.g. external/ArcGIS) that resolve on the host but
# dangle once the tree is staged to a flat directory.
debug(f" Skipping dangling symlink: {src_file}")
continue
if file_filter and file_filter(src_file): if file_filter and file_filter(src_file):
continue continue
dest_file = os.path.join(dest_dir, os.path.relpath(src_file, src_dir)) dest_file = os.path.join(dest_dir, os.path.relpath(src_file, src_dir))