From 11892070d19b40053a289bda94bc88248dcd8edf Mon Sep 17 00:00:00 2001 From: Rob Bast Date: Mon, 29 Jun 2020 13:11:53 +0200 Subject: [PATCH 1/5] Create an issue @ Docker repository on tag --- .github/workflows/release.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a67b4e6e5..7255735d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,3 +56,20 @@ jobs: asset_path: ./composer.phar asset_name: composer.phar asset_content_type: application/octet-stream + + # This step requires a secret token with `pull` access to composer/docker. The default + # secrets.GITHUB_TOKEN is scoped to this repository only which is not sufficient. + - name: "Open issue @ Docker repository" + uses: actions/github-script@v2 + with: + github-token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} + script: | + // github.ref value looks like 'refs/tags/TAG', cleanup + const tag = "${{ github.ref }}".replace(/refs\/tags\//, ''); + // create new issue on Docker repository + github.issues.create({ + owner: "${{ github.repository_owner }}", + repo: "docker", + title: `New Composer tag: ${ tag }`, + body: `https://github.com/${{ github.repository }}/releases/tag/${ tag }`, + }); From b4ecca5d0b85999deb227a70072a465b2a3ffddf Mon Sep 17 00:00:00 2001 From: Shaun Johnston Date: Thu, 16 Jul 2020 23:34:30 +1000 Subject: [PATCH 2/5] Supply event dispatcher in Create Project Command This update allows composer plugins to intercept the create-project command to inject additional functionality such as providing additional remote filesystem handling. --- src/Composer/Command/CreateProjectCommand.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 067fb9a40..6e41e64ac 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -39,6 +39,7 @@ use Composer\Json\JsonFile; use Composer\Config\JsonConfigSource; use Composer\Util\Filesystem; use Composer\Package\Version\VersionParser; +use Composer\EventDispatcher\EventDispatcher; /** * Install a package as new project into new directory. @@ -286,8 +287,12 @@ EOT $config->merge(array('config' => array('secure-http' => false))); } + $composer = Factory::create($io, $config->all(), $disablePlugins); + $eventDispatcher = $composer->getEventDispatcher(); + if (null === $repository) { - $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config)); + $rm = RepositoryFactory::manager($io, $config, $eventDispatcher, Factory::createRemoteFilesystem($io, $config)); + $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)); } else { $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true); } @@ -384,7 +389,7 @@ EOT $package = $package->getAliasOf(); } - $dm = $this->createDownloadManager($io, $config); + $dm = $this->createDownloadManager($io, $config, $eventDispatcher); $dm->setPreferSource($preferSource) ->setPreferDist($preferDist) ->setOutputProgress(!$noProgress); @@ -409,11 +414,11 @@ EOT return $installedFromVcs; } - protected function createDownloadManager(IOInterface $io, Config $config) + protected function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher) { $factory = new Factory(); - return $factory->createDownloadManager($io, $config); + return $factory->createDownloadManager($io, $config, $eventDispatcher); } protected function createInstallationManager() From 8ddbae358dcbac26a948046675f4a5216fb22a58 Mon Sep 17 00:00:00 2001 From: johnstevenson Date: Thu, 16 Jul 2020 17:14:10 +0100 Subject: [PATCH 3/5] Remove cygwin php handling in UAC elevation When called from a native shell and using cygwin PHP, cygpath translates `/tmp` to `User\AppData\Local\Temp`, rather than `/cygdrive/.../tmp`. This change does not affect using windows PHP from a Cygwin shell. --- src/Composer/Command/SelfUpdateCommand.php | 40 ++++++---------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 031e4d253..5ac7fa1f1 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -380,8 +380,8 @@ TAGSPUBKEY // see if we can run this operation as an Admin on Windows if (!is_writable(dirname($localFilename)) && $io->isInteractive() - && $this->isWindowsNonAdminUser($isCygwin)) { - return $this->tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin); + && $this->isWindowsNonAdminUser()) { + return $this->tryAsWindowsAdmin($localFilename, $newFilename); } $action = 'Composer '.($backupTarget ? 'update' : 'rollback'); @@ -467,20 +467,16 @@ TAGSPUBKEY /** * Returns true if this is a non-admin Windows user account * - * @param null|bool $isCygwin Set by method * @return bool */ - protected function isWindowsNonAdminUser(&$isCygwin) + protected function isWindowsNonAdminUser() { - $isCygwin = preg_match('/cygwin/i', php_uname()); - - if (!$isCygwin && !Platform::isWindows()) { + if (!Platform::isWindows()) { return false; } // fltmc.exe manages filter drivers and errors without admin privileges - $command = sprintf('%sfltmc.exe filters', $isCygwin ? 'cmd.exe /c ' : ''); - exec($command, $output, $exitCode); + exec('fltmc.exe filters', $output, $exitCode); return $exitCode !== 0; } @@ -492,10 +488,9 @@ TAGSPUBKEY * * @param string $localFilename The composer.phar location * @param string $newFilename The downloaded or backup phar - * @param bool $isCygwin Whether we are running on Cygwin * @return bool Whether composer.phar has been updated */ - protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin) + protected function tryAsWindowsAdmin($localFilename, $newFilename) { $io = $this->getIO(); @@ -515,15 +510,9 @@ TAGSPUBKEY $checksum = hash_file('sha256', $newFilename); - // format the file names for cmd.exe - if ($isCygwin) { - $source = exec(sprintf("cygpath -w '%s'", $newFilename)); - $destination = exec(sprintf("cygpath -w '%s'", $localFilename)); - } else { - // cmd's internal move is fussy about backslashes - $source = str_replace('/', '\\', $newFilename); - $destination = str_replace('/', '\\', $localFilename); - } + // cmd's internal move is fussy about backslashes + $source = str_replace('/', '\\', $newFilename); + $destination = str_replace('/', '\\', $localFilename); $vbs = << Date: Fri, 17 Jul 2020 12:05:07 +0200 Subject: [PATCH 4/5] Reuse repository manager and others directly from the Composer instance, refs #9057 --- src/Composer/Command/CreateProjectCommand.php | 22 +++++-------------- src/Composer/Repository/RepositoryFactory.php | 10 +++++---- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 6e41e64ac..1e52674ba 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -288,13 +288,13 @@ EOT } $composer = Factory::create($io, $config->all(), $disablePlugins); - $eventDispatcher = $composer->getEventDispatcher(); + $config = $composer->getConfig(); + $rm = $composer->getRepositoryManager(); if (null === $repository) { - $rm = RepositoryFactory::manager($io, $config, $eventDispatcher, Factory::createRemoteFilesystem($io, $config)); $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)); } else { - $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true); + $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true, $rm); } $parser = new VersionParser(); @@ -389,13 +389,13 @@ EOT $package = $package->getAliasOf(); } - $dm = $this->createDownloadManager($io, $config, $eventDispatcher); + $dm = $composer->getDownloadManager(); $dm->setPreferSource($preferSource) ->setPreferDist($preferDist) ->setOutputProgress(!$noProgress); $projectInstaller = new ProjectInstaller($directory, $dm); - $im = $this->createInstallationManager(); + $im = $composer->getInstallationManager(); $im->addInstaller($projectInstaller); $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package)); $im->notifyInstalls($io); @@ -413,16 +413,4 @@ EOT return $installedFromVcs; } - - protected function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher) - { - $factory = new Factory(); - - return $factory->createDownloadManager($io, $config, $eventDispatcher); - } - - protected function createInstallationManager() - { - return new InstallationManager(); - } } diff --git a/src/Composer/Repository/RepositoryFactory.php b/src/Composer/Repository/RepositoryFactory.php index 9bca0bd07..cf2c79dec 100644 --- a/src/Composer/Repository/RepositoryFactory.php +++ b/src/Composer/Repository/RepositoryFactory.php @@ -62,11 +62,11 @@ class RepositoryFactory * @param bool $allowFilesystem * @return RepositoryInterface */ - public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false) + public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null) { $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem); - return static::createRepo($io, $config, $repoConfig); + return static::createRepo($io, $config, $repoConfig, $rm); } /** @@ -75,9 +75,11 @@ class RepositoryFactory * @param array $repoConfig * @return RepositoryInterface */ - public static function createRepo(IOInterface $io, Config $config, array $repoConfig) + public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null) { - $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config)); + if (!$rm) { + $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config)); + } $repos = static::createRepos($rm, array($repoConfig)); return reset($repos); From ff7f9dcf2d2cb1dcb828b48b0d611c9cfe29092f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 17 Jul 2020 13:00:41 +0200 Subject: [PATCH 5/5] Update deps --- composer.lock | 101 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 41 deletions(-) diff --git a/composer.lock b/composer.lock index 32344435f..bbadaea6b 100644 --- a/composer.lock +++ b/composer.lock @@ -140,16 +140,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.3", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" + "reference": "6946f785871e2314c60b4524851f3702ea4f2223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223", + "reference": "6946f785871e2314c60b4524851f3702ea4f2223", "shasum": "" }, "require": { @@ -196,25 +196,34 @@ "spdx", "validator" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.3" - }, - "time": "2020-02-14T07:44:31+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-07-15T15:35:07+00:00" }, { "name": "composer/xdebug-handler", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7" + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/1ab9842d69e64fb3a01be6b656501032d1b78cb7", - "reference": "1ab9842d69e64fb3a01be6b656501032d1b78cb7", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", + "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", "shasum": "" }, "require": { @@ -245,18 +254,21 @@ "Xdebug", "performance" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/master" - }, "funding": [ { "url": "https://packagist.com", "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "time": "2020-03-01T12:26:26+00:00" + "time": "2020-06-04T11:16:35+00:00" }, { "name": "justinrainbow/json-schema", @@ -439,16 +451,16 @@ }, { "name": "seld/phar-utils", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", "shasum": "" }, "require": { @@ -479,11 +491,7 @@ "keywords": [ "phar" ], - "support": { - "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.1.0" - }, - "time": "2020-02-14T15:25:33+00:00" + "time": "2020-07-07T18:42:57+00:00" }, { "name": "symfony/console", @@ -716,16 +724,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", "shasum": "" }, "require": { @@ -737,7 +745,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -784,20 +796,20 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:14:59+00:00" + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", "shasum": "" }, "require": { @@ -809,7 +821,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -857,7 +873,7 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/process", @@ -1406,6 +1422,9 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/phpunit-bridge/tree/4.2" + }, "time": "2019-07-05T06:33:37+00:00" } ],