From 09855016021511370af5be06db6f89032ccbc26c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 12:38:23 +0200 Subject: [PATCH 1/6] Fix windows build --- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 1c7ca36f3..a95b72dfb 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1606,7 +1606,7 @@ EOF; )); $map = $this->generator->buildPackageMap($this->im, $package, array($dep)); $parsed = $this->generator->parseAutoloads($map, $package); - $this->assertSame(array(preg_quote(dirname($this->workingDir)).'/excludedroot($|/)', preg_quote($this->workingDir).'/root/excl($|/)'), $parsed['exclude-from-classmap']); + $this->assertSame(array(preg_quote(realpath(dirname($this->workingDir))).'/excludedroot($|/)', preg_quote(realpath($this->workingDir)).'/root/excl($|/)'), $parsed['exclude-from-classmap']); } public function testEmptyPaths() From 96f087a2732cc99e3298560c4a2c02a4bf2e239b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 12:45:27 +0200 Subject: [PATCH 2/6] Remove unnecessary realpath which can fail, closes #10694 --- src/Composer/Command/ConfigCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index e51ba1a7c..53028d699 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -185,7 +185,7 @@ EOT $authConfigFile = $input->getOption('global') ? ($this->config->get('home') . '/auth.json') - : dirname(realpath($configFile)) . '/auth.json'; + : dirname($configFile) . '/auth.json'; $this->authConfigFile = new JsonFile($authConfigFile, null, $io); $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true); From 34fa266114efbaa5b39203b9d9e3e5d24828becd Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 12:48:02 +0200 Subject: [PATCH 3/6] Fix windows build --- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index a95b72dfb..8cc6b82ad 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1606,7 +1606,10 @@ EOF; )); $map = $this->generator->buildPackageMap($this->im, $package, array($dep)); $parsed = $this->generator->parseAutoloads($map, $package); - $this->assertSame(array(preg_quote(realpath(dirname($this->workingDir))).'/excludedroot($|/)', preg_quote(realpath($this->workingDir)).'/root/excl($|/)'), $parsed['exclude-from-classmap']); + $this->assertSame(array( + preg_quote(strtr((string) realpath(dirname($this->workingDir))), '\\', '/').'/excludedroot($|/)', + preg_quote(strtr((string) realpath(dirname($this->workingDir))), '\\', '/').'/root/excl($|/)' + ), $parsed['exclude-from-classmap']); } public function testEmptyPaths() From 6b330b74569f62257b8e7696ecdea74e353f8c12 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 12:58:29 +0200 Subject: [PATCH 4/6] Fix tests --- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 8cc6b82ad..9ca6e844e 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1607,8 +1607,8 @@ EOF; $map = $this->generator->buildPackageMap($this->im, $package, array($dep)); $parsed = $this->generator->parseAutoloads($map, $package); $this->assertSame(array( - preg_quote(strtr((string) realpath(dirname($this->workingDir))), '\\', '/').'/excludedroot($|/)', - preg_quote(strtr((string) realpath(dirname($this->workingDir))), '\\', '/').'/root/excl($|/)' + preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/excludedroot($|/)', + preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/root/excl($|/)' ), $parsed['exclude-from-classmap']); } From 1cc23e1a8bc257218e837e34b7430bb797c54521 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 13:04:03 +0200 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=A4=A6=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 9ca6e844e..09369c711 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1608,7 +1608,7 @@ EOF; $parsed = $this->generator->parseAutoloads($map, $package); $this->assertSame(array( preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/excludedroot($|/)', - preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/root/excl($|/)' + preg_quote(strtr((string) realpath($this->workingDir), '\\', '/')).'/root/excl($|/)' ), $parsed['exclude-from-classmap']); } From d7f07339595d12bb9ac945b1c74fc832b7710f3c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 2 Apr 2022 13:04:27 +0200 Subject: [PATCH 6/6] Detect exec failures in compile script, refs #10693 --- bin/compile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/compile b/bin/compile index f9156245f..dde5f06b2 100755 --- a/bin/compile +++ b/bin/compile @@ -3,16 +3,28 @@ $cwd = getcwd(); chdir(__DIR__.'/../'); -$ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD')); +$ts = rtrim(exec('git log -n1 --pretty=%ct HEAD')); if (!is_numeric($ts)) { echo 'Could not detect date using "git log -n1 --pretty=%ct HEAD"'.PHP_EOL; exit(1); } // Install with the current version to force it having the right ClassLoader version // Install without dev packages to clean up the included classmap from phpunit classes -shell_exec('php bin/composer config autoloader-suffix ComposerPhar' . $ts); -shell_exec('php bin/composer install -q --no-dev'); -shell_exec('php bin/composer config autoloader-suffix --unset'); +exec('php bin/composer config autoloader-suffix ComposerPhar' . $ts, $output, $result); +if (0 !== $result) { + echo 'Could not set the autoloader suffix, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} +exec('php bin/composer install -q --no-dev', $output, $result); +if (0 !== $result) { + echo 'Could not remove dev deps, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} +exec('php bin/composer config autoloader-suffix --unset', $output, $result); +if (0 !== $result) { + echo 'Could not remove the autoloader suffix, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} chdir($cwd); require __DIR__.'/../src/bootstrap.php';