Problem/Motivation

https://git.drupalcode.org/project/media_directories/-/blob/2.0.x/compos... has
`"drupal/core": ">=8.8.3",`
This supports Drupal 10 although the module doesn't.

Steps to reproduce

On a Drupal 10 install run `composer require media_directories`

Proposed resolution

Either remove line from composer.json (and allow Drupal's composer facade to create dependency line) or add upper bound to dependency manually.

Remaining tasks

Decide which fix.

Comments

NickDickinsonWilde created an issue. See original summary.

ytsurk’s picture

Assigned: Unassigned » ytsurk
Status: Active » Needs work

Not good - Thank you for reporting this catch!

I cannot imagine how drupal's composer facade could make a correct decision in a dependency line ?!

Thus - we'll go with the upper boundry ;)

  • ytsurk committed fc968803 on 2.0.x
    Issue #3343787 by NickDickinsonWilde, ytsurk: Composer.json incorrectly...
ytsurk’s picture

Assigned: ytsurk » Unassigned
Status: Needs work » Needs review

I'm willing to release these asap if you give me your okey.

ytsurk’s picture

Ah - I think I got it. Drupal's composer facade inspects the info.yml's ... way simpler and clearer to go that way ...
But I'll leave this as is.

ytsurk’s picture

nickdickinsonwilde’s picture

Yeah exactly just converts the info.yml into composer version syntax. But can't do that for other dependencies since we don't specify their versions.

Confirmed that the change works - composer installs correctly on Drupal 9.x sites, raises version error on a Drupal 10.x site (via running `composer require "drupal/media_directories:2.0.x-dev@dev"`

So looks good to me

nickdickinsonwilde’s picture

Status: Needs review » Reviewed & tested by the community
ytsurk’s picture

Status: Reviewed & tested by the community » Fixed
Related issues: +#3344367: Remove dependencies from composer.json

I just released 2.0.3

Thank you!
I created this followup to remove the dependencies from composer.json #3344367: Remove dependencies from composer.json.

mullzk’s picture

Hi there
Under what version of composer did you build/test this?
On my installation, the update from 2.0.2 to 2.0.3 breaks my Drupal-Installation, as it removes drupal/embed, drupal/entity_browser and drupal/entity_embed from composer.

I use composer 2.3.2. If I
composer require drupal/media_directories=2.0.2
then I get

$ composer show drupal/media_directories
name     : drupal/media_directories
...
versions : * 2.0.2
...
requires
drupal/core >=8.8.3
drupal/embed >=1.3
drupal/entity_browser >=2
drupal/entity_embed >=1

requires (dev)
drupal/embed ^1.3
drupal/entity_browser *
drupal/entity_embed *
drupal/media_directories_ui *

If I composer require drupal/media_directories=2.0.3
then composer does

Lock file operations: 0 installs, 1 update, 3 removals
  - Removing drupal/embed (1.6.0)
  - Removing drupal/entity_browser (2.9.0)
  - Removing drupal/entity_embed (1.3.0)
  - Upgrading drupal/media_directories (2.0.2 => 2.0.3)

and I get

$ composer show drupal/media_directories
name     : drupal/media_directories
..
versions : * 2.0.3
...
requires
drupal/core ^8.8.3 || ^9

requires (dev)
drupal/embed ^1.3
drupal/entity_browser *
drupal/entity_embed *
drupal/media_directories_ui *

I suspect, that the ">=8.8.3 - 9"-syntax breaks my composer-version. As far as I understand Composer Doc, it should be "8.8.3 - 9", ">=8.8.3 <=10.0.0". Or of course with semver "^8.8.3 || ^9".

afi13’s picture

Yes, the same for me, embed, entity_browser and entity_embed are removed after update.

  • rang501 committed 5ac47cde on 2.0.x
    Issue #3343787 fix invalid version constraint
    
rang501’s picture

There was an invalid version constraint. It should be fixed now.

I can't comment on dependency removal, I was not able to reproduce it (I have composer v2.5.2), but maybe this fix helps with that?

Made a new release and "composer info drupal/media_directories 2.0.4 -a" doesn't complain about version constraints.

mullzk’s picture

I can confirm that the fix in #12 | #13 fixes my problem in #10. I could update to media_directories 2.0.4 and the entity- and embed-modules remained installed.
Thank you very much

ytsurk’s picture

Sorry about that - I should have tested this better.

Status: Fixed » Closed (fixed)

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