composer / satis

Simple static Composer repository generator - For a full private Composer repo use Private Packagist
MIT License
3.15k stars 519 forks source link

Docker + Composer is not using external providers-url error Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead #798

Open martijn-bigbridge opened 9 months ago

martijn-bigbridge commented 9 months ago

Describe the bug You will get the error below when you use a composer repository inside satis.json that contains a provider-url.

Example file after running the Docker command .composer/cache/repo/https---repo.magento.com/packages.json

{"packages":[],"providers-url":"\/p\/%package%$%hash%.json","provider-includes":{"p\/provider-ce$%hash%.json":{"sha256":"58241c175cc120030c9ca901174fa02981e5bc58e79114c40b0cb7052dd4f4b5"},"p\/provider-ee$%hash%.json":{"sha256":"886f47fee3d8235884a5bc81d87a3d76a41ead199772880cea791b6081ef14a9"},"p\/provider-b2b$%hash%.json":{"sha256":"6e8b73c78b66e76d531c7e2f5acb1c5b4e23bf63502af898192916d295289869"},"p\/provider-marketplace-extensions$%hash%.json":{"sha256":"07ca7c7ba7030a0d710e523dc3cde9d4bf6b71e509ea73a45ac07b28b9d66380"}}}

To Reproduce satis.json

{
    "name": "x/repo-x",
    "homepage": "https://x.y.z/b",
    "minimum-stability": "dev",
    "providers": true,
    "pretty-print": true,
    "require-all": false,
    "require-dependencies": true,
    "require-dev-dependencies": true,
    "require-dependency-filter": true,
    "archive": {
        "directory": "dist",
        "format": "zip",
        "skip-dev": false
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com",
            "name": "magento"
        }
    ],
    "require": {
        "magento/product-community-edition": ">=2.2.6"
    },
}
docker run --rm --init -it \
  --user $(id -u):$(id -g) \
  --volume $(pwd):/build \
  --volume "/Users/martijn/repotest/composer:/composer" \
  composer/satis build /build/satis.json /Users/martijn/repotest/public

Create a free Adobe Magento account for the repo username and password.

Or find another composer repository for satis, that is using (multiple) providers-url's like Magento.

Outcome

In ComposerRepository.php line 351:

  [LogicException]                                                                                                    
  Composer repositories that have providers can not load the complete list of packages, use getPackageNames instead.  

Exception trace:
  at /satis/vendor/composer/composer/src/Composer/Repository/ComposerRepository.php:351
 Composer\Repository\ComposerRepository->getPackages() at /satis/vendor/composer/composer/src/Composer/Repository/RepositorySet.php:335
 Composer\Repository\RepositorySet->createPoolWithAllPackages() at /satis/src/PackageSelection/PackageSelection.php:628
 Composer\Satis\PackageSelection\PackageSelection->pruneBlacklisted() at /satis/src/PackageSelection/PackageSelection.php:259
 Composer\Satis\PackageSelection\PackageSelection->select() at /satis/src/Console/Command/BuildCommand.php:240
 Composer\Satis\Console\Command\BuildCommand->execute() at /satis/vendor/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at /satis/vendor/symfony/console/Application.php:1078
 Symfony\Component\Console\Application->doRunCommand() at /satis/vendor/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at /satis/vendor/composer/composer/src/Composer/Console/Application.php:382
 Composer\Console\Application->doRun() at /satis/src/Console/Application.php:62
 Composer\Satis\Console\Application->doRun() at /satis/vendor/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at /satis/vendor/composer/composer/src/Composer/Console/Application.php:145
 Composer\Console\Application->run() at /satis/bin/satis:71

build [--repository-url REPOSITORY-URL] [--repository-strict] [--no-html-output] [--skip-errors] [--stats] [--minify] [--] [<file> [<output-dir> [<packages>...]]]

Expected behavior Accept and follow the providers-url , so you don't get this error.

Additional context I don't know if this only with Docker.

artmouse commented 3 weeks ago

Same issue with Magento repository

artmouse commented 3 weeks ago

@martijn-bigbridge Were you able to fix this error?

martijn-bigbridge commented 3 weeks ago

Not for the latest satis version and composer >= 2. It is possible to use composer 1.x for satis, but it is much slower.

artmouse commented 3 weeks ago

Maybe problem on this part of code https://github.com/onspli/satis/commit/367c9ec72ae83f9d38f293161f0ee9064b33d956 And dumping very slow on 3.0-dev...