mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-02-28 03:14:58 +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:
parent
0098a7571c
commit
b12532f27f
4 changed files with 33 additions and 0 deletions
15
.github/workflows/test.yml
vendored
15
.github/workflows/test.yml
vendored
|
|
@ -418,6 +418,20 @@ jobs:
|
|||
PY
|
||||
shell: bash
|
||||
|
||||
test-debian-unstable:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:unstable
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install latest version
|
||||
uses: ./
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv sync
|
||||
working-directory: __tests__/fixtures/uv-project
|
||||
|
||||
test-musl:
|
||||
runs-on: ubuntu-latest
|
||||
container: alpine
|
||||
|
|
@ -1031,6 +1045,7 @@ jobs:
|
|||
- test-python-version
|
||||
- test-activate-environment
|
||||
- test-activate-environment-custom-path
|
||||
- test-debian-unstable
|
||||
- test-musl
|
||||
- test-cache-key-os-version
|
||||
- test-cache-local
|
||||
|
|
|
|||
6
dist/save-cache/index.js
generated
vendored
6
dist/save-cache/index.js
generated
vendored
|
|
@ -91381,9 +91381,15 @@ function getLinuxOSNameVersion() {
|
|||
const content = node_fs_1.default.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
|
||||
|
|
|
|||
6
dist/setup/index.js
generated
vendored
6
dist/setup/index.js
generated
vendored
|
|
@ -97253,9 +97253,15 @@ function getLinuxOSNameVersion() {
|
|||
const content = node_fs_1.default.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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue