Skip to content

"providers": true will break installation of packages with a replace package definition #367

Closed
@andygrunwald

Description

@andygrunwald

We run our own instance of Medusa with the configuration:

{
    "repositories": [],
    "require": [
        "symfony/symfony",
        "symfony/filesystem"
    ],
    "repodir": "/appdata/git-mirror",
    "satisurl": "http://my.url/git-mirror",
    "satisconfig": "satis.json"
}

So Medusa is mirroring the repositories.
After this is done we kickoff satis do generate the usual Satis html with the configuration:

{
    "name": "php package mirror",
    "homepage": "http://my.url/external/",
    "require-all": true,
    "require-dependencies": true,
    "providers": true,
    "archive": {
        "directory": "dist",
        "format": "tar",
        "prefix-url": "http://my.url/external/",
        "skip-dev": true
    },
    "repositories": [
        ...
    ]
}

The important part here is "providers": true,.
The providers feature was introduced in #295.

If providers is set to true this composer json will not be able to install both packages and leads to a conflict.

{
    "name": "foo/test",
    "authors": [
        {
            "name": "foo",
            "email": "foo@bar.com"
        }
    ],
    "repositories": [
        {
            "packagist": false
        },
        {
            "type": "composer",
            "url": "http://my.url/external"
        }
    ],
    "require": {
           "symfony/filesystem": "3.1.6",
           "symfony/symfony": "3.1.6"
    }
}

This composer.json will succeed, but it will install filesystem in 3.1.5 and symfony in 3.1.6 or vice versa:

{
    "name": "foo/test",
    "authors": [
        {
            "name": "foo",
            "email": "foo@bar.com"
        }
    ],
    "repositories": [
        {
            "packagist": false
        },
        {
            "type": "composer",
            "url": "http://my.url/external"
        }
    ],
    "require": {
           "symfony/filesystem": "^3.0",
           "symfony/symfony": "^3.0"
    }
}

The reason is the usage of replace in symfony.
@aaukt mentioned this in the pull request.

From having build this myself i can tell you, that special care has to be taken of "replace" packages. The package that is replaced has to include the version information of its "replacee" in the json file.
As an example you can see how it is done in https://github.com/composer/composer/tree/master/doc/fixtures/repo-composer-with-providers (in detail this )

The sentence "From having build this myself..." is refering to the PHP package aaukt/accelerando.

This is doing (nearly) the same like the provider feature, but with taking care of replacing packages.
See

Any chance to add support for the replace functionality?

/cc @Fleshgrinder @aaukt @copitz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions