Running emerge --onlydeps --onlydeps-with-rdeps=n ${package} followed by emerge --nodeps ${package} results in emerge failures if ${package} has any IDEPENDS. For example this happens for any package that IDEPENDS on acct-user and acct-group. Reproducible: Always
I think the current behavior actually makes some sense. The original intent of --onlydeps-with-rdeps=n was to install the build-time dependencies. Since you aren't actually installing $package, the install-time dependencies are not pulled in. This might be useful if you were to follow it up with emerge --buildpkgonly $package to build but not install it. When you run emerge --nodeps $package, no dependencies are pulled in, including the install-time dependencies of $package. We might need a new option to cover the scenario you have outlined.
I can definitely see "--onlydeps-with-rdeps=n" meaning "BDEPENDS only" aka nothing that is also a runtime dependency so a different option might be reasonable the set is slightly different and both are useful in different situations. --buildpkgonly might work for my particular case, however the issue is that I don't think it is currently possible to install a package without also pulling in all the runtime dependencies if it has IDEPENDS (as strange as the usecase might sound).
Installing packages with --nodeps isn't something we promote in general. Why do you need to install a package without its runtime dependencies?
One reason is to test to make sure that acct-user and acct-group install and that pkg_install works correctly without needing all the runtime dependencies.
That doesn't really answer my question. I don't understand how installing a package without its runtime deps is generally valid or useful. If you just want to ensure the IDEPEND deps get pulled in correctly, you can run emerge --pretend $package. If you want to ensure the acct-group and acct-user packages work correctly, you can install them by running emerge --oneshot acct-group/foo acct-user/foo.
I do this in bulk for a single world file with 40ish entries that expand to over 600 packages and where it is not possible to know for sure in advance which acct- packages will be pulled in so they can't easily be tested individually. There are ways that I could pull out the acct- packages via some horrible grep hackery but that doesn't work if there is an IDEPENDS that is something other than an acct- packages. In that case there is no way to automate the process and the user would have to inspect every single ebuild to find the IDEPENDS, or have to call emerge repeatedly to find missing packages when an install failed. A concrete use case for this functionality would be producing docker images that installed only a single package at a time so that the image is in the final installed state but without runtime dependencies, which would come from other images built in the same way and then composed (not exactly the best idea in practice, but something that someone might want to do).
I still don't fully understand why you are doing this, but if you want to submit a patch to change the behavior I guess that would be fine.
Here's a first pass for discussion. https://github.com/gentoo/portage/pull/979
`emerge --depclean --with-bdeps=n` doesn't clean a package from IDEPEND (only). Is it the same issue?
(In reply to Alexander Kurakin from comment #9) > `emerge --depclean --with-bdeps=n` doesn't clean a package from IDEPEND > (only). Is it the same issue? No, likely a sep. bug. Please file one.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=c65bbcf7630f454ce84a4fa6b8ebff8488c6bfb2 commit c65bbcf7630f454ce84a4fa6b8ebff8488c6bfb2 Author: Tom Gillespie <tgbugs@gmail.com> AuthorDate: 2023-01-15 22:46:25 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-17 05:49:01 +0000 emerge: add --onlydeps-with-ideps=<y|n> option (bug 890777) Add --onlydeps-with-ideps option in order to include install-time dependencies with --onlydeps and --onlydeps-with-rdeps=n. The dependencies that get pulled in are those that are necessary for emerge --nodeps to succeed when run after the equivalent --onlydeps. The default --onlydeps --onlydeps-with-rdeps=n behavior is unchanged. This also adds a new test file test_onlydeps_ideps.py that is derived from test_onlydeps_minimal.py and tests the behavior for EAPI={7,8}. Additional tests have been added to test_onlydeps_minimal.py to ensure that the behavior at EAPI=0 remains unchanged. Bug: https://bugs.gentoo.org/890777 Signed-off-by: Tom Gillespie <tgbugs@gmail.com> Closes: https://github.com/gentoo/portage/pull/979 Signed-off-by: Sam James <sam@gentoo.org> NEWS | 1 + lib/_emerge/depgraph.py | 3 +- lib/_emerge/main.py | 9 +- lib/portage/tests/resolver/test_onlydeps_ideps.py | 172 +++++++++++++++++++++ .../tests/resolver/test_onlydeps_minimal.py | 25 +++ man/emerge.1 | 5 + 6 files changed, 212 insertions(+), 3 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cd8ade10313d72cb0e3dd2229df02e0ea8681daa commit cd8ade10313d72cb0e3dd2229df02e0ea8681daa Author: Sam James <sam@gentoo.org> AuthorDate: 2023-02-26 22:01:01 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-26 22:01:10 +0000 sys-apps/portage: add 3.0.45 Bug: https://bugs.gentoo.org/891001 Bug: https://bugs.gentoo.org/889330 Bug: https://bugs.gentoo.org/890777 Bug: https://bugs.gentoo.org/891391 Bug: https://bugs.gentoo.org/893638 Bug: https://bugs.gentoo.org/795825 Bug: https://bugs.gentoo.org/884869 Bug: https://bugs.gentoo.org/888585 Bug: https://bugs.gentoo.org/892651 Bug: https://bugs.gentoo.org/895526 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.45.ebuild | 288 +++++++++++++++++++++++++++++++++ 2 files changed, 289 insertions(+)