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_dependencies and excluded_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

Comments

jonathanshaw created an issue. See original summary.

bircher’s picture

Actually 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.)

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

phenaproxima’s picture

Cross-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?

phenaproxima’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new49.61 KB
new1.73 KB

Here'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.

The last submitted patch, 5: 2914389-5-combined.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

The last submitted patch, 5: 2914389-5-combined.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

phenaproxima’s picture

StatusFileSize
new1.25 KB

Rerolled.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

akalam’s picture

It 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".

saltednut’s picture

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

damontgomery’s picture

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

joseph.olstad’s picture

patch 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

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

sylus’s picture

I just rerolled this for 9.0.x on latest profile patch.

colan’s picture

Status: Needs review » Needs work

I just tried excluding some core modules (block_content, comment, contact, image, and search) from Standard, which I'm extending, and it didn't work. Or rather, it worked, but then created some problems:

In UnmetDependenciesException.php line 98:

[Drupal\Core\Config\UnmetDependenciesException]
Configuration objects provided by standard have unmet dependencies: block.block.bartik_search (search), block_content.type.basic (block_content), comment.type.comment (comment), contact.form.feedback (contact), core.entity_form_display.node.article.default (image.style.thumbnail, comment, image), core.entity_form_display.user.user.default (image.style.thumbnail, image), core.entity_view_display.node.article.default (image.style.large, comment, image), core.entity_view_display.node.article.teaser (image.style.medium, image), field.field.block_content.basic.body (field.storage.block_content.body), field.field.comment.comment.comment_body (field.storage.comment.comment_body), field.field.node.article.field_image (image)

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?

joseph.olstad’s picture

something 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?

kapilv’s picture

Assigned: Unassigned » kapilv
kapilv’s picture

Assigned: kapilv » Unassigned
akalam’s picture

Status: Needs work » Needs review

@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

sulfikar_s’s picture

Status: Needs review » Needs work

The '/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!

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vikashsoni’s picture

Patch not working in drupal-9.3.x-dev
Needs to re-roll

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

akalam’s picture

Status: Needs work » Closed (duplicate)

The 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.