pkg_rpm: Specify _topdir for install stanza#763
pkg_rpm: Specify _topdir for install stanza#763kellyma2 wants to merge 5 commits intobazelbuild:mainfrom
Conversation
If we don't specify the _topdir as part of the install-from path we
can't seem to find the correct files to install when using a set of
rules like:
pkg_filegroup(
name = "my_filegroup",
srcs = [
"//some/label:foo",
],
prefixs = "/usr/bin",
)
pkg_rpm(
name = "rpm",
...
srcs = [
":my_filegroup",
],
)
Adding '%{{_topdir}/BUILD/' as a prefix to the source path seems to
solve this problem.
01c66c9 to
45b0ff2
Compare
|
Can you add a test for this and explain more clearly what is failing? |
I'll try to rig up a test for this tomorrow and also provide more details. The tl;dr was that it couldn't find the expected inputs in the relative path, but putting the prefix in place means it becomes an absolute path and can be resolved. |
Still working through adding a test for this, but figured I'd provide a bit more detail as to what the failure (and my rules) look like. I'm using https://github.com/bazelbuild/examples/tree/main/cpp-tutorial/stage1 as a simple scaffold for verifying the failure. My rules are as follows:
Root BUILD: in WORKSPACE I'm configuring things with: Where @rules_pkg is just pointing at a fresh clone of rules_pkg in my local worktree. When I run |
|
That would be my expectation and with this PR it actually correctly points to it because the path ceases to be relative. When you take the example repo and apply my BUILD + WORKSPACE setup what do you get? Also, missed part of my WORKSPACE the correct variant also includes: |
|
Take a look at #770 I tried to prove your change works, but it failed in new and unexpected ways. |
|
After a bit of thrashing around with the Fedora docker image it seems like I got this working and it's using rpmbuild 4.18.1 - I'll see if I can upgrade rpmbuild in my build environment to determine if this also happens there. Secondary to this, should there be a minimum version check for the version of rpmbuild being used? |
If we don't specify the _topdir as part of the install-from path we can't seem to find the correct files to install when using a set of rules like:
Adding
%{{_topdir}/BUILD/as a prefix to the source path seems to solve this problem.