🐛 Remove the packaged all in Linux, add rpm.

This commit is contained in:
Tw93
2025-01-06 19:33:27 +08:00
parent 722a8b1c46
commit 4972d798b5
5 changed files with 22 additions and 11 deletions

View File

@@ -51,7 +51,7 @@ on:
options: options:
- 'deb' - 'deb'
- 'appimage' - 'appimage'
- 'all' - 'rpm'
jobs: jobs:
build: build:

2
bin/README.md vendored
View File

@@ -178,7 +178,7 @@ Package the application to support both Intel and M1 chips, exclusively for macO
#### [targets] #### [targets]
Select the output package format for Linux. Options include `deb`, `appimage`, or `all`. If `all` is selected, both `deb` and `appimage` will be packaged. Default is `deb`. Choose the output package format, supporting `deb`, `appimage`, `rpm`, This option is only applicable to Linux and defaults to `deb`.
```shell ```shell
--targets <format> --targets <format>

2
bin/README_CN.md vendored
View File

@@ -178,7 +178,7 @@ pake [url] [options]
#### [targets] #### [targets]
选择输出的包格式,支持 `deb`、`appimage` 或 `all`,如果选择 `all`,则会同时打包 `deb` 和 `appimage`,此选项仅适用于 Linux默认为 `deb`。 选择输出的包格式,支持 `deb`、`appimage`、`rpm`,此选项仅适用于 Linux默认为 `deb`。
```shell ```shell
--targets <string> --targets <string>

View File

@@ -7,17 +7,28 @@ export default class LinuxBuilder extends BaseBuilder {
super(options); super(options);
} }
getFileName(): string { getFileName() {
const { name } = this.options; const { name, targets } = this.options;
const arch = process.arch === 'x64' ? 'amd64' : process.arch; const version = tauriConfig.version;
return `${name}_${tauriConfig.version}_${arch}`;
let arch = process.arch === 'x64' ? 'amd64' : process.arch;
if (arch === 'arm64' && (targets === 'rpm' || targets === 'appimage')) {
arch = 'aarch64';
}
// The RPM format uses different separators and version number formats
if (targets === 'rpm') {
return `${name}-${version}-1.${arch}`;
}
return `${name}_${version}_${arch}`;
} }
// Customize it, considering that there are all targets. // Customize it, considering that there are all targets.
async build(url: string) { async build(url: string) {
const targetTypes = ['deb', 'appimage']; const targetTypes = ['deb', 'appimage', 'rpm'];
for (const target of targetTypes) { for (const target of targetTypes) {
if (this.options.targets === target || this.options.targets === 'all') { if (this.options.targets === target) {
await this.buildAndCopy(url, target); await this.buildAndCopy(url, target);
} }
} }

View File

@@ -101,9 +101,9 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
// Processing targets are currently only open to Linux. // Processing targets are currently only open to Linux.
if (platform === 'linux') { if (platform === 'linux') {
delete tauriConf.bundle.linux.deb.files; delete tauriConf.bundle.linux.deb.files;
const validTargets = ['all', 'deb', 'appimage', 'rpm']; const validTargets = ['deb', 'appimage', 'rpm'];
if (validTargets.includes(options.targets)) { if (validTargets.includes(options.targets)) {
tauriConf.bundle.targets = options.targets === 'all' ? ['deb', 'appimage', 'rpm'] : [options.targets]; tauriConf.bundle.targets = [options.targets];
} else { } else {
logger.warn(`✼ The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`); logger.warn(`✼ The target must be one of ${validTargets.join(', ')}, the default 'deb' will be used.`);
} }