Skip to content

Commit ee0a500

Browse files
authored
Fix installer runfiles for external-owned solib artifacts
rules_pkg 1.3.0 resolves installer sources using their owning repository, but external-owned solib artifacts can have main-repository-relative runfiles paths. Give these files packaging-owned symlink artifacts so the owner and runfiles path agree. Limit the replacement to installer mappings, leaving ZIP inputs and installed destinations unchanged.
1 parent 0c0f5f8 commit ee0a500

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎misc/bazel/pkg.bzl‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def _codeql_pack_group_extract_options(ctx):
241241

242242
def _codeql_pack_group_extract_files_impl(ctx):
243243
pkg_files = []
244+
installer_sources = {}
244245

245246
platform, apply_pack_prefix, include_all_files = _codeql_pack_group_extract_options(ctx)
246247
for src in ctx.attr.srcs:
@@ -260,6 +261,15 @@ def _codeql_pack_group_extract_files_impl(ctx):
260261
if file_kind == "common" and dest in arch_overrides:
261262
file_kind = "arch"
262263
if include_all_files or file_kind == ctx.attr.kind:
264+
# External-owned _solib files can live in the main repository's runfiles.
265+
if include_all_files and not file.is_directory and file.owner and file.owner.repo_name and not file.short_path.startswith("../"):
266+
if file not in installer_sources:
267+
source = ctx.actions.declare_file(
268+
"%s-sources/%d/%s" % (ctx.label.name, len(installer_sources), file.basename),
269+
)
270+
ctx.actions.symlink(output = source, target_file = file)
271+
installer_sources[file] = source
272+
file = installer_sources[file]
263273
dest_src_map[expanded_dest] = file
264274

265275
if dest_src_map:

0 commit comments

Comments
 (0)