Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 373351 - [Future EAPI] Ban ECLASSDIR
Summary: [Future EAPI] Ban ECLASSDIR
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Package Manager Specification
URL:
Whiteboard: in-eapi-7
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2011-06-28 14:57 UTC by Michał Górny
Modified: 2018-04-30 22:46 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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-06-28 14:57:57 UTC
Right now, PMS defined the ECLASSDIR variable as:

	The full path to the master repository's eclass directory.

This seems to be currently used in two places:

1) libtool.eclass -- to determine the ELT-patches directory location,
2) eclass-manpages -- to find eclasses to generate manpages for.

I'd suggest making this variable available only to eclasses, and redefining it to:

	The full path to the directory containing the eclass currently being sourced.

This way, it would become repository-friendly preserving the expected behavior for 1).

I'm not sure, however, how to deal with 2). That seems to be a very specific ebuild. I guess it could use ${PORTDIR}/eclass or, even better, become versioned and refer to a versioned state of eclassdir.
Comment 1 Ciaran McCreesh 2011-06-28 15:09:24 UTC
I'd rather nuke it entirely, personally.
Comment 2 SpanKY gentoo-dev 2011-06-28 19:07:12 UTC
you cant nuke it without a valid replacement
Comment 3 Zac Medico gentoo-dev 2011-06-28 22:41:19 UTC
(In reply to comment #0)
>     The full path to the directory containing the eclass currently being
> sourced.

If the eclass needs access to this, it can always store the value of ${BASH_SOURCE[0]%/*} in a global variable when it's being sourced.
Comment 4 Ciaran McCreesh 2011-06-29 06:02:56 UTC
(In reply to comment #3)
> If the eclass needs access to this, it can always store the value of
> ${BASH_SOURCE[0]%/*} in a global variable when it's being sourced.

Pretty sure that isn't guaranteed to work, since global variables can take any legal value, and BASH_SOURCE is going to change when the env saving source kicks in.
Comment 5 Zac Medico gentoo-dev 2011-06-29 06:12:50 UTC
The global scope eclass code is only executed when it's initially sourced during the inherit and ${BASH_SOURCE[@]} happens to contain the desired info at that time. This global scope code can't be saved (thus there is no interference from later env saving/sourcing), but its side-effect variable settings persist just like any other global scope variable settings.
Comment 6 Ciaran McCreesh 2011-06-29 06:17:38 UTC
Do we specify that? I seem to recall the wording being extremely open on how all that's done, since Portage has done different things over time.
Comment 7 Zac Medico gentoo-dev 2011-06-29 06:26:41 UTC
It should work with all versions of portage that have supported environment saving. It seems like it would be pretty likely to work with any package manager, unless they have some really strange implementation details. Even something as strange as libbash should be able to support it as long as ${BASH_SOURCE[@]} is given an appropriate setting during inherit.
Comment 8 Ulrich Müller gentoo-dev 2011-06-29 07:15:36 UTC
(In reply to comment #7)
> It should work with all versions of portage that have supported environment
> saving. It seems like it would be pretty likely to work with any package
> manager, unless they have some really strange implementation details. Even
> something as strange as libbash should be able to support it as long as
> ${BASH_SOURCE[@]} is given an appropriate setting during inherit.

Why should we be jumping though such hoops? Either ECLASSDIR is not needed, then drop it and be done. Or, if it turns out that it is still needed, keep it as a variable that is assigned by the PM.

Every such change to the spec adds complexity (like case distinctions in the package manager, and additional things that devs must remember).
Comment 9 Zac Medico gentoo-dev 2011-06-29 07:24:33 UTC
Shrug, I just mentioned ${BASH_SOURCE[@]} because it seemed like it would work in practice. I don't really care what we do or don't do with ECLASSDIR.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2011-06-29 10:15:52 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > It should work with all versions of portage that have supported environment
> > saving. It seems like it would be pretty likely to work with any package
> > manager, unless they have some really strange implementation details. Even
> > something as strange as libbash should be able to support it as long as
> > ${BASH_SOURCE[@]} is given an appropriate setting during inherit.
> 
> Why should we be jumping though such hoops? Either ECLASSDIR is not needed,
> then drop it and be done. Or, if it turns out that it is still needed, keep it
> as a variable that is assigned by the PM.
> 
> Every such change to the spec adds complexity (like case distinctions in the
> package manager, and additional things that devs must remember).

In this particular case, it wouldn't be a case distinction but a move to another section. But EAPI distinction would probably be necessary anyway.

I would really appreciate if it really could get as one step farther into an open repository model, with ECLASSDIR being useful to overlays as well.
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-11-21 18:47:41 UTC
So let's summarize the issues with ECLASSDIR:

a. eclasses can come from multiple repositories,

b. it is used to store random data that we have no clue where to get it from.

As I see, the options are:

1. ban ECLASSDIR and storing random data inside repository. Move libtool patches somewhere sane (like a package), fix eclass-manpages to respect repositories properly (the whole thing is a huge hack anyway).

2. Make ECLASSDIR reference a 'virtual' directory (i.e. a directory of symlinks) combining eclasses inherited by ebuild. Since afterwards none of the current uses will be possible, we can also immediately go for 1.

3. Make ECLASSDIR valid for eclasses only, with it being set by inherit to the directory where the sourced eclass resides. This lets libtool.eclass work as-is but it will obviously fail when copied to another repository.

4. Provide a proper storage and accessors for eclass data. Doubt it's worth the effort for a single ugly eclass.

I'd lean towards 1. here since the use is really minimal, or 2. if we really have to agree on something ugly for a single developer who can't live without putting cheap hacks everywhere.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-11-21 19:01:10 UTC
Bug #517752 provides another problem with ECLASSDIR: eclass-overrides turn it into a huge mess.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-09-03 14:11:08 UTC
As of today, there are no uses in Gentoo left*. Both cases listed in #c0 are gone now.

* there is use in profiles/default/bsd/fbsd/profile.bashrc to reference a patch from ELT-patches but they are gone now, so it's broken anyway.
Comment 14 Alexis Ballier gentoo-dev 2017-09-04 07:06:50 UTC
(In reply to Michał Górny from comment #13)
> As of today, there are no uses in Gentoo left*. Both cases listed in #c0 are
> gone now.
> 
> * there is use in profiles/default/bsd/fbsd/profile.bashrc to reference a
> patch from ELT-patches but they are gone now, so it's broken anyway.

This should have been handled before making the ELT-patches changes...
This deserves a new bug I think, it will pollute this one otherwise.
Comment 15 Larry the Git Cow gentoo-dev 2018-03-11 11:44:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=802e7d0bdd967d28c6dbb31fd84e8dfd540d794a

commit 802e7d0bdd967d28c6dbb31fd84e8dfd540d794a
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-02-27 18:53:02 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-03-11 11:43:41 +0000

    Do not export PORTDIR & ECLASSDIR in EAPI 7
    
    Bug: https://bugs.gentoo.org/373349
    Bug: https://bugs.gentoo.org/373351
    Closes: https://github.com/gentoo/portage/pull/264

 bin/eapi.sh                            |  4 ++++
 bin/phase-functions.sh                 |  6 ++++--
 pym/portage/eapi.py                    | 11 +++++++++++
 pym/portage/package/ebuild/config.py   |  5 +++++
 pym/portage/package/ebuild/doebuild.py |  8 ++++----
 5 files changed, 28 insertions(+), 6 deletions(-)}
Comment 16 Larry the Git Cow gentoo-dev 2018-04-30 22:14:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/pms.git/commit/?id=3abcd75afc8a8ed4400ecd66cc4f129a4bf46330

commit 3abcd75afc8a8ed4400ecd66cc4f129a4bf46330
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2017-09-29 03:17:43 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2018-03-30 16:35:43 +0000

    EAPI 7 removes PORTDIR and ECLASSDIR.
    
    Bug: https://bugs.gentoo.org/373349
    Bug: https://bugs.gentoo.org/373351

 eapi-differences.tex |  8 ++++++++
 ebuild-env-vars.tex  | 17 +++++++++++------
 2 files changed, 19 insertions(+), 6 deletions(-)}