satis: Package Selection Broken
Describe the bug I am getting an array to string conversion error when attempting to build a specific package.
To Reproduce Specify a package for the build command.
Outcome
Loading config file /home/dkinne000/.composer/auth.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/var/www/cdxoc/html/satis): git branch --no-color --no-abbrev -v
Executing command (/var/www/cdxoc/html/satis): git describe --exact-match --tags
Executing command (/var/www/cdxoc/html/satis): git log --pretty="%H" -n1 HEAD
Executing command (/var/www/cdxoc/html/satis): hg branch
Executing command (/var/www/cdxoc/html/satis): fossil branch list
Executing command (/var/www/cdxoc/html/satis): fossil tag list
Executing command (/var/www/cdxoc/html/satis): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /home/dkinne000/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/cdxoc/html/satis/vendor/composer/installed.json
Scanning packages
In PackageSelection.php line 182:
[ErrorException]
Array to string conversion
Exception trace:
at /var/www/cdxoc/html/satis/src/PackageSelection/PackageSelection.php:182
Composer\Util\ErrorHandler::handle() at n/a:n/a
sprintf() at /var/www/cdxoc/html/satis/src/PackageSelection/PackageSelection.php:182
Composer\Satis\PackageSelection\PackageSelection->select() at /var/www/cdxoc/html/satis/src/Console/Command/BuildCommand.php:183
Composer\Satis\Console\Command\BuildCommand->execute() at /var/www/cdxoc/html/satis/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/cdxoc/html/satis/vendor/symfony/console/Application.php:934
Symfony\Component\Console\Application->doRunCommand() at /var/www/cdxoc/html/satis/vendor/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /var/www/cdxoc/html/satis/src/Console/Application.php:49
Composer\Satis\Console\Application->doRun() at /var/www/cdxoc/html/satis/vendor/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /var/www/cdxoc/html/satis/bin/satis:26
build [--repository-url [REPOSITORY-URL]] [--repository-strict] [--no-html-output] [--skip-errors] [--stats] [--] [<file> [<output-dir> [<packages>...]]]
Expected behavior I expect Satis to reprocess the specified package.
Additional context According to git bisect, the issue started with a July 10th commit:
commit 969905e4ef3217cf51319a24beca5e56d607c649
Author: Pierre <pierre.basile@gmail.com>
Date: Wed Jul 10 16:37:42 2019 +0200
Update only one package / Add using documentation
:040000 040000 e628dba5982aa296d8b6fdf6110e5840f18518f4 5db09b717cc3644f5fda268eaef9dd97f874373c M docs
:040000 040000 c71d67350e3fa975eaf9db22e2cddb5344a541b3 8b54082f022873c58f7176a7efc8c50510ff707a M src
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Package selection: Allow several repos and improve exception messages Closes #572 In issue abvove it was suggested to allow the code to match name dynamically from repo, that will be to slow for rem... — committed to ezsystems/satis by andrerom 4 years ago
- Package selection: Allow several repos and improve exception messages Closes #572 In issue abvove it was suggested to allow the code to match name dynamically from repo, that will be to slow for rem... — committed to composer/satis by andrerom 4 years ago
Package selection seems similarly broken for me. In an older version of the code, I could execute a command like:
This command would only build the
foo/bar
package rather than everything. However, now it looks like using this parameter now requires thatfoo/bar
be set as aname
key on a VCS repository definition.I’m not entirely familiar with the Satis codebase, so I’m fumbling my way through it to figure this out. My theory is that the logic in
PackageSelection.php::filterPackages()
andPackageSelection.php::select()
has become incorrect after recent changes in this class.It looks like the set of repositories have repository filters applied first, and then package filters are applied, and then whatever is left is built. The
filterPackages()
method is looking for a match between the<packages>
command line parameter and repositoryname
keys. So if you don’t have anyname
keys defined on VCS repositories, no repository will every match anything you list on the command-line. The resulting empty list of repositories causes the “Could not find any package(s) matching: foo/bar” error.I believe this has fixed the problem for me, in
PackageSelection.php
:However, I’m not sure if there are any unwanted side effects of this change or if there might be a more appropriate solution.