Page MenuHomePhabricator

composer/installers 2.2.* support
Closed, ResolvedPublic

Description

Hello!

I am trying to install with composer, but the problem is that this extension requires composer/installers 1.*,>=1.0.1. Version 1 is deprecated, and many other extensions do not support this anymore, for example external-data:

Problem 1
  - composer/installers v1.0.22 requires composer-plugin-api 1.0.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  - composer/installers[v1.0.23, ..., v1.8.0] require composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
  - Root composer.json requires mediawiki/external-data dev-REL1_39 -> satisfiable by mediawiki/external-data[dev-REL1_39].
  - mediawiki/page-forms[5.6, ..., 5.6.1] require composer/installers 1.*,>=1.0.1 -> satisfiable by composer/installers[v1.0.1, ..., v1.12.0].
  - You can only install one version of a package, so only one of these can be installed: composer/installers[v1.0.0, ..., v1.12.0, v2.2.0].
  - mediawiki/external-data dev-REL1_39 requires composer/installers ~2.1 -> satisfiable by composer/installers[v2.1.0, v2.1.1, v2.2.0].
  - Root composer.json requires mediawiki/page-forms 5.6.* -> satisfiable by mediawiki/page-forms[5.6, 5.6.1].

I think in composer.json you should change the requirements to:

	"require": {
		"php": ">=5.5.9",
		"composer/installers": "^2.2.0|1.*,>=1.0.1"
	},

It is working fine for me, here is a fork with the changed requirements: https://github.com/markus-96/mediawiki-extensions-PageForms/commit/672fbe462902fea7924510e8fba50044d10172ae

for testing, you may add this to your composer.json:

{
        "require": {
                ...
                "mediawiki/page-forms": "dev-master as 5.6.*",
                ...
        },
        "repositories": [
                {
                        "type": "git",
                        "url": "https://github.com/markus-96/mediawiki-extensions-PageForms.git"
                }
        ]
}

Event Timeline

@MarB-96 - sorry for the delay. I looked into this, and it looks like most extensions don't even have a line for a "composer/installers" requirement in their composer.json file (see VisualEditor's, for example). Would simply removing that line fix this problem for Page Forms?

Also tagging @Hexmode on this - in 2021, you added "composer/installers": ">=1.0.1" to Approved Revs' composer.json file as part of a set of changes for it to be readable by Packagist:

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ApprovedRevs/+/739352/

What is the connection between Packagist and the Composer version requirement, do you know?

I don't recall the exact reason. I'm happy with removing it or updating it as you see fit.

Okay, thanks - I figured that line wasn't essential to the whole thing.

Change 942478 had a related patch set uploaded (by Yaron Koren; author: Yaron Koren):

[mediawiki/extensions/PageForms@master] Update Composer installer requirement in composer.json

https://gerrit.wikimedia.org/r/942478

Change 942478 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] Update Composer installer requirement in composer.json

https://gerrit.wikimedia.org/r/942478

Yaron_Koren claimed this task.

Well, I updated the version in composer.json - hopefully everything works now. @MarB-96 - thanks for the suggestion.

And @Hexmode - I removed, but then re-added, the similar line in Approved Revs' composer.json. It turns out that this line is necessary - without it, the extension's code gets placed in the vendor/, instead of the extensions/ directory. Given that, it's surprising how few extensions contain this requirement - I guess people still aren't installing extensions via Composer, other than a relative handful that require it like the SMW-based ones.

Well, I updated the version in composer.json - hopefully everything works now. @MarB-96 - thanks for the suggestion.

You're welcome! :)