Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

omkar.podey created an issue. See original summary.

yash.rode’s picture

I think this one will need input from #3334994: Add new InstalledPackagesList which does not rely on Composer API to get package info, as we need list of installed packages.

omkar.podey’s picture

Assigned: Unassigned » omkar.podey
omkar.podey’s picture

Issue summary: View changes
FileSize
160.93 KB

@travis.carden the proposed change in question

omkar.podey’s picture

So @ted.bow if it was okay to call composerInspector->getConfig() while passing a working directory for the core's composer json to fetch the extra config ? (could also be called with --no-plugins to make it safer but would that be enough ?)

wim leers’s picture

omkar.podey’s picture

Assigned: omkar.podey » tedbow
Status: Active » Needs work

@ted.bow could you leave a comment here about the discussion you had with @travis.carden.

wim leers’s picture

wim leers’s picture

Assigned: tedbow » Unassigned

While we should still get that input from @tedbow, meanwhile this MR can be rebased on top of #3334994: Add new InstalledPackagesList which does not rely on Composer API to get package info! 👍

tedbow’s picture

tedbow’s picture

Assigned: Unassigned » omkar.podey

@omkar.podey add an issue summary here? thanks

phenaproxima’s picture

Regarding #6, I discussed this with @tedbow.

I did a little experimentation to see if a Composer plugin could alter the file mapping defined by drupal/core, that gets written to installed.json and composer.lock.

The answer is yes, it could be done, if the plugin did something similar to what cweagans/composer-patches used to do. I don't, however, think that's especially likely to happen.

The real problem is that we do not properly account for the overridability of scaffold file mappings supported by the scaffold plugin, and we never have. I've opened a post-MVP issue to deal with that.

For that reason, @tedbow and I agreed that it's okay for us to change the validator to call $composerInspector->getConfig('extra.drupal-scaffold.file-mapping', $installed_packages['drupal/core']->path). Doing that will get the file mapping defined by core, which is not guaranteed to be complete or accurate for the actual project using Package Manager -- but it also doesn't make the current situation any worse. And it helps get us off of ComposerUtility.

phenaproxima’s picture

Yeah, that sucks...composer.lock isn't there in core's directory (and rightfully so), and therefore ComposerInspector::validate() throws an exception when it tries to validate that. The only real way out of this pickle is for us to stop requiring the presence of composer.lock, but that means we can't get the types of installed packages until Composer merges and tags https://github.com/composer/composer/pull/11340. Maddening.

Here's what I would suggest: we should change validate() so that it doesn't require composer.lock to exist, but getInstalledPackagesList() does. I think this is a reasonable course of action because a) it doesn't change or complicate our API, and b) getInstalledPackagesList() is the only thing that needs to deal with composer.lock.

phenaproxima’s picture

Traced into some of the failures and the reason why it's going to keep failing is because the changed scaffold file mapping has to be defined in path/to/stage/dir/vendor/drupal/core/composer.json. Not installed.json, which is where ComposerUtility would read it from.

Hopefully the fixture manipulator is smart enough to do that...

omkar.podey’s picture

Okay so it isn't possible to manipulate composer.json's of packages right now, But i got to discuss it with @Wim.leers and we decided to update \Drupal\fixture_manipulator\FixtureManipulator::modifyPackage to actually manipulate the composer.json of the package.

I'll make a new method for it, for now , referencing \Drupal\fixture_manipulator\FixtureManipulator::addConfig as it also manipulates composer.json

wim leers’s picture

Title: Update ScaffoldFilePermissionsValidator to move away from ComposerUtility » [PP-1] Update ScaffoldFilePermissionsValidator to move away from ComposerUtility
Status: Needs work » Postponed

Discussed in detail during meeting just now. Conclusion: this is hard-blocked on direction from @tedbow in #3343827: Update FixtureManipulator to work with InstalledPackagesList, real composer show command to avoid wasted work.

wim leers’s picture

Title: [PP-1] Update ScaffoldFilePermissionsValidator to move away from ComposerUtility » [PP-1] ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility
wim leers’s picture

Title: [PP-1] ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility » ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility
Status: Postponed » Needs work
wim leers’s picture

Title: ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility » [PP-1] ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility
Assigned: omkar.podey » Unassigned
Status: Needs work » Postponed

This should wait for #3345633: Remove FixtureManipulator::modifyPackage() last usage to land, because otherwise duplicate changes would need to be made here.

wim leers’s picture

Title: [PP-1] ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility » ScaffoldFilePermissionsValidator should use ComposerInspector instead of ComposerUtility
Status: Postponed » Needs review
Issue tags: -Needs issue summary update
FileSize
4.55 KB

Status: Needs review » Needs work

The last submitted patch, 22: 3342227-21.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community
+++ b/src/Validator/ScaffoldFilePermissionsValidator.php
@@ -27,13 +27,17 @@ final class ScaffoldFilePermissionsValidator implements EventSubscriberInterface
-   * Constructs a SiteDirectoryPermissionsValidator object.
+   * Constructs a ScaffoldFilePermissionsValidator object.

😅

I have no objections to this code. Committing when tests pass.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 22: 3342227-21.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

No it didn't. We're just positively plagued by these pestilential random failures.

  • phenaproxima committed b302be99 on 3.0.x
    Issue #3342227 by omkar.podey, phenaproxima, Wim Leers:...
phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

And, committed!

Only one (or two) things left to do, and ComposerUtility is gone.

wim leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.