Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 890777 - sys-apps/portage --onlydeps-with-rdeps=n excludes IDEPENDS
Summary: sys-apps/portage --onlydeps-with-rdeps=n excludes IDEPENDS
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 891001
Blocks:
  Show dependency tree
 
Reported: 2023-01-14 05:10 UTC by Tom Gillespie
Modified: 2023-02-26 22:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Gillespie 2023-01-14 05:10:21 UTC
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
Comment 1 Mike Gilbert gentoo-dev 2023-01-15 02:18:40 UTC
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.
Comment 2 Tom Gillespie 2023-01-15 04:35:38 UTC
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).
Comment 3 Mike Gilbert gentoo-dev 2023-01-15 14:57:19 UTC
Installing packages with --nodeps isn't something we promote in general.

Why do you need to install a package without its runtime dependencies?
Comment 4 Tom Gillespie 2023-01-15 19:43:08 UTC
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.
Comment 5 Mike Gilbert gentoo-dev 2023-01-15 20:03:41 UTC
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.
Comment 6 Tom Gillespie 2023-01-15 21:01:24 UTC
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).
Comment 7 Mike Gilbert gentoo-dev 2023-01-15 21:28:05 UTC
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.
Comment 8 Tom Gillespie 2023-01-15 22:53:54 UTC
Here's a first pass for discussion.

https://github.com/gentoo/portage/pull/979
Comment 9 Alexander Kurakin 2023-01-29 22:23:57 UTC
`emerge --depclean --with-bdeps=n` doesn't clean a package from IDEPEND (only). Is it the same issue?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-29 23:04:46 UTC
(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.
Comment 11 Larry the Git Cow gentoo-dev 2023-02-17 05:50:13 UTC
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(-)
Comment 12 Larry the Git Cow gentoo-dev 2023-02-26 22:01:29 UTC
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(+)