mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-09 11:30:42 +00:00
fix: use BUILD_ID as backup for determining os version (#912)
On Arch Linux based runners, the setup fails with because `/etc/os-release` does not contain `VERSION_ID` or `VERSION_CODENAME`. It does contain a `BUILD_ID` which is set to `rolling`: ```sh $ cat /etc/os-release NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo ``` This PR makes `getLinuxOSNameVersion` return `arch-rolling`. There is no update from arch that would change the returned value, so the same cache will always be used. Is this an issue? I'm not sure. At least it's better than crashing because `os-release` does not contain the expected values :).
This commit is contained in:
4
dist/setup/index.cjs
generated
vendored
4
dist/setup/index.cjs
generated
vendored
@@ -91160,12 +91160,16 @@ function getLinuxOSNameVersion() {
|
|||||||
const id = parseOsReleaseValue(content, "ID");
|
const id = parseOsReleaseValue(content, "ID");
|
||||||
const versionId2 = parseOsReleaseValue(content, "VERSION_ID");
|
const versionId2 = parseOsReleaseValue(content, "VERSION_ID");
|
||||||
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
|
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
|
||||||
|
const buildId = parseOsReleaseValue(content, "BUILD_ID");
|
||||||
if (id && versionId2) {
|
if (id && versionId2) {
|
||||||
return `${id}-${versionId2}`;
|
return `${id}-${versionId2}`;
|
||||||
}
|
}
|
||||||
if (id && versionCodename) {
|
if (id && versionCodename) {
|
||||||
return `${id}-${versionCodename}`;
|
return `${id}-${versionCodename}`;
|
||||||
}
|
}
|
||||||
|
if (id && buildId) {
|
||||||
|
return `${id}-${buildId}`;
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,9 @@ function getLinuxOSNameVersion(): string {
|
|||||||
const id = parseOsReleaseValue(content, "ID");
|
const id = parseOsReleaseValue(content, "ID");
|
||||||
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
const versionId = parseOsReleaseValue(content, "VERSION_ID");
|
||||||
// Fallback for rolling releases (debian:unstable/testing, arch, etc.)
|
// Fallback for rolling releases (debian:unstable/testing, arch, etc.)
|
||||||
// that don't have VERSION_ID but have VERSION_CODENAME
|
// that don't have VERSION_ID but have VERSION_CODENAME or BUILD_ID
|
||||||
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
|
const versionCodename = parseOsReleaseValue(content, "VERSION_CODENAME");
|
||||||
|
const buildId = parseOsReleaseValue(content, "BUILD_ID");
|
||||||
|
|
||||||
if (id && versionId) {
|
if (id && versionId) {
|
||||||
return `${id}-${versionId}`;
|
return `${id}-${versionId}`;
|
||||||
@@ -118,6 +119,9 @@ function getLinuxOSNameVersion(): string {
|
|||||||
if (id && versionCodename) {
|
if (id && versionCodename) {
|
||||||
return `${id}-${versionCodename}`;
|
return `${id}-${versionCodename}`;
|
||||||
}
|
}
|
||||||
|
if (id && buildId) {
|
||||||
|
return `${id}-${buildId}`;
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// Try next file
|
// Try next file
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user