Skip to content

Commit

Permalink
ebuild: do not drop FEATURES=test when USE=-test
Browse files Browse the repository at this point in the history
By convention the "test" USE flag is used to control dependencies required
for execution of the src_test function.

The "test" USE flag has no special meaning in PMS.

The Gentoo Policy Guide [1] advises that ebuilds must make use of RESTRICT
to disable tests based on USE flags.

Current versions of Portage will not run tests when RESTRICT=test is
set, regardless of the FEATURES setting.

This code in Portage predates the Gentoo policy. It is unneeded since
the policy was created and ebuilds have been updated with the necessary
RESTRICT values.

Signed-off-by: Mike Gilbert <[email protected]>
  • Loading branch information
floppym committed Oct 4, 2023
1 parent f45e2bb commit b3b9bdb
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions lib/portage/package/ebuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2194,18 +2194,6 @@ def setcpv(self, mycpv, use_cache=None, mydb=None):
"BASH_FUNC____in_portage_iuse%%"
] = "() { [[ $1 =~ ${PORTAGE_IUSE} ]]; }"

ebuild_force_test = not restrict_test and self.get("EBUILD_FORCE_TEST") == "1"

if "test" in explicit_iuse or iuse_implicit_match("test"):
if "test" in self.features:
if ebuild_force_test and "test" in self.usemask:
self.usemask = frozenset(x for x in self.usemask if x != "test")
if restrict_test or ("test" in self.usemask and not ebuild_force_test):
# "test" is in IUSE and USE=test is masked, so execution
# of src_test() probably is not reliable. Therefore,
# temporarily disable FEATURES=test just for this package.
self["FEATURES"] = " ".join(x for x in self.features if x != "test")

# Allow _* flags from USE_EXPAND wildcards to pass through here.
use.difference_update(
[
Expand Down

0 comments on commit b3b9bdb

Please sign in to comment.