From 64976782e4bb3a87b205557681d6ec06eb791c47 Mon Sep 17 00:00:00 2001 From: develar Date: Wed, 8 Feb 2017 10:02:58 +0100 Subject: [PATCH] feat(deb): "Priority" attribute for .deb packages Close #1088 --- docs/Options.md | 13 ++++++-- .../src/options/linuxOptions.ts | 30 ++++++++++++------- packages/electron-builder/src/targets/fpm.ts | 2 ++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index fb3d242f94d..5f0ae53771b 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -24,9 +24,12 @@ For example, to change icon location for DMG: As you can see, you need to customize MacOS options only if you want to provide custom `x, y`. Don't customize paths to background and icon, — just follow conventions. +Most of the options accept `null` — for example, to explicitly set that DMG icon must be default volume icon from the OS and default rules must be not applied (i.e. use application icon as DMG icon), set `dmg.icon` to `null`. + * [Configuration Options](#Config) * [appx](#AppXOptions) + * [deb Debian Package Specific Options](#DebOptions) * [directories](#MetadataDirectories) * [dmg macOS DMG Options](#DmgOptions) * [fileAssociations File Associations](#FileAssociation) @@ -80,6 +83,14 @@ Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/ | publisherDisplayName | A friendly name for the publisher that can be displayed to users. Corresponds to [Properties.PublisherDisplayName](https://msdn.microsoft.com/en-us/library/windows/apps/br211460.aspx). | identityName | Describes the contents of the package. The Name attribute is case-sensitive. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). + +### `deb` Debian Package Specific Options +| Name | Description +| --- | --- +| synopsis | The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). +| compression | The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`. +| priority | The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute. + ### `directories` | Name | Description @@ -126,11 +137,9 @@ On Windows works only if [nsis.perMachine](https://github.com/electron-userland/ | packageCategory | The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). Not applicable for AppImage. | description | As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux. | target |

Target package type: list of AppImage, snap, deb, rpm, freebsd, pacman, p5p, apk, 7z, zip, tar.xz, tar.lz, tar.gz, tar.bz2, dir. Defaults to AppImage.

The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.

-| synopsis | *deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). | maintainer | The maintainer. Defaults to [author](#AppMetadata-author). | vendor | The vendor. Defaults to [author](#AppMetadata-author). | desktop | The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value). -| compression | *deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`. | depends | Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`. | executableName |

The executable name. Defaults to productName.

Cannot be specified per target, allowed only in the linux.

| icon |

The path to icon set directory, relative to build (build resources directory). The icon filename must contain the size (e.g. 32x32.png) of the icon. By default will be generated automatically based on the macOS icns file.

diff --git a/packages/electron-builder/src/options/linuxOptions.ts b/packages/electron-builder/src/options/linuxOptions.ts index 5c2288e67dc..d51e9368b82 100644 --- a/packages/electron-builder/src/options/linuxOptions.ts +++ b/packages/electron-builder/src/options/linuxOptions.ts @@ -26,11 +26,6 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions { */ readonly target?: Array | null - /* - *deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). - */ - readonly synopsis?: string | null - /* The maintainer. Defaults to [author](#AppMetadata-author). */ @@ -52,11 +47,6 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions { readonly afterInstall?: string | null readonly afterRemove?: string | null - /* - *deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`. - */ - readonly compression?: string | null - /* Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`. */ @@ -76,6 +66,26 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions { readonly icon?: string } +/* + ### `deb` Debian Package Specific Options + */ +export interface DebOptions { + /* + The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description). + */ + readonly synopsis?: string | null + + /* + The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`. + */ + readonly compression?: string | null + + /* + The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute. + */ + readonly priority?: string | null +} + /* ### `snap` [Snap](http://snapcraft.io) Specific Options */ diff --git a/packages/electron-builder/src/targets/fpm.ts b/packages/electron-builder/src/targets/fpm.ts index 30376dc7c92..a9377462253 100644 --- a/packages/electron-builder/src/targets/fpm.ts +++ b/packages/electron-builder/src/targets/fpm.ts @@ -11,6 +11,7 @@ import { LinuxPackager } from "../linuxPackager" import { log, warn } from "electron-builder-util/out/log" import { Target, Arch } from "electron-builder-core" import { unlinkIfExists } from "electron-builder-util/out/fs" +import { DebOptions } from "../options/linuxOptions" const fpmPath = (process.platform === "win32" || process.env.USE_SYSTEM_FPM === "true") ? BluebirdPromise.resolve("fpm") : downloadFpm() @@ -118,6 +119,7 @@ export default class FpmTarget extends Target { if (target === "deb") { args.push("--deb-compression", options.compression || (packager.config.compression === "store" ? "gz" : "xz")) + use((options).priority, it => args.push("--deb-priority", it!)) } else if (target === "rpm") { // args.push("--rpm-compression", options.compression || (this.config.compression === "store" ? "none" : "xz"))