mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 00:03:15 +00:00
fix(linux): complete deb/rpm package metadata
This commit is contained in:
@@ -105,6 +105,29 @@ const winSpeechNativeResource = {
|
||||
from: 'node_modules/sherpa-onnx-win-x64',
|
||||
to: 'node_modules/sherpa-onnx-win-x64'
|
||||
}
|
||||
// electron-builder replaces these defaults when `depends` is configured; retain
|
||||
// Electron's loader requirements alongside Orca's headless-host dependencies.
|
||||
const debElectronRuntimeDependencies = [
|
||||
'libgtk-3-0',
|
||||
'libnotify4',
|
||||
'libnss3',
|
||||
'libxss1',
|
||||
'libxtst6',
|
||||
'xdg-utils',
|
||||
'libatspi2.0-0',
|
||||
'libuuid1',
|
||||
'libsecret-1-0'
|
||||
]
|
||||
const rpmElectronRuntimeDependencies = [
|
||||
'gtk3',
|
||||
'libnotify',
|
||||
'nss',
|
||||
'libXScrnSaver',
|
||||
'(libXtst or libXtst6)',
|
||||
'xdg-utils',
|
||||
'at-spi2-core',
|
||||
'(libuuid or libuuid1)'
|
||||
]
|
||||
|
||||
/** @type {import('electron-builder').Configuration} */
|
||||
module.exports = {
|
||||
@@ -260,6 +283,10 @@ module.exports = {
|
||||
if (!existsSync(resourcesDir)) {
|
||||
throw new Error(`Missing packaged resources directory: ${resourcesDir}`)
|
||||
}
|
||||
// FpmTarget replaces this with deb/rpm while building those artifacts from the shared app tree.
|
||||
if (context.electronPlatformName === 'linux') {
|
||||
writeFileSync(join(resourcesDir, 'package-type'), 'AppImage')
|
||||
}
|
||||
if (context.electronPlatformName === 'darwin') {
|
||||
const architectureByEnum = { 1: 'x64', 3: 'arm64' }
|
||||
const architecture = architectureByEnum[context.arch]
|
||||
@@ -526,6 +553,7 @@ module.exports = {
|
||||
// Linux host — Chromium needs a display server even for offscreen rendering,
|
||||
// and serve starts Xvfb itself when present (see ensure-virtual-display.ts).
|
||||
depends: [
|
||||
...debElectronRuntimeDependencies,
|
||||
'python3',
|
||||
'python3-gi',
|
||||
'gir1.2-atspi-2.0',
|
||||
@@ -547,9 +575,9 @@ module.exports = {
|
||||
// Why: see deb depends. RPM distros ship Xvfb as xorg-x11-server-Xvfb (there
|
||||
// is no `xvfb` package), so the name differs from the deb here.
|
||||
depends: [
|
||||
...rpmElectronRuntimeDependencies,
|
||||
'python3',
|
||||
'python3-gobject',
|
||||
'at-spi2-core',
|
||||
'xdotool',
|
||||
'xclip',
|
||||
'xorg-x11-server-Xvfb'
|
||||
|
||||
@@ -10,6 +10,7 @@ const SRC_MAIN_DIR = join(REPO_ROOT, 'src', 'main')
|
||||
const require = createRequire(import.meta.url)
|
||||
const electronBuilderConfig = require('../electron-builder.config.cjs')
|
||||
const { FileMatcher } = require('app-builder-lib/out/fileMatcher')
|
||||
const FpmTarget = require('app-builder-lib/out/targets/FpmTarget').default
|
||||
const electronBuilderNativeRebuild = require('./electron-builder-native-rebuild.cjs')
|
||||
|
||||
describe('electron-builder config', () => {
|
||||
@@ -281,6 +282,16 @@ describe('electron-builder config', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('retains electron-builder runtime dependencies in deb and rpm packages', () => {
|
||||
for (const target of ['deb', 'rpm']) {
|
||||
const dependencies = electronBuilderConfig[target].depends
|
||||
expect(dependencies).toEqual(
|
||||
expect.arrayContaining(FpmTarget.prototype.getDefaultDepends(target))
|
||||
)
|
||||
expect(new Set(dependencies).size).toBe(dependencies.length)
|
||||
}
|
||||
})
|
||||
|
||||
it('validates each AppImage before electron-builder publishes it', async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), 'orca-electron-builder-appimage-'))
|
||||
try {
|
||||
@@ -408,5 +419,17 @@ describe('electron-builder config', () => {
|
||||
expect(source).toContain(`value === '${target}'`)
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps the pinned FpmTarget overwrite for configured deb and rpm artifacts', async () => {
|
||||
const source = await readFile(
|
||||
require.resolve('app-builder-lib/out/targets/FpmTarget'),
|
||||
'utf8'
|
||||
)
|
||||
|
||||
expect(source).toContain('path.join(resourceDir, "package-type"), target')
|
||||
for (const target of RECOVERABLE_TARGETS) {
|
||||
expect(electronBuilderConfig[target]).toBeDefined()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user