[Go to site: main page, start]

Debian Plugin

Debian Plugin

Overview

The Latte Debian Package Management Plugin provides the ability to build Debian package files (.deb).

LATEST VERSION: 0.3.0

Loading the plugin

Here is how you load this plugin:

deb = loadPlugin(id: "org.lattejava.plugin:debian:0.3.0")

Building a Debian package

The build method on the plugin allows you to build Debian package files. There are a number of parameters you pass to this method and also a number of closure methods that you can call to control how the Debian package is built. Here are the parameters:

namedescriptiontyperequired
toThe output directory for the .deb fileStringtrue
packageThe name of the packageStringtrue
architectureThe architecture for the package. Defaults to allStringfalse
conflictsThe package(s) this package conflicts withStringfalse
dependsThe list of dependent packagesStringfalse
enhancesThe package(s) this package enhancesStringfalse
homepageThe homepage for the packageStringfalse
postInstThe location of the postInst script for the packageString or Pathfalse
postRmThe location of the postRm script for the packageString or Pathfalse
preDependsThe list of pre-dependencies for the packageStringfalse
preInstThe location of the preInst script for the packageString or Pathfalse
preRmThe location of the preRm script for the packageString or Pathfalse
priorityThe priority of the packageStringfalse
providesThe features this package providesStringfalse
recommendsThe list of packages this package recommendsStringfalse
replacesThe package(s) this package replacesStringfalse
sectionThe section of the packageStringtrue
suggestsThe package(s) this package suggestsStringfalse

The value supplied for section must be one of the valid Debian sections (for example admin, devel, net, web). The plugin validates this at build time and fails the build if the value is not recognized.

For more information on these parameters, consult the Debian package documentation here: https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html

Configuration files

The confFileSet method defines a FileSet that specifies the configuration files for the package. It takes these parameters:

namedescriptiontyperequired
dirThe directory on the local file system that is the base of the FileSet.String or Pathtrue
prefixThe prefix for the files in the FileSet when they are added to the package.Stringfalse
modeThe Unix file mode for the files in the FileSet. This must be a Unix hex mask like 0x744.Hexfalse
userNameThe user name to use for the files in the FileSet.Stringfalse
groupNameThe group name to use for the files in the FileSet.Stringfalse
includePatternsA list of regular expressions that reduce the files included in the FileSet.List<Pattern> or List<String>false
excludePatternsA list of regular expressions that reduce the files excluded from the FileSet.List<Pattern> or List<String>false

Here is an example of using this method:

confFileSet(dir: "src/scripts", prefix: "etc/init.d", mode: 0x744, userName: "root", groupName: "root", 
    includePatterns: [~/.+\.sh/], excludePatterns: [~/do-not-ship\.sh/])

Description

The description method sets the description of the package. It takes these parameters:

namedescriptiontyperequired
synopsisThe synopsis of the packageStringtrue
extendedThe extended description of the packageStringtrue

Here is an example of using this method:

description(synopsis: "Short description", extended: "Long description of the package")

Directories

The directory method includes an empty directory in the Debian package. It takes these parameters:

namedescriptiontyperequired
nameThe name of the directory as it will exist in the package.Stringtrue
modeThe Unix file mode for the directory in the package. This must be a Unix hex mask like 0x744.Hexfalse
userNameThe user name for the directory in the package.Stringfalse
groupNameThe group name for the directory in the package.Stringfalse

Here is an example of using this method:

directory(name: "usr/local/logs", mode: 0x744, userName: "root", groupName: "root")

Maintainer

The maintainer method defines the maintainer of the package. It takes these parameters:

namedescriptiontyperequired
nameThe name of the company or person that maintains the package.Stringfalse
emailThe email of the company or person that maintains the package.Stringfalse

Here is an example of using this method:

maintainer(name: "My Company", email: "[email protected]")

Main files

The tarFileSet method defines a FileSet that contains the main files of the Debian Package. It takes these parameters:

namedescriptiontyperequired
dirThe directory on the local file system that is the base of the FileSet.String or Pathtrue
prefixThe prefix for the files in the FileSet when they are added to the package.Stringfalse
modeThe Unix file mode for the files in the FileSet. This must be a Unix hex mask like 0x744.Hexfalse
userNameThe user name to use for the files in the FileSet.Stringfalse
groupNameThe group name to use for the files in the FileSet.Stringfalse
includePatternsA list of regular expressions that reduce the files included in the FileSet.List<Pattern> or List<String>false
excludePatternsA list of regular expressions that reduce the files excluded from the FileSet.List<Pattern> or List<String>false

Here is an example of using this method:

tarFileSet(dir: "build/classes/main", prefix: "usr/local/my-cool-package", mode: 0x744, userName: "root", 
    groupName: "root", includePatterns: [~/.+\.class/], excludePatterns: [~/.+do-not-ship\.class/])

Version

The version method defines the version of the package. It takes these parameters:

namedescriptiontyperequired
upstreamThe upstream version of the package.Stringtrue
debianThe Debian version of the package.Stringtrue

Here is an example of using this method:

version(upstream: "3.0.0", debian: "1")

Example

Here is a complete example of using this plugin to build a Debian package:

deb.build(to: "build/packages", package: "my-cool-package", architecture: "x86",
          homepage: "https://www.example.com", priority: "required", section: "web",
          preInst: "src/scripts/preinst", preRm: "src/scripts/prerm",
          postInst: "src/scripts/postinst", postRm: "src/scripts/postrm") {
  version(upstream: "3.0.0-M4", debian: "1")
  description(synopsis: "My Package rocks", extended: "This package rocks pretty hard. You really should use it.")
  maintainer(name: "Example", email: "[email protected]")
  tarFileSet(dir: "build/distribution/", prefix: "usr/local/my-package")
  confFileSet(dir: "src/conf", prefix: "etc/init.d")
  directory(name: "usr/local/my-package/logs", mode: 0x755)
}