Skip to content

Commit

Permalink
chore: consolidate default depends/recommends for FPM targets to app-…
Browse files Browse the repository at this point in the history
…builder-lib (#8637)

Migrates default recommends and default depends for fpm from app-builder-bin Go library to app-builder-lib JS code
https://github.com/develar/app-builder/blob/d971224691f6f48555e2a9bb327f99627893372c/pkg/package-format/fpm/fpm.go#L144-L177
  • Loading branch information
mmaietta authored Nov 27, 2024
1 parent 6a6bed4 commit 667ab2f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-news-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

chore: migrate default recommends and default depends for fpm from app-builder-bin to JS code
20 changes: 17 additions & 3 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,18 @@
"type": "null"
}
],
"description": "Package dependencies. Defaults to `[\"gconf2\", \"gconf-service\", \"libnotify4\", \"libappindicator1\", \"libxtst6\", \"libnss3\"]`.\nIf need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\nIf need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2)."
"default": [
"libgtk-3-0",
"libnotify4",
"libnss3",
"libxss1",
"libxtst6",
"xdg-utils",
"libatspi2.0-0",
"libuuid1",
"libsecret-1-0"
],
"description": "Package dependencies.\nIf need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).\nIf need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2)."
},
"description": {
"description": "As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.",
Expand Down Expand Up @@ -727,7 +738,10 @@
"type": "null"
}
],
"description": "The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps).."
"default": [
"libappindicator3-1"
],
"description": "The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)."
},
"synopsis": {
"description": "The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).",
Expand Down Expand Up @@ -2123,7 +2137,7 @@
"type": "null"
}
],
"description": "Package dependencies."
"description": "Package dependencies.\n`rpm` defaults to `[\"gtk3\", \"libnotify\", \"nss\", \"libXScrnSaver\", \"(libXtst or libXtst6)\", \"xdg-utils\", \"at-spi2-core\", \"(libuuid or libuuid1)\"]`\n`pacman` defaults to `[\"c-ares\", \"ffmpeg\", \"gtk3\", \"http-parser\", \"libevent\", \"libvpx\", \"libxslt\", \"libxss\", \"minizip\", \"nss\", \"re2\", \"snappy\", \"libnotify\", \"libappindicator-gtk3\"]`"
},
"description": {
"description": "As [description](./configuration.md#description) from application package.json, but allows you to specify different for Linux.",
Expand Down
8 changes: 6 additions & 2 deletions packages/app-builder-lib/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export interface CommonLinuxOptions {
export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSpecificOptions {
/**
* Package dependencies.
* `rpm` defaults to `["gtk3", "libnotify", "nss", "libXScrnSaver", "(libXtst or libXtst6)", "xdg-utils", "at-spi2-core", "(libuuid or libuuid1)"]`
* `pacman` defaults to `["c-ares", "ffmpeg", "gtk3", "http-parser", "libevent", "libvpx", "libxslt", "libxss", "minizip", "nss", "re2", "snappy", "libnotify", "libappindicator-gtk3"]`
*/
readonly depends?: Array<string> | null

Expand Down Expand Up @@ -144,14 +146,16 @@ export interface LinuxTargetSpecificOptions extends CommonLinuxOptions, TargetSp
}
export interface DebOptions extends LinuxTargetSpecificOptions {
/**
* Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]`.
* Package dependencies.
* If need to support Debian, `libappindicator1` should be removed, it is [deprecated in Debian](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895037).
* If need to support KDE, `gconf2` and `gconf-service` should be removed as it's no longer used [by GNOME](https://packages.debian.org/bullseye/gconf2).
* @default ["libgtk-3-0", "libnotify4", "libnss3", "libxss1", "libxtst6", "xdg-utils", "libatspi2.0-0", "libuuid1", "libsecret-1-0"]
*/
readonly depends?: Array<string> | null

/**
* The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps)..
* The [recommended package dependencies](https://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps).
* @default ["libappindicator3-1"]
*/
readonly recommends?: Array<string> | null

Expand Down
38 changes: 38 additions & 0 deletions packages/app-builder-lib/src/targets/FpmTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ export default class FpmTarget extends Target {
throw new Error(`depends must be Array or String, but specified as: ${depends}`)
}
}
} else {
fpmConfiguration.customDepends = this.getDefaultDepends(target)
}

if (target === "deb") {
const recommends = (options as DebOptions).recommends
if (recommends) {
fpmConfiguration.customRecommends = asArray(recommends)
} else {
fpmConfiguration.customRecommends = this.getDefaultRecommends(target)
}
}

Expand Down Expand Up @@ -292,6 +296,40 @@ export default class FpmTarget extends Target {
private supportsAutoUpdate(target: string) {
return ["deb", "rpm", "pacman"].includes(target)
}

private getDefaultDepends(target: string): string[] {
switch (target) {
case "deb":
return ["libgtk-3-0", "libnotify4", "libnss3", "libxss1", "libxtst6", "xdg-utils", "libatspi2.0-0", "libuuid1", "libsecret-1-0"]

case "rpm":
return [
"gtk3" /* for electron 2+ (electron 1 uses gtk2, but this old version is not supported anymore) */,
"libnotify",
"nss",
"libXScrnSaver",
"(libXtst or libXtst6)",
"xdg-utils",
"at-spi2-core" /* since 5.0.0 */,
"(libuuid or libuuid1)" /* since 4.0.0 */,
]

case "pacman":
return ["c-ares", "ffmpeg", "gtk3", "http-parser", "libevent", "libvpx", "libxslt", "libxss", "minizip", "nss", "re2", "snappy", "libnotify", "libappindicator-gtk3"]

default:
return []
}
}

private getDefaultRecommends(target: string): string[] {
switch (target) {
case "deb":
return ["libappindicator3-1"]
default:
return []
}
}
}

interface FpmConfiguration {
Expand Down

0 comments on commit 667ab2f

Please sign in to comment.