Non-canonical repositories are not fetched
andreaskienast opened this issue · comments
Describe the bug
In our project, we have a satis.json
file containing many repositories with the option canonical: false
. We need this as we have packages separated by their major version distributed in different repositories. It seems that somewhere between 9d7911b and b57a707 all repositories with canonical: false
are ignored.
To Reproduce
The most basic satis.json that already fails:
{
"name": "t3g/satis",
"homepage": "https://typo3.com",
"repositories": [
{
"type": "vcs",
"url": "git@github.com:TYPO3GmbH/elts-8.7-release.git",
"canonical": false
},
{
"type": "vcs",
"url": "git@github.com:TYPO3GmbH/elts-9.5-release.git",
"canonical": false
}
],
"require-all": false,
"require": {
"typo3/cms": "^8.7 || ^9.5"
},
"archive": {
"directory": "dist",
"format": "zip",
"prefix-url": "https://elts.typo3.com",
"skip-dev": true
}
}
Please note that the repositories are private, but Satis never tries to access them at all anyway.
Outcome
Running 2.5.5 (2023-03-21 11:50:05) with PHP 8.2.5 on Linux / 6.2.11-300.fc38.x86_64
Reading ./composer.json (/home/afernandez/Projects/elts-satis/composer.json)
Loading config file /home/afernandez/.config/composer/config.json
Loading config file /home/afernandez/.config/composer/auth.json
Loading config file ./composer.json (/home/afernandez/Projects/elts-satis/composer.json)
Loading config file /home/afernandez/Projects/elts-satis/auth.json
Reading /home/afernandez/Projects/elts-satis/auth.json
Checked CA file /home/linuxbrew/.linuxbrew/etc/ca-certificates/cert.pem: valid
Executing command (/home/afernandez/Projects/elts-satis): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Reading /home/afernandez/.config/composer/composer.json
Loading config file /home/afernandez/.config/composer/config.json
Loading config file /home/afernandez/.config/composer/auth.json
Loading config file /home/afernandez/.config/composer/composer.json (/home/afernandez/.config/composer/composer.json)
Loading config file /home/afernandez/.config/composer/auth.json
Reading /home/afernandez/.config/composer/auth.json
Reading /home/afernandez/Projects/elts-satis/vendor/composer/installed.json
Reading /home/afernandez/.config/composer/vendor/composer/installed.json
Loading plugin Http\Discovery\Composer\Plugin (from php-http/discovery)
Loading plugin Composer\Satis\Plugin\SatisPlugin (from composer/satis)
Loading plugin Symfony\Flex\Flex (from symfony/flex)
Executing command (/home/afernandez/Projects/elts-satis): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Scanning packages
The typo3/cms ^8.7 || ^9.5 requirement did not match any package
Creating local downloads in 'protected/dist'
Writing packages.json
Pruning include directories
Writing web view
Expected behavior
I expect that the mentioned repositories are fetched and archives are downloaded, which worked at least with commit 9d7911b.
Additional context
The project is based on Symfony 5.4, where composer/satis
is an additional requirement. Running composer satis:build
and bin/satis build
show the same behavior.
I've fixed this very issue by adding the following snippet to src/PackageSelection.php
, line 181:
if ($repo instanceof FilterRepository) {
$repo = $repo->getRepository();
}
However, this didn't solve the issue entirely. While debugging what Composer does I found out that Composer has a map that marks a certain package as "resolved" and thus ignored any other repository. I understand that the current behavior of Satis is somewhat streamlined with Composer, but that breaks our entire case.
We found another way to solve our home-made issue. Sorry for the noise.