Some versions of the patch in #1356276: Allow profiles to define a base/parent profile allowed profiles to exclude config or dependencies inherited from a base distro/profile. This functionality was controversial, and so was postponed into this follow-up issue in order to unblock that one.
Problem/Motivation
From #1356276-376: Allow profiles to define a base/parent profile
excluded_dependenciesandexcluded_themes... are extremely valuable in real-life scenarios. For example, in D7 we used Panopoly as a base profile. We needed our own specific implementation of the Ckeditor wysiwyg so did not want to include the module dependency to panopoly_wysiwyg. Also, we didn't need the overhead of panopoly_search. By allowing subprofiles to exclude module/theme dependencies it gives greater flexibility to subprofiles to not have to find strange workarounds to remove modules that have no application in their specific use case.Another example is if a parent profile has a specific module that loads in default content. This is important for doing demos, but in my client's project I want that excluded since it has no application to what I'm building. A distro may want "required" modules like that on install for that distro alone, but it's not actually required in my distro even though I'm using it the other as a base profile.
Some concerns about supporting this have been expressed:
From #1356276-375: Allow profiles to define a base/parent profile
[This] violates the ideas of (1) security, (2) stability, (3) clear responsibilities, and (4) separation of concerns...
The fundamental idea of inheritance is aggregation of requirements. ... It is pretty hard to undo something a parent theme has set up – and it should be – because the whole point is that you want to use the parent theme's composition, configuration, and overall setup as a base for your own theme, including updates, upgrades, and upstream changes. If that isn't in line with your thinking, then you'd copy/fork the parent theme instead; simple as that.
"Inheritance" for install profiles just simply acts like "dependencies" for modules: In essence, it just ensures that profile A exists and is installed before profile B.
And that's literally all we should be shooting for here: Extending profile A with profile B. Just (1) extending its dependencies and (2) extending or overriding its configuration.
Anything else on top of that (blacklisting, reversing, muting, undoing, …) is not core material.
Proposed resolution
To be discussed.
User interface changes
None.
API changes
Override dependencies from the base profile using the syntax:
base profile:
name: BASE_PROFILE
excluded_dependencies:
- MODULE_NAME
excluded_themes:
- THEME_NAME
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 0001-Issue-2914389-by-phenaproxima-Allow-profiles-to-excl.patch | 1.69 KB | sylus |
| #14 | 2914389-14-do-not-test.patch | 1.56 KB | damontgomery |
| #11 | 2914389-11-do-not-test.patch | 1.56 KB | saltednut |
| #8 | 2914389-8-do-not-test.patch | 1.25 KB | phenaproxima |
| #5 | 2914389-5-do-not-test.patch | 1.73 KB | phenaproxima |
Comments
Comment #2
bircherActually I think this is very much related to: #820054: Add support for recommends[] and fix install profile dependency special casing
Profiles use dependencies now that are more like suggestions, and sub-profiles could easily turn them off (or actually better yet, copy them over to turn them on.)
Comment #4
phenaproximaCross-posted from #1356276-434: Allow profiles to define a base/parent profile:
Having re-read #1356276-370: Allow profiles to define a base/parent profile and #1356276-375: Allow profiles to define a base/parent profile, plus some of the surrounding discussion, and I'd like to make a suggestion: let's postpone this on #2952888: Allow install profiles to require modules.
I suggest this because #2952888: Allow install profiles to require modules allows profiles to explicitly define two groups of extensions: the actual hard dependencies of the profile, and the "optional" dependencies that comprise the profile's out-of-the-box functionality.
This simple change illuminates a straightforward way to exclude inherited dependencies. It means that the hard dependencies of the parent profiles can be maintained, and the soft dependencies (i.e., stuff to install that is not needed in order for the profile to function properly) can be massaged and excluded by sub-profiles. Everyone goes home happy.
Thoughts?
Comment #5
phenaproximaHere's an initial stab at this functionality, without any tests. I have attached a patch that implements this functionality on top of #1356276: Allow profiles to define a base/parent profile and a combined patch which contains #1356276-461: Allow profiles to define a base/parent profile as well.
Comment #8
phenaproximaRerolled.
Comment #10
akalam commentedIt look like the "exclude" key is only working for the direct parent on #8. Every profile under the inheritance hierarchy should explicitly declare its "exclusions".
Comment #11
saltednutHere's a reroll that assumes you've already applied https://www.drupal.org/files/issues/2018-10-23/1356276-549-8.6.x.patch from #1356276-549: Allow profiles to define a base/parent profile
Comment #14
damontgomery commentedI have re-created this for 8.8.0-alpha1 after applying https://www.drupal.org/files/issues/2019-10-21/1356276-88x-594.patch from https://www.drupal.org/project/drupal/issues/1356276?page=1#comment-1331....
Comment #16
joseph.olstadpatch 14 is ok
however:
9.1.x status: the prerequisite patch from #1356276: Allow profiles to define a base/parent profile needs a reroll
9.0.x status: the prerequisite patch from #1356276: Allow profiles to define a base/parent profile needs a reroll
For D9 compatibility please follow up in #1356276: Allow profiles to define a base/parent profile
Comment #18
sylus commentedI just rerolled this for 9.0.x on latest profile patch.
Comment #19
colanI just tried excluding some core modules (
block_content,comment,contact,image, andsearch) from Standard, which I'm extending, and it didn't work. Or rather, it worked, but then created some problems:So it seems like it's only possible to exclude modules without configuration in the parent.
Parent configuration for excluded modules should not be imported, but I don't think that's happening right now. Or am I missing something?
Comment #20
joseph.olstadsomething changed in core, this patch won't apply in 9.1.x / 9.2.x , things have moved around, might take a bit of digging to find out what is needed or maybe 'if' it's still needed?
Comment #21
kapilv commentedComment #22
kapilv commentedComment #23
akalam commented@colan IMO your issue is with configuration, not with the modules. In fact, you get the error because the patch is excluding search, comment, etc modules to be installed.
Taking a look into standard profile can be seen that those config entities are installed by the profile, not by the dependent module. For example:
web/core/profiles/standard/config/install/block.block.bartik_search.yml
web/core/profiles/standard/config/install/block_content.type.basic.yml
Comment #24
sulfikar_s commentedThe '/core/lib/Drupal/Core/Extension/ProfileExtensionList.php' file has been changed. There are no relatable contents, that's why the patch is failing to apply.
Moving back to NW!
Comment #27
vikashsoni commentedPatch not working in drupal-9.3.x-dev
Needs to re-roll
Comment #30
qzmenkoComment #31
akalam commentedThe changes of this patch are part of the patch #95 at #3266057-95: Allow profiles to define a base/parent profile [continue of #1356276]
Marking this issue as duplicated.