Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 612972

Summary: Portage should use a consistent value for DISTDIR in the ebuild environment
Product: Portage Development Reporter: Ulrich Müller <ulm>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: mgorny
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://archives.gentoo.org/gentoo-portage-dev/message/f64b4a0e0837f8197479129fa3f9cc2d
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 649712, 645194    

Description Ulrich Müller gentoo-dev 2017-03-18 06:54:22 UTC
In EAPI 6 ebuilds can apply patches in default_src_prepare by assigning the PATCHES variable in global scope. For example:

PATCHES=( "${DISTDIR}"/foo.patch )

Similar to FILESDIR, DISTDIR should have the same value in global scope as it has in the src_* phases. Otherwise, PATCHES could contain a file that is not in ${A}, which defeats the purpose of having a fake DISTDIR.
Comment 1 Larry the Git Cow gentoo-dev 2018-01-26 14:59:06 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=8aa99e78bb89615bb25044183e160a7bf7facc2d

commit 8aa99e78bb89615bb25044183e160a7bf7facc2d
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-01-25 08:29:07 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-01-26 14:58:59 +0000

    portage.package.ebuild.config: Override DISTDIR unconditionally
    
    Ensure that DISTDIR is always defined to the path to the shadow
    directory. This ensures that PMS rules for consistent value are
    followed, and that no global scope calls should be able to access
    the distfile directory. This also ensures that global-scope assignments
    (e.g. in PATCHES) do not work around the shadow directory.
    
    Bug: https://bugs.gentoo.org/612972
    Reviewed-by: Zac Medico <zmedico@gentoo.org>

 pym/portage/package/ebuild/config.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)}