feat: Add "force_implicit_dirs" to dir/tree.#948
Conversation
erikgeiser
left a comment
There was a problem hiding this comment.
I like this proposal. However, we would need a test as well. Don't worry, I'll update the PR myself.
3550686 to
e125e10
Compare
This allows users to specify a list of directories to treat akin to the list of system directories, i.e. things that the constructed package should *not* take ownership of in e.g. the rpm database. Example use case: 1) user belongs to FooCorp 2) FooCorp has many packages to install under /opt/foocorp e.g. /opt/foocorp/service[A,B,C...] 3) Using tree w/ forced implicit dirs keeps generated package(s) from claiming ownership of /opt/foocorp so that the service[A,B,C...] packages can be bundled and installed separately without path conflicts. The particular scenario I ran into this for was with RHEL8+ being much pickier about each dir being owned by one and only one package. (We pair this with having one "foocorp-dirs" package that just owns the shared dir creation, that's used as a pre-req for the other packages.)
b38842a to
ffb107d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #948 +/- ##
==========================================
+ Coverage 73.64% 73.76% +0.12%
==========================================
Files 23 23
Lines 2758 2771 +13
==========================================
+ Hits 2031 2044 +13
Misses 507 507
Partials 220 220 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Before I merge this, I would like to ask @caarlos0 or @djgilcrease what they think about the name I also added a fix to an issue which is currently present in |
|
Thank you, Erik! I had sort of forgotten about this (and have moved on from the company that needed it), but it's good to see it getting some traction. The (edit to add: I looked at the failing checks. The semgrep failure is complaining about something in msix/msix.go which afaict is unrelated to this PR and the docs build appears to relate to populating author info in an rss feed; sadly I don't know enough about the project to know what the right fixes might be for either, but if needed I can make some educated guesses.) |
|
Sorry for not being able to review this PR when you actually needed it. Yes the CI issues are not related to this PR, so it could be merged as-is. |
This allows users to specify a list of directories to treat akin to the list of system directories, i.e. things that the constructed package should not take ownership of in e.g. the rpm database. (I'm 100% open to a better name for that, btw!)
Example use case:
e.g. /opt/foocorp/service[A,B,C...]
from claiming ownership of /opt/foocorp so that the
service[A,B,C...] packages can be bundled and installed
separately without path conflicts.
The particular scenario I ran into this for was with RHEL8+ being much pickier about each dir being owned by one and only one package. (We pair this with having one "foocorp-dirs" package that just owns the shared dir creation, that's used as a pre-req for the other packages.) We could have done something like explicitly list every sub-dir needed or every file for all the service packages, but using
treewas much more concise and flexible with respect to package contents changing over time, and in effect this is giving the user the ability to specify dirs to treat like the hard-coded list of system directories already checked towards the same end.I have run
task ciand the normal tests pass. There seems to be some issue withopkggoing away on the latest OpenWRT images that keeps theipkacceptance test from working though:Sadly I don't know enough about OpenWRT/opkg/Docker to guess what the right solution would be for that, so I haven't included any changes for it.
Thank you for a cool tool! :)