Skip to content

Commit

Permalink
feat(deb): "Priority" attribute for .deb packages
Browse files Browse the repository at this point in the history
Close #1088
  • Loading branch information
develar committed Feb 8, 2017
1 parent 6597810 commit 6497678
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
13 changes: 11 additions & 2 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

<!-- do not edit. start of generated block -->
* [Configuration Options](#Config)
* [appx](#AppXOptions)
* [deb Debian Package Specific Options](#DebOptions)
* [directories](#MetadataDirectories)
* [dmg macOS DMG Options](#DmgOptions)
* [fileAssociations File Associations](#FileAssociation)
Expand Down Expand Up @@ -80,6 +83,14 @@ Please see [Windows AppX docs](https://msdn.microsoft.com/en-us/library/windows/
| publisherDisplayName | <a name="AppXOptions-publisherDisplayName"></a>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 | <a name="AppXOptions-identityName"></a>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).

<a name="DebOptions"></a>
### `deb` Debian Package Specific Options
| Name | Description
| --- | ---
| synopsis | <a name="DebOptions-synopsis"></a>The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
| compression | <a name="DebOptions-compression"></a>The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
| priority | <a name="DebOptions-priority"></a>The [Priority](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Priority) attribute.

<a name="MetadataDirectories"></a>
### `directories`
| Name | Description
Expand Down Expand Up @@ -126,11 +137,9 @@ On Windows works only if [nsis.perMachine](https://github.com/electron-userland/
| packageCategory | <a name="LinuxBuildOptions-packageCategory"></a>The [package category](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Section). Not applicable for AppImage.
| description | <a name="LinuxBuildOptions-description"></a>As [description](#AppMetadata-description) from application package.json, but allows you to specify different for Linux.
| target | <a name="LinuxBuildOptions-target"></a><p>Target package type: list of <code>AppImage</code>, <code>snap</code>, <code>deb</code>, <code>rpm</code>, <code>freebsd</code>, <code>pacman</code>, <code>p5p</code>, <code>apk</code>, <code>7z</code>, <code>zip</code>, <code>tar.xz</code>, <code>tar.lz</code>, <code>tar.gz</code>, <code>tar.bz2</code>, <code>dir</code>. Defaults to <code>AppImage</code>.</p> <p>The most effective [xz](https://en.wikipedia.org/wiki/Xz) compression format used by default.</p>
| synopsis | <a name="LinuxBuildOptions-synopsis"></a>*deb-only.* The [short description](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description).
| maintainer | <a name="LinuxBuildOptions-maintainer"></a>The maintainer. Defaults to [author](#AppMetadata-author).
| vendor | <a name="LinuxBuildOptions-vendor"></a>The vendor. Defaults to [author](#AppMetadata-author).
| desktop | <a name="LinuxBuildOptions-desktop"></a>The [Desktop file](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) entries (name to value).
| compression | <a name="LinuxBuildOptions-compression"></a>*deb-only.* The compression type, one of `gz`, `bzip2`, `xz`. Defaults to `xz`.
| depends | <a name="LinuxBuildOptions-depends"></a>Package dependencies. Defaults to `["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]` for `deb`.
| executableName | <a name="LinuxBuildOptions-executableName"></a><p>The executable name. Defaults to <code>productName</code>.</p> <p>Cannot be specified per target, allowed only in the <code>linux</code>.</p>
| icon | <a name="LinuxBuildOptions-icon"></a><p>The path to icon set directory, relative to <code>build</code> (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.</p>
Expand Down
30 changes: 20 additions & 10 deletions packages/electron-builder/src/options/linuxOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export interface LinuxBuildOptions extends PlatformSpecificBuildOptions {
*/
readonly target?: Array<string> | 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).
*/
Expand All @@ -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`.
*/
Expand All @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/electron-builder/src/targets/fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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((<DebOptions>options).priority, it => args.push("--deb-priority", it!))
}
else if (target === "rpm") {
// args.push("--rpm-compression", options.compression || (this.config.compression === "store" ? "none" : "xz"))
Expand Down

0 comments on commit 6497678

Please sign in to comment.