From 83771ce9bafcdf3dba7eb0af3f65a66d8593bdae Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 30 Aug 2023 18:05:58 +0200 Subject: [PATCH] Fix the mtime of the vendor folder when running composer install (#11593) When splitting the logic between the lock file management and the vendor folder management in composer 2.0, the logic playing nice with make was broken by running the logic based on operations performed in the lock file instead of operations performed in the vendor folder. --- src/Composer/Installer.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 310507a53..8f40cfb06 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -609,16 +609,6 @@ class Installer $this->io->writeError('Writing lock file'); } - // see https://github.com/composer/composer/issues/2764 - if ($this->executeOperations && count($lockTransaction->getOperations()) > 0) { - $vendorDir = $this->config->get('vendor-dir'); - if (is_dir($vendorDir)) { - // suppress errors as this fails sometimes on OSX for no apparent reason - // see https://github.com/composer/composer/issues/4070#issuecomment-129792748 - @touch($vendorDir); - } - } - if ($doInstall) { // TODO ensure lock is used from locker as-is, since it may not have been written to disk in case of executeOperations == false return $this->doInstall($localRepo, true); @@ -797,6 +787,16 @@ class Installer if ($this->executeOperations) { $localRepo->setDevPackageNames($this->locker->getDevPackageNames()); $this->installationManager->execute($localRepo, $localRepoTransaction->getOperations(), $this->devMode, $this->runScripts, $this->downloadOnly); + + // see https://github.com/composer/composer/issues/2764 + if (count($localRepoTransaction->getOperations()) > 0) { + $vendorDir = $this->config->get('vendor-dir'); + if (is_dir($vendorDir)) { + // suppress errors as this fails sometimes on OSX for no apparent reason + // see https://github.com/composer/composer/issues/4070#issuecomment-129792748 + @touch($vendorDir); + } + } } else { foreach ($localRepoTransaction->getOperations() as $operation) { // output op, but alias op only in debug verbosity