Closed truist closed 6 years ago
I've been taking a look at this... and the solution may be uglier than what's already happening.
The problem is that pbulk likes to clean the "build client" at startup, and then re-extracts the bootstrap kit. This means that the mk.conf
file is always fresh at the beginning of each build, and that the contents of mk.conf
are determined by what's inside bootstrap.tgz
— which in turn means that mk.conf
must contain all correct settings for package building from the very beginning and that configuring the file post-bootstrap in a sandbox-specific way doesn't work.
The only solution I see is to:
bootstrap
without --mk-fragment
so that the bootstrap process generates a "clean" mk.conf
file.bootstrap.tgz
file in a temporary location.mk.conf
file to include the sandbox-specific configuration.bootstrap-sandbox.tgz
file.bootstrap-sandbox.tgz
instead of bootstrap.tgz
.The reason this is ugly is because bootstrap-sandbox.tgz
will either be leaked to the packages tree, or this file will have to be recreated on each pkg_comp invocation.
Alternatively... I could modify pbulk to support an extra "mk fragment" and let it deal with it. But that doesn't seem easy either.
I've just uploaded a possible fix for this. Will merge after testing passes, and possibly tomorrow anyway. Please take a look.
I'll look at the diff one evening soon. One thought, first - I have already put .sinclude "/etc/pkg_comp/extra.mk.conf"
into /etc/mk.conf
, so that I can get e.g. make show-options
to work correctly outside of the sandbox. That isn't strictly related to this issue (i.e. the /pkg_comp/
include is still odd and has a slim chance of grabbing the wrong file), but it makes it clear to me that there is a maintenance issue here - given a default install of pkg_comp
, where should I put my package-specific settings? And if I put them into e.g. /etc.pkg_comp/extra.mk.conf
, how do I get /etc/mk.conf
to know about them?
What if, instead of replacing /etc/mk.conf
with a pkg_comp
-specific one (in the sandbox), you appended all the settings you need to override (to the one in the sandbox), and kept a hard reference to e.g. /etc/pkg_comp/extra.mk.conf
in /etc/mk.conf
? Or even kill off /etc/pkg_comp/extra.mk.conf
entirely, just use /etc/mk.conf
, and override the relevant settings (by appending to the file) in the sandbox?
Alright! After a really long time, I retook the patch I was playing with, made it work (after rewriting it from scratch...) and submitted a fix. I think this should work.
(The reason I got stuck at first is because I had to shard the integration tests so that they didn't run over Travis CI limits, and I was pretty lazy to do so. Turns out this wasn't that hard.)
Per my comment on your blog post:
To rephrase: the mk.conf that is extracted from the bootstrap archive has
.sinclude "/pkg_comp/pkg.mk.conf"
in it. That path only makes sense from inside the sandbox, but that file ends up in a place where it has an effect outside the sandbox. It's confusing, and worst-case someone could end up with a matching path and unintended consequences.