diff --git a/src/SPC/store/scripts/zig-cc.sh b/src/SPC/store/scripts/zig-cc.sh index f0db0bf1..4dd0f6c9 100644 --- a/src/SPC/store/scripts/zig-cc.sh +++ b/src/SPC/store/scripts/zig-cc.sh @@ -28,18 +28,20 @@ done [[ -n "$SPC_TARGET" ]] && TARGET="-target $SPC_TARGET" || TARGET="" -output=$(zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1) -status=$? +if [[ "$SPC_TARGET" =~ \.[0-9]+\.[0-9]+ ]]; then + output=$(zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1) + status=$? -if [[ $status -eq 0 ]]; then - echo "$output" - exit 0 -fi + if [[ $status -eq 0 ]]; then + echo "$output" + exit 0 + fi -if echo "$output" | grep -qE "version '.*' in target triple"; then - filtered_output=$(echo "$output" | grep -vE "version '.*' in target triple") - echo "$filtered_output" - exit 0 + if echo "$output" | grep -qE "version '.*' in target triple"; then + filtered_output=$(echo "$output" | grep -vE "version '.*' in target triple") + echo "$filtered_output" + exit 0 + fi fi exec zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" diff --git a/src/SPC/store/source/PhpSource.php b/src/SPC/store/source/PhpSource.php index 5b4fd097..d6807cd1 100644 --- a/src/SPC/store/source/PhpSource.php +++ b/src/SPC/store/source/PhpSource.php @@ -7,6 +7,7 @@ namespace SPC\store\source; use JetBrains\PhpStorm\ArrayShape; use SPC\exception\DownloaderException; use SPC\exception\FileSystemException; +use SPC\exception\WrongUsageException; use SPC\store\Downloader; class PhpSource extends CustomSourceBase @@ -16,11 +17,12 @@ class PhpSource extends CustomSourceBase /** * @throws DownloaderException * @throws FileSystemException + * @throws WrongUsageException */ public function fetch(bool $force = false, ?array $config = null, int $lock_as = SPC_DOWNLOAD_SOURCE): void { $major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.3'; - Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force); + Downloader::downloadSource('php-src', $this->getLatestPHPInfo($major), $force); } /** @@ -34,7 +36,7 @@ class PhpSource extends CustomSourceBase // 查找最新的小版本号 $info = json_decode(Downloader::curlExec( url: "https://www.php.net/releases/index.php?json&version={$major_version}", - retries: intval(getenv('SPC_DOWNLOAD_RETRIES') ?: 0) + retries: (int) getenv('SPC_DOWNLOAD_RETRIES') ), true); if (!isset($info['version'])) { throw new DownloaderException("Version {$major_version} not found.");