Add libc version for pre-built content name

This commit is contained in:
crazywhalecc
2025-03-30 20:16:41 +08:00
parent 67d2ad5511
commit 631a1b5864
8 changed files with 43 additions and 7 deletions

View File

@@ -204,7 +204,7 @@ class Downloader
self::unregisterCancelEvent();
logger()->debug("Locking {$filename}");
if ($download_as === SPC_DOWN_PRE_BUILT) {
$name = self::getPreBuiltName($name);
$name = self::getPreBuiltLockName($name);
}
self::lockSource($name, ['source_type' => 'archive', 'filename' => $filename, 'move_path' => $move_path, 'lock_as' => $download_as]);
}
@@ -594,7 +594,7 @@ class Downloader
}
}
public static function getPreBuiltName(string $source): string
public static function getPreBuiltLockName(string $source): string
{
return "{$source}-" . PHP_OS_FAMILY . '-' . getenv('GNU_ARCH') . '-' . (getenv('SPC_LIBC') ?: 'default');
}
@@ -653,7 +653,7 @@ class Downloader
}
}
// If lock file exists for current arch and glibc target, skip downloading
$lock_name = self::getPreBuiltName($name);
$lock_name = self::getPreBuiltLockName($name);
if (!$force && $download_as === SPC_DOWN_PRE_BUILT && isset($lock[$lock_name])) {
// lock name with env
if (

View File

@@ -55,7 +55,7 @@ class SourceManager
throw new WrongUsageException("Source [{$source}] does not exist, please check the name and correct it !");
}
// check source downloaded
$pre_built_name = Downloader::getPreBuiltName($source);
$pre_built_name = Downloader::getPreBuiltLockName($source);
if (!isset($lock[$pre_built_name])) {
if (!isset($lock[$source])) {
throw new WrongUsageException("Source [{$source}] not downloaded or not locked, you should download it first !");