Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 949696 - [Future EAPI] No longer declare EBUILD_PHASE (or EBUILD_PHASE_FUNC)
Summary: [Future EAPI] No longer declare EBUILD_PHASE (or EBUILD_PHASE_FUNC)
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PMS/EAPI (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Package Manager Specification
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: future-eapi
  Show dependency tree
 
Reported: 2025-02-13 09:34 UTC by Florian Schmaus
Modified: 2025-02-13 17:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Related discussion in #gentoo-qa (phase-func-discussion.txt,6.02 KB, text/plain)
2025-02-13 09:34 UTC, Florian Schmaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Schmaus gentoo-dev 2025-02-13 09:34:37 UTC
Created attachment 918886 [details]
Related discussion in #gentoo-qa

Current EAPIs declare EBUILD_PHASE (since EAPI 0) and EBUILD_PHASE_FUNC (since EAPI 5). Both variables are very similar; their only difference is that EBUILD_PHASE contains the "non-namespaced" phase function name, whereas EBUILD_PHASE_FUNC contains the "namespaced" version:

| EBUILD_PHASE | EBUILD_PHASE_FUNC |
|--------------+-------------------|
| config       | pkg_config        |
| setup        | pkg_setup         |
| nofetch      | pkg_nofetch       |
| unpack       | src_unpack        |
| prepare      | src_prepare       |
| configure    | src_configure     |
| compile      | src_compile       |
| test         | src_test          |
| install      | src_install       |
| preinst      | pkg_preinst       |
| postinst     | pkg_postinst      |
| prerm        | pkg_prerm         |
| postrm       | pkg_postrm        |
| info         | pkg_info          |
| pretend      | pkg_pretend       |

The existence of two variables has the potential to confuse ebuild authors. When should EBUILD_PHASE be used, and when EBUILD_PHASE_FUNC?

Therefore, future EAPIs should no longer export one of those variables. Keeping EBUILD_PHASE_FUNC and dropping EBUILD_PHASE allows us to introduce phase functions like pkg_test (bug #402581), which would be ambiguous in EBUILD_PHASE.
Comment 1 Ulrich Müller gentoo-dev 2025-02-13 11:02:16 UTC
As I said in the IRC discussion, I see little incentive for removal of these variables. Probably we wouldn't have added EBUILD_PHASE_FUNC if we had known in advance that 13 years later it was used by only 7 packages.

Then again, supporting both is trivial, and removal would just add additional complexity to both the spec and package managers (with less complexity when removing EBUILD_PHASE_FUNC because we already have an EAPI conditional for it).

Another option would be to label one of them as deprecated in the documentation but keep them both in the spec (similar as we did for useq and hasq, which were later removed for a different reason).
Comment 2 Ulrich Müller gentoo-dev 2025-02-13 17:16:35 UTC
Thinking about it, these variable names are somewhat irregular because functions and variables that contain the string "ebuild" (ignoring case) are reserved for package manager use by section 12.3.17 of the spec:
https://dev.gentoo.org/~ulm/pms/head/pms.html#section-12.3.17

Apparently these two are the only exceptions:
https://devmanual.gentoo.org/ebuild-writing/variables/index.html#variables-reserved-for-the-package-manager

So if we would decide to touch this, then maybe we should seize the opportunity and drop _both_ variables. We could then introduce a new one with a more regular name like PHASE_FUNCTION.