Partial Update fails for artifact repository package
Describe the bug
After updating satis to current dev-main from 1.X, the partial update for packages hosted in an artifact repository doesn't work anymore.
The command returns the following error:
php bin/satis build satis.json web/ this/package
Scanning packages
In PackageSelection.php line 224:
Could not find any repositories config with "name" matching your package(s) filter: this/package
build [--repository-url REPOSITORY-URL] [--repository-strict] [--no-html-output] [--skip-errors] [--stats] [--minify] [--] [<file> [<output-dir> [<packages>...]]]
To Reproduce
{
"require": {
"this/package": "*"
},
"repositories": [
{
"type": "artifact",
"url": "/path/to/directory/with/zips"
}
]
}
Outcome
php bin/satis -vvv build satis.json web/ this/package
Running 2.8.6 (2025-02-25 13:03:50) with PHP 8.2.28 on Linux / 6.1.0-32-amd64
Failed to initialize global composer: Composer could not find the config file: /home/satis/.config/composer/composer.json
To initialize a project, please create a composer.json file. See https://getcomposer.org/basic-usage
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/satis): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/home/satis): 'git' 'describe' '--exact-match' '--tags'
Executing command (CWD): 'git' '--version'
Executing command (/home/satis): 'git' 'log' '--pretty=%H' '-n1' 'HEAD' '--no-show-signature'
Executing command (/home/satis): 'hg' 'branch'
Executing command (/home/satis): 'fossil' 'branch' 'list'
Executing command (/home/satis): 'fossil' 'tag' 'list'
Executing command (/home/satis): 'svn' 'info' '--xml'
Composer could not detect the root package (foocorp/packagist) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Failed to initialize global composer: Composer could not find the config file: /home/satis/.config/composer/composer.json
Executing command (/home/satis): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/home/satis): 'git' 'describe' '--exact-match' '--tags'
Executing command (/home/satis): 'git' 'log' '--pretty=%H' '-n1' 'HEAD' '--no-show-signature'
Executing command (/home/satis): 'hg' 'branch'
Executing command (/home/satis): 'fossil' 'branch' 'list'
Executing command (/home/satis): 'fossil' 'tag' 'list'
Executing command (/home/satis): 'svn' 'info' '--xml'
Scanning packages
In PackageSelection.php line 224:
[InvalidArgumentException]
Could not find any repositories config with "name" matching your package(s) filter: this/package
Exception trace:
at /var/www/satis/lib/src/PackageSelection/PackageSelection.php:224
Composer\Satis\PackageSelection\PackageSelection->select() at /var/www/satis/lib/src/Console/Command/BuildCommand.php:240
Composer\Satis\Console\Command\BuildCommand->execute() at /var/www/satis/lib/vendor/symfony/console/Command/Command.php:279
Symfony\Component\Console\Command\Command->run() at /var/www/satis/lib/vendor/symfony/console/Application.php:1076
Symfony\Component\Console\Application->doRunCommand() at /var/www/satis/lib/vendor/symfony/console/Application.php:342
Symfony\Component\Console\Application->doRun() at /var/www/satis/lib/vendor/composer/composer/src/Composer/Console/Application.php:397
Composer\Console\Application->doRun() at /var/www/satis/lib/src/Console/Application.php:62
Composer\Satis\Console\Application->doRun() at /var/www/satis/lib/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->run() at /var/www/satis/lib/vendor/composer/composer/src/Composer/Console/Application.php:137
Composer\Console\Application->run() at /var/www/satis/lib/bin/satis:71
build [--repository-url REPOSITORY-URL] [--repository-strict] [--no-html-output] [--skip-errors] [--stats] [--minify] [--] [<file> [<output-dir> [<packages>...]]]
Expected behavior With satis 1, it used to work and the build command would detect the new package version and update its index, effectively making the full process ~20sec, compared to a full update taking >2min with my current configuration.
Additional context
dev-main is basically 3.x in the works. Since you were on 1.x, there are bound to be BC breaks. Even compared to the 2.x branch there are BC breaks. Not sure what you are expecting here?
Did not mean to close the issue, sorry about that.
I was forced to update because of the end of life for Composer 1.x: https://blog.packagist.com/shutting-down-packagist-org-support-for-composer-1-x/
I thought that partial update in artifact repositories was a "core" feature of satis, having used it for years, and that it might be a regression in the current version, but maybe I'm wrong.
After having a quick look at the code in PackageSelection, it might just be composer 2.x that handles this kind of repository differently.
Anyway, if there is no plan to handle this in current satis, I'll probably just have to make separate satis repositories for OOS/VCS and artifacts.
Well, the error indicates that it is expecting a name property for the repository configuration. I thought this was only useful for vcs type repositories though. See also the somewhat dated documentation about "partial updates" on https://composer.github.io/satis/using
Hi,
Thanks for your help, it works when I give the repository a name:
{
...
"require": {
"corp/foo-service-client": "*",
"corp/bar-service-client": "*"
},
...
"repositories": [
{
"name": "corp/foo-service-client",
"type": "artifact",
"url": "/path/to/archives/foo-service-client/"
},
{
"name": "corp/bar-service-client",
"type": "artifact",
"url": "/path/to/archives/bar-service-client/"
}
],
...
}
php bin/satis build satis.json web/ corp/foo-service-client
Scanning packages
Found package corp/foo-service-client (123) in file foo-service-client-123.zip
Found package corp/foo-service-client (124) in file foo-service-client-124.zip
...
Selected corp/foo-service-client (123)
Selected corp/foo-service-client (124)
...
With satis 1.X & composer 1.X, we could store multiple zipped dependencies in a single artifact repository.
With latest satis on composer 2.X, we must include an artifact repository for each dependency and the name must match.
I think we can close this issue, as there is no bug here, but it might be useful to update the docs about this.