Files
iptvnator/tools/packaging/linux-frame-copy-profile.cjs
4gray 8fdac824fd feat(packaging): ship Linux embedded MPV frame-copy runtime (#1200)
* docs: design Linux frame-copy packaging

* docs: plan Linux frame-copy packaging

* feat(packaging): define Linux frame-copy profiles

* fix(packaging): reject inherited profile names

* feat(embedded-mpv): validate staged Linux runtime

* fix(embedded-mpv): require Linux source packages

* fix(embedded-mpv): harden Linux runtime staging

* feat(embedded-mpv): build LGPL Linux runtime

* fix(embedded-mpv): pin Linux runtime inputs

* feat(embedded-mpv): build relocatable Linux helper

* fix(embedded-mpv): require bundled Linux runtime

* fix(embedded-mpv): make Linux runtime portable

* feat(packaging): ship Linux frame-copy artifacts

* fix(embedded-mpv): verify Linux helper linkage

* fix(packaging): enforce Linux frame-copy isolation

* fix(embedded-mpv): pin Linux display data

* docs(embedded-mpv): document Linux frame-copy packaging

* feat(embedded-mpv): probe Linux frame-copy runtime

* test(embedded-mpv): smoke packaged Linux frame-copy

* docs(embedded-mpv): clarify Linux system runtime baseline

* fix(embedded-mpv): harden Linux runtime capability gate

* ci: verify Linux frame-copy packages

* test(embedded-mpv): harden packaged Linux smoke

* test(embedded-mpv): preserve packaged GL mode

* test(packaging): harden Linux package probes

* fix(embedded-mpv): enable private Snap shared memory

* fix(embedded-mpv): sanitize Linux helper environment

* fix(packaging): enforce private Snap memory semantics

* fix(packaging): reject ambiguous Snap memory metadata

* fix(embedded-mpv): prioritize trusted Snap GL

* fix(packaging): reject advanced Snap YAML semantics

* fix(packaging): reject arbitrary Snap YAML aliases

* feat(packaging): ship Linux runtime license notices

* docs(embedded-mpv): document Linux runtime distribution

* fix(packaging): parse Snap trailing comments safely

* fix(release): gate Snap publish on public source release

* fix(packaging): strip VCS metadata from source bundle

* docs(packaging): clarify Linux source release gate

* test(embedded-mpv): smoke missing bundled libmpv

* style(embedded-mpv): format final validation inputs

* fix(e2e): satisfy fixture index signature typing

* fix(ci): declare fontconfig gperf generator

* fix(embedded-mpv): hash runtime cache identities

* fix(packaging): harden Linux frame-copy delivery

* fix(packaging): tighten runtime delivery gates

* fix(ci): decouple Linux runtime matrix

* fix(packaging): harden Linux frame-copy delivery

* fix(packaging): validate Linux frame-copy runtimes

* fix(packaging): scope Snap Electron library checks

* feat(packaging): ship Linux frame-copy runtimes

* fix(packaging): improve Linux runtime smoke diagnostics

* fix(packaging): expose bounded helper probe details

* test(packaging): trace Snap EGL probe failures

* fix(packaging): prefer core22 ABI in Snap helper

* fix(packaging): bound helper probe capture

* fix(packaging): harden Linux frame-copy releases

* fix(packaging): canonicalize libplacebo submodule identity

* fix(packaging): make source archive inspection portable

* fix(packaging): harden Snap release verification
2026-07-18 17:28:22 +02:00

101 lines
2.8 KiB
JavaScript

'use strict';
function createProfile(name, runtimeMode, targets, manifestOrigin) {
return Object.freeze({
name,
runtimeMode,
targets: Object.freeze([...targets]),
manifestOrigin,
});
}
const LINUX_FRAME_COPY_PROFILES = Object.freeze({
system: createProfile(
'system',
'system',
['deb', 'rpm', 'pacman'],
'system-libmpv-frame-copy'
),
portable: createProfile(
'portable',
'bundled',
['appimage', 'snap'],
'bundled-lgpl-frame-copy'
),
flatpak: createProfile(
'flatpak',
'bundled',
['flatpak'],
'bundled-lgpl-frame-copy'
),
});
const SUPPORTED_PROFILE_NAMES = Object.freeze(
Object.keys(LINUX_FRAME_COPY_PROFILES)
);
const LINUX_SYSTEM_PACKAGE_DEPENDENCIES = Object.freeze({
deb: Object.freeze(['libmpv2', 'libegl1', 'libgl1', 'libgbm1']),
rpm: Object.freeze([
'mpv-libs',
'libglvnd-egl',
'libglvnd-glx',
'mesa-libgbm',
]),
pacman: Object.freeze(['mpv', 'libglvnd', 'mesa']),
});
function expectedProfileNames() {
return SUPPORTED_PROFILE_NAMES.map((name) => `"${name}"`).join(', ');
}
function findLinuxFrameCopyProfile(value) {
if (value == null || (typeof value === 'string' && value.trim() === '')) {
throw new Error(
`Linux frame-copy profile is required. Expected one of: ${expectedProfileNames()}.`
);
}
const name = typeof value === 'string' ? value.trim() : String(value);
if (!Object.hasOwn(LINUX_FRAME_COPY_PROFILES, name)) {
throw new Error(
`Unsupported Linux frame-copy profile "${name}". Expected one of: ${expectedProfileNames()}.`
);
}
return LINUX_FRAME_COPY_PROFILES[name];
}
function resolveLinuxFrameCopyProfile(value) {
const profile = findLinuxFrameCopyProfile(value);
return createProfile(
profile.name,
profile.runtimeMode,
profile.targets,
profile.manifestOrigin
);
}
function validateLinuxProfileTargets(profileName, targetNames) {
const profile = findLinuxFrameCopyProfile(profileName);
if (!Array.isArray(targetNames)) {
throw new TypeError('Linux frame-copy targets must be an array.');
}
const allowedTargets = new Set(profile.targets);
return targetNames.flatMap((targetName) => {
const normalizedTarget = String(targetName).trim().toLowerCase();
if (allowedTargets.has(normalizedTarget)) {
return [];
}
return [
`Linux frame-copy profile "${profile.name}" cannot build target "${normalizedTarget}".`,
];
});
}
module.exports = {
LINUX_FRAME_COPY_PROFILES,
LINUX_SYSTEM_PACKAGE_DEPENDENCIES,
resolveLinuxFrameCopyProfile,
validateLinuxProfileTargets,
};