From 0ff244ef81dc7ee6f5ad14e5e88ec19642cb3922 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Fri, 28 Feb 2025 09:45:06 +0000 Subject: [PATCH] Allow old PEAR/PECL named convention packages for pre-packaged source assets --- src/Platform/PrePackagedSourceAssetName.php | 7 +++++++ test/unit/Downloading/DownloadUrlMethodTest.php | 1 + test/unit/Platform/PrePackagedSourceAssetNameTest.php | 1 + 3 files changed, 9 insertions(+) diff --git a/src/Platform/PrePackagedSourceAssetName.php b/src/Platform/PrePackagedSourceAssetName.php index 3261b69..f3dc56e 100644 --- a/src/Platform/PrePackagedSourceAssetName.php +++ b/src/Platform/PrePackagedSourceAssetName.php @@ -21,6 +21,7 @@ private function __construct() public static function packageNames(Package $package): array { return [ + // Ideal format for new PIE packages strtolower(sprintf( 'php_%s-%s-src.tgz', $package->extensionName()->name(), @@ -31,6 +32,12 @@ public static function packageNames(Package $package): array $package->extensionName()->name(), $package->version(), )), + // Old PEAR/PECL convention + strtolower(sprintf( + '%s-%s.tgz', + $package->extensionName()->name(), + $package->version(), + )), ]; } } diff --git a/test/unit/Downloading/DownloadUrlMethodTest.php b/test/unit/Downloading/DownloadUrlMethodTest.php index f48b8e8..d385600 100644 --- a/test/unit/Downloading/DownloadUrlMethodTest.php +++ b/test/unit/Downloading/DownloadUrlMethodTest.php @@ -90,6 +90,7 @@ public function testPrePackagedSourceDownloads(): void [ 'php_bar-1.2.3-src.tgz', 'php_bar-1.2.3-src.zip', + 'bar-1.2.3.tgz', ], $downloadUrlMethod->possibleAssetNames($package, $targetPlatform), ); diff --git a/test/unit/Platform/PrePackagedSourceAssetNameTest.php b/test/unit/Platform/PrePackagedSourceAssetNameTest.php index 5a47f14..17ff7a0 100644 --- a/test/unit/Platform/PrePackagedSourceAssetNameTest.php +++ b/test/unit/Platform/PrePackagedSourceAssetNameTest.php @@ -21,6 +21,7 @@ public function testPackageNames(): void [ 'php_foobar-1.2.3-src.tgz', 'php_foobar-1.2.3-src.zip', + 'foobar-1.2.3.tgz', ], PrePackagedSourceAssetName::packageNames( new Package(