mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-03-13 21:05:57 +00:00
fix: fall back to VERSION_CODENAME when VERSION_ID is not available (#774)
Debian unstable and testing don't have VERSION_ID in /etc/os-release. This change falls back to VERSION_CODENAME when VERSION_ID is missing, producing cache keys like 'debian-sid' for unstable. Fixes #773
This commit is contained in:
@@ -106,10 +106,16 @@ function getLinuxOSNameVersion(): string {
|
||||
const content = fs.readFileSync(file, "utf8");
|
||||
const id = parseOsReleaseValue(content, "ID");
|
||||
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
||||
// Fallback for rolling releases (debian:unstable/testing, arch, etc.)
|
||||
// that don't have VERSION_ID but have VERSION_CODENAME
|
||||
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
|
||||
|
||||
if (id && versionId) {
|
||||
return `${id}-${versionId}`;
|
||||
}
|
||||
if (id && versionCodename) {
|
||||
return `${id}-${versionCodename}`;
|
||||
}
|
||||
} catch {
|
||||
// Try next file
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user