From d3acb4945a8dcde6598c53d8207bbf16eda8c739 Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 14 Oct 2024 19:57:41 +0900 Subject: [PATCH] chore(flatpak-builder): Add more details when failing --- package.json | 50 +++++++++++++++++++++----- patches/@malept__flatpak-bundler.patch | 29 +++++++++++++++ 2 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 patches/@malept__flatpak-bundler.patch diff --git a/package.json b/package.json index 674c38a7..6a3a4b42 100644 --- a/package.json +++ b/package.json @@ -74,35 +74,66 @@ "target": [ { "target": "AppImage", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "flatpak", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "deb", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "rpm", - "arch": ["x64", "arm64"] + "arch": [ + "x64", + "arm64" + ] }, { "target": "snap", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "freebsd", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "pacman", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] }, { "target": "tar.gz", - "arch": ["x64", "arm64", "armv7l"] + "arch": [ + "x64", + "arm64", + "armv7l" + ] } ], "compression": "maximum" @@ -191,7 +222,8 @@ }, "patchedDependencies": { "vudio@2.1.1": "patches/vudio@2.1.1.patch", - "app-builder-lib@24.13.3": "patches/app-builder-lib@24.13.3.patch" + "app-builder-lib@24.13.3": "patches/app-builder-lib@24.13.3.patch", + "@malept/flatpak-bundler": "patches/@malept__flatpak-bundler.patch" } }, "dependencies": { diff --git a/patches/@malept__flatpak-bundler.patch b/patches/@malept__flatpak-bundler.patch new file mode 100644 index 00000000..c019fc34 --- /dev/null +++ b/patches/@malept__flatpak-bundler.patch @@ -0,0 +1,29 @@ +diff --git a/index.js b/index.js +index 5968fcf47b69094993b0f861c03f5560e4a6a9b7..0fe16d4f40612c0abfa57898909ce0083f56944c 100644 +--- a/index.js ++++ b/index.js +@@ -56,19 +56,23 @@ function getOptionsWithDefaults (options, manifest) { + async function spawnWithLogging (options, command, args, allowFail) { + return new Promise((resolve, reject) => { + logger(`$ ${command} ${args.join(' ')}`) ++ const output = [] + const child = childProcess.spawn(command, args, { cwd: options['working-dir'] }) + child.stdout.on('data', (data) => { ++ output.push(data) + logger(`1> ${data}`) + }) + child.stderr.on('data', (data) => { ++ output.push(data) + logger(`2> ${data}`) + }) + child.on('error', (error) => { ++ logger(`error - ${error.message} ${error.stack}`) + reject(error) + }) + child.on('close', (code) => { + if (!allowFail && code !== 0) { +- reject(new Error(`${command} failed with status code ${code}`)) ++ reject(new Error(`${command} ${args.join(' ')} failed with status code ${code} ${output.join(' ')}`)) + } + resolve(code === 0) + })