Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: consolidate default depends/recommends for FPM targets to app-builder-lib #8637

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -574,7 +574,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 @@ -718,7 +729,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 @@ -2105,7 +2119,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 @@ -134,14 +136,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 @@ -199,12 +199,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 @@ -280,6 +284,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
Loading