Skip to content

pkg_tar does *not* include runfiles via an alias #1066

@filmil

Description

@filmil

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions