1
0
Fork 0

Merge branch '2.4'

pull/11063/head
Jordi Boggiano 2022-09-14 14:02:28 +02:00
commit ef018748eb
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 42 additions and 3 deletions

View File

@ -13,8 +13,10 @@
namespace Composer\Command;
use Composer\Package\AliasPackage;
use Composer\Package\BasePackage;
use Composer\Package\Locker;
use Composer\Package\Version\VersionBumper;
use Composer\Pcre\Preg;
use Composer\Util\Filesystem;
use Symfony\Component\Console\Input\InputInterface;
use Composer\Console\Input\InputArgument;
@ -129,6 +131,18 @@ EOT
$tasks['require'] = $composer->getPackage()->getRequires();
}
$packagesFilter = $input->getArgument('packages');
if (count($packagesFilter) > 0) {
$pattern = BasePackage::packageNamesToRegexp(array_unique(array_map('strtolower', $packagesFilter)));
foreach ($tasks as $key => $reqs) {
foreach ($reqs as $pkgName => $link) {
if (!Preg::isMatch($pattern, $pkgName)) {
unset($tasks[$key][$pkgName]);
}
}
}
}
$updates = [];
foreach ($tasks as $key => $reqs) {
foreach ($reqs as $pkgName => $link) {

View File

@ -173,8 +173,8 @@ EOT
/**
* @see https://github.com/composer/composer/pull/8313#issuecomment-532637955
*/
if ($packageType !== 'project') {
$io->writeError('<error>The "--fixed" option is only allowed for packages with a "project" type to prevent possible misuses.</error>');
if ($packageType !== 'project' && !$input->getOption('dev')) {
$io->writeError('<error>The "--fixed" option is only allowed for packages with a "project" type or for dev dependencies to prevent possible misuses.</error>');
if (!isset($config['type'])) {
$io->writeError('<error>If your package is not a library, you can explicitly specify the "type" by using "composer config type project".</error>');

View File

@ -93,7 +93,10 @@ abstract class ArchiveDownloader extends FileDownloader
$filesystem->removeDirectory($path);
}
$this->removeCleanupPath($package, $temporaryDir);
$this->removeCleanupPath($package, realpath($path));
$realpath = realpath($path);
if ($realpath !== false) {
$this->removeCleanupPath($package, $realpath);
}
};
try {

View File

@ -115,6 +115,28 @@ class BumpCommandTest extends TestCase
],
];
yield 'bump only listed with packages arg' => [
[
'require' => [
'first/pkg' => '^2.0',
'second/pkg' => '3.*',
],
'require-dev' => [
'dev/pkg' => '~2.0',
],
],
['packages' => ['first/pkg', 'dev/*']],
[
'require' => [
'first/pkg' => '^2.3.4',
'second/pkg' => '3.*',
],
'require-dev' => [
'dev/pkg' => '^2.3.4.5',
],
],
];
yield 'bump works from installed repo without lock file' => [
[
'require' => [