rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

pkg_files ignores included pkg_mklinks

Open aiuto opened this issue 3 months ago • 1 comments

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.

aiuto avatar Oct 08 '25 14:10 aiuto