bazelbuild / bazelbuild/rules_pkg

pkg_files ignores included pkg_mklinks

Open
#980 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
253
Forks
221
Avg merge
10h 33m
Merged PRs (30d)
1

Description

## GoaI
I want to construct a tree like
```
/lib/foo.so.1.2.3
/lib/foo.so -> foo.so.1.2.3
```

I would produce `foo.so.1.2.3` with a `cc_shared_library` or `cc_binary`. I use `pkg_files` to locate that .so file into the image in `/lib`. I create the symlink with `pkg_mklink`. I want to include the link in the `pkg_files` target, and have both exist in lib. E.g.

```
fake_artifact(
name = "fake.so.1.2.3",
)

pkg_mklink(
name = "relative_link",
link_name = "so_by_another_name",
target = "fake.so.1.2.3",
)

pkg_files(
name = "fake_so_in_lib",
srcs = [
":fake.so.1.2.3",
":relative_link", # THIS GETS LOST.
],
prefix = "/lib",
)
```

I have to fake it with
```
pkg_mklink(
name = "absolute_link",
link_name = "/lib/fake.so.1",
target = "fake.so.1.2.3",
)
```
and including `absolute_link` in my final `pkg_{tar|rpm|install}`.

## posible solutions

1. Make it work with no surprises.
2. Add prefix to `pkg_mklink`.

But I am thinking that we need both. Put the prefix in the provider and have pkg_files rewrite the provider with the new link.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.