From 5438814975ea0374088ddd4ebead482a4a5fd6ca Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 16 Jan 2025 15:20:40 -0800 Subject: [PATCH] chore: do not fall back to previous LTS release deps for new Ubuntu LTS (#34360) --- .../src/server/registry/dependencies.ts | 2 +- .../playwright-core/src/utils/hostPlatform.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/playwright-core/src/server/registry/dependencies.ts b/packages/playwright-core/src/server/registry/dependencies.ts index 60ef80d846..4aa568a6f9 100644 --- a/packages/playwright-core/src/server/registry/dependencies.ts +++ b/packages/playwright-core/src/server/registry/dependencies.ts @@ -95,7 +95,7 @@ export async function installDependenciesLinux(targets: Set, dr for (const target of targets) { const info = deps[platform]; if (!info) { - console.warn(`Cannot install dependencies for ${platform}!`); // eslint-disable-line no-console + console.warn(`Cannot install dependencies for ${platform} with Playwright ${getPlaywrightVersion()}!`); // eslint-disable-line no-console return; } libraries.push(...info[target]); diff --git a/packages/playwright-core/src/utils/hostPlatform.ts b/packages/playwright-core/src/utils/hostPlatform.ts index 7d81f39da3..0563e4ab29 100644 --- a/packages/playwright-core/src/utils/hostPlatform.ts +++ b/packages/playwright-core/src/utils/hostPlatform.ts @@ -74,14 +74,18 @@ function calculatePlatform(): { hostPlatform: HostPlatform, isOfficiallySupporte // KDE Neon is ubuntu-based and has the same versions. // TUXEDO OS is ubuntu-based and has the same versions. if (distroInfo?.id === 'ubuntu' || distroInfo?.id === 'pop' || distroInfo?.id === 'neon' || distroInfo?.id === 'tuxedo') { - const isOfficiallySupportedPlatform = distroInfo?.id === 'ubuntu'; - if (parseInt(distroInfo.version, 10) <= 19) + const isUbuntu = distroInfo?.id === 'ubuntu'; + const version = distroInfo?.version; + const major = parseInt(distroInfo.version, 10); + if (major < 20) return { hostPlatform: ('ubuntu18.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: false }; - if (parseInt(distroInfo.version, 10) <= 21) - return { hostPlatform: ('ubuntu20.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform }; - if (parseInt(distroInfo.version, 10) <= 22) - return { hostPlatform: ('ubuntu22.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform }; - return { hostPlatform: ('ubuntu24.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform }; + if (major < 22) + return { hostPlatform: ('ubuntu20.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: isUbuntu && version === '20.04' }; + if (major < 24) + return { hostPlatform: ('ubuntu22.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: isUbuntu && version === '22.04' }; + if (major < 26) + return { hostPlatform: ('ubuntu24.04' + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: isUbuntu && version === '24.04' }; + return { hostPlatform: ('ubuntu' + distroInfo.version + archSuffix) as HostPlatform, isOfficiallySupportedPlatform: false }; } // Linux Mint is ubuntu-based but does not have the same versions if (distroInfo?.id === 'linuxmint') {