The patch below fixes things in my case. You may want to generalize.
--- a/pkg/private/pkg_files.bzl
+++ b/pkg/private/pkg_files.bzl
@@ -463,6 +463,23 @@
gid = mapping_context.default_gid,
)
+ if hasattr(runfiles, "root_symlinks"):
+ for rsym in runfiles.root_symlinks.to_list():
+ mapping_context.file_deps.append(depset([rsym.target_file]))
+ d_path = mapping_context.path_mapper(base_file_path + ".runfiles/" + rsym.path)
+ fmode = "0755" if rsym.target_file == the_executable else mapping_context.default_mode
+ _check_dest(mapping_context.content_map, d_path, rsym.target_file, src.label, mapping_context.allow_duplicates_with_different_content)
+ mapping_context.content_map[d_path] = _DestFile(
+ src = rsym.target_file,
+ entry_type = ENTRY_IS_FILE,
+ origin = src.label,
+ mode = fmode,
+ user = mapping_context.default_user,
+ group = mapping_context.default_group,
+ uid = mapping_context.default_uid,
+ gid = mapping_context.default_gid,
+ )
+
# if repo_mapping manifest exists (for e.g. with --enable_bzlmod),
# create _repo_mapping under runfiles directory
repo_mapping_manifest = get_repo_mapping_manifest(src)
Discovered by noticing that adding runfiles resolution library into
data, does not, in fact, end up adding them to the archive.The patch below fixes things in my case. You may want to generalize.