Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 624618 - Portage regression FEATURES=mirror misbehaves with REQUIRED_USE/EAPI=5
Summary: Portage regression FEATURES=mirror misbehaves with REQUIRED_USE/EAPI=5
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-11 20:06 UTC by Bruno Henc
Modified: 2017-08-13 23:47 UTC (History)
2 users (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 Bruno Henc 2017-07-11 20:06:15 UTC
man make.conf states for FEATURES="mirror" the following:
mirror Fetch  everything  in  SRC_URI  regardless of USE settings, except do not fetch anything when mirror is in RESTRICT.

FEATURES="mirror" does not know how to handle REQUIRED_USE . Trying to fetch
an ebuild without the correct REQUIRED_USE set will result in failure.
The features="mirror" code is older than EAPI 5.

Reproducible: Always

Steps to Reproduce:
1. Find an ebuild that you don't have the necessary required_use flags for.
A good example is app-office/unoconv-0.7 from https://github.com/antematherian/portage-regression-overlay
2. add FEATURES="mirror" to /etc/portage/make.conf
3. run: ebuild <ebuildname>.ebuild fetch
Actual Results:  
ebuild unoconv-0.7.ebuild fetch
Appending /var/gentoo/portage-regression-overlay to PORTDIR_OVERLAY...

  The following REQUIRED_USE flag constraints are unsatisfied:
    ^^ ( python_single_target_python2_7 python_single_target_python3_4 python_single_target_python3_5 )

  The above constraints are a subset of the following complete expression:
    exactly-one-of ( python_single_target_python2_7 python_single_target_python3_4 python_single_target_python3_5 ) python_single_target_python2_7? ( python_targets_python2_7 ) python_single_target_python3_4? ( python_targets_python3_4 ) python_single_target_python3_5? ( python_targets_python3_5 )



Expected Results:  
When you patch around the behavior, unoconv-0.7 downloads correctly.

To fix this and only this problem with FEATURES="mirror" patch the following
if block:
https://github.com/gentoo/portage/blob/master/pym/portage/package/ebuild/doebuild.py#L1426-L1431
Method a) This method completely skips required_use checks for the ebuild fetch phase.
--- doebuild.py.orig	2017-07-11 19:43:00.029334308 +0000
+++ doebuild.py	2017-07-11 19:43:14.133404246 +0000
@@ -1424,7 +1424,7 @@
 			return 1
 
 	if not pkg.built and \
-		mydo not in ("digest", "help", "manifest") and \
+		mydo not in ("digest", "help", "manifest", "fetch") and \
 		pkg._metadata["REQUIRED_USE"] and \
 		eapi_has_required_use(pkg.eapi):
 		result = check_required_use(pkg._metadata["REQUIRED_USE"],



Method b) Check for features=mirror and add the "fetch" phase to the above set
of phase functions which skip the required_use check.

--- doebuild.py.orig    2017-07-11 19:43:00.029334308 +0000
+++ doebuild.py 2017-07-11 19:58:20.533898844 +0000
@@ -1422,9 +1422,11 @@
                                level=logging.ERROR, noiselevel=-1)
                if mydo not in invalid_dep_exempt_phases:
                        return 1
-
+       phase_func_skip_required_use = ["digest", "help", "manifest"]
+       if "mirror" in mysettings.features:
+               phase_func_skip_required_use.append("fetch")
        if not pkg.built and \
-               mydo not in ("digest", "help", "manifest") and \
+               mydo not in phase_func_skip_required_use and \
                pkg._metadata["REQUIRED_USE"] and \
                eapi_has_required_use(pkg.eapi):
                result = check_required_use(pkg._metadata["REQUIRED_USE"],

Method b) does not cover the fetchall case, you'll probably have to modify the function definition to do that. And you'll probably have to rebase the patches.
Comment 1 Bruno Henc 2017-07-11 20:09:43 UTC
Thanks to [Arfrever] for providing me with info on the history of EAPI 5 and FEATURES="mirror"
Comment 2 Bruno Henc 2017-07-11 20:56:49 UTC
A simple way to trigger the bug is to delete the /etc/portage/make.profile symlink and try to emerge any ebuild with REQUIRED_USE.