Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 675284 - Add emerge `-T` parameter to enable testing the package list exclusively. This prevents USE="test" propagation to testing dependencies.
Summary: Add emerge `-T` parameter to enable testing the package list exclusively. Thi...
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 912975
  Show dependency tree
 
Reported: 2019-01-12 20:45 UTC by Horea Christian
Modified: 2023-08-24 20:19 UTC (History)
0 users

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 Horea Christian 2019-01-12 20:45:51 UTC
The Problem
-----------

I very often encounter this issue when attempting to test a package in a one-off fashion.

In ideal cases, where all deps are already present for other reasons than being required by the package at hand, this works nicely with 

    FEATURES="test" emerge -av mypackage

However, if dependencies are missing, testing propagates throughout the stack.
Attempts to solve this via:

    emerge -av --onlydeps mypackage
    FEATURES="test" emerge -av mypackage

work, but only if there are no dedicated testing deps, or these are already present (plus this is already starting to become 2 commands for 1 operation).
If the USE flag has its own dependencies and these are not already elsewise provided, both approaches above will result in the USE flag propagating throughout this missing stack segment. The slightly smarter:

    USE=test emerge -av --onlydeps mypackage
    FEATURES="test" emerge -av mypackage

Will not help either.


Proposed Solution
-----------------

This confusion of course doesn't come out of nowhere, and I too cannot think of an easy way to sort it out using just the USE and FEATURE variables. 
Ideally there would be an additional command line parameter, which would simply enable testing of the listed packages and only the listed packages.
Conveniently, the letter T is not yet taken:

    emerge -Tav mypackage
Comment 1 Zac Medico gentoo-dev 2019-01-13 21:41:17 UTC
Does the emerge --with-test-deps option do what you want?
Comment 2 Horea Christian 2019-01-14 13:55:18 UTC
so you mean something like:

    emerge -v samri --with-test-deps && FEATURES=test emerge -v samri

This, indeed works. I was unaware of the option. I guess I can just alias this to one command for convenience. But don't you think it makes sense to have this as a unitary function in portage? if not, what is the standalone purpose of the `--with-test-deps` option? the man page seems very brief on this.
Comment 3 Zac Medico gentoo-dev 2019-01-14 20:01:47 UTC
(In reply to Horea Christian from comment #2)
> so you mean something like:
> 
>     emerge -v samri --with-test-deps && FEATURES=test emerge -v samri
> 
> This, indeed works. I was unaware of the option. I guess I can just alias
> this to one command for convenience. But don't you think it makes sense to
> have this as a unitary function in portage?

Maybe so. However, note that this temporarily enables USE=test for the package, effectively creating a non-persistent setting that will revert the next time the package is rebuilt (possibly triggered by --changed-use or --newuse options). You can create a persistent FEATURES setting for a specific package via package.env as describe here:

https://wiki.gentoo.org/wiki//etc/portage/package.env

> if not, what is the standalone
> purpose of the `--with-test-deps` option? the man page seems very brief on
> this.

A common pattern for purposes of ebuild development is to use --with-test-deps together with --onlydeps, so that the test dependencies are available when running unit tests via the ebuild(1) command.
Comment 4 Horea Christian 2019-01-16 16:15:24 UTC
>effectively creating a non-persistent setting that will revert the next time the >package is rebuilt (possibly triggered by --changed-use or --newuse options).

When I'm debugging or testing a package in a one-off fashion (which is why I manually input the package name in the emerge command here), that sounds like pretty much exactly what I want. That is the chief problem I have with `package.env`, some tests take for ever and I certainly don't want to have them run every single time I rebuild, nor do I think it is good tp to have to toggle lines in a conf file, when a single parameter on the command line would be wholly sufficient to capture the “complexity” of the instructions.