|
|
Description
Jpkg is both a library and a set of Apache Ant tasks for building operating system packages.
Features
- Currently the Debian .deb format is supported.
- Detailed validation of package fields to be conformant with the Debian package specification for the package features supported by Jpkg. Not all Debian package features are supported, only those necessary to generate useful packages.
- Supports custom package maintainer scripts, backed by Velocity templates.
- Contains a library called Antidote, which is an attempt to make certain aspects of writing Ant tasks easier, especially dealing with the mutable state of Ant objects and validation of Ant supplied data.
- Also included is a Java library for working with Unix ar(1) archives.
- Includes extensive unit tests.
Usage
Basic pattern for including the Ant task in your build: <taskdef resource="antlib.xml" classpath="path/to/jpkg-combined.jar"/>
Most of the common fields are shown in this example. See the full Ant task schema for more details.
<dpkg output="dist/dpkg_out" prefix="/usr/local/" distribution="unstable">
<package destroot="dist/destroot">
<info>
<name>packagename</name>
<version>1.2</version>
<arch>i386</arch>
<description>Package description</description>
<maintainer>
<name>Package Maintainer</name>
<email>maintainer@package.com</email>
</maintainer>
<priority>optional</priority>
<section>misc</section>
</info>
<permissions>
<permission user="username" group="groupname" mode="755" recursive="true">
<path>bin/</path>
</permission>
</permissions>
<dependencies>
<require package="packagename">
<equalTo>1.4</equalTo>
</require>
<conflict package="conflictswith"/>
<replacement package="replacethis"/>
<alternatives>
<require package="option1">
<equalOrLesserThan>12.1a</equalOrLesserThan>
</require>
<require package="option2"/>
</alternatives>
</dependencies>
<scripts>
<postinst source="script_source/postinst.sh"/>
<prerm command="echo test prerm message"/>
</scripts>
</package>
</dpkg>Distribution Files
- Contained within jpkg-bin.zip:
- jpkg-combined.jar - The Jpkg library and ant tasks as well as all dependencies.
- antidote.jar - The Antidote library.
- jpkg-ant.jar - The Jpkg Ant tasks. Depends on the Jpkg library.
- jpkg-lib.jar - The Jpkg library.
- Also distributed:
- jpkg-src.zip - The source bundle, includes javadocs.
Dependencies
For both the library and ant tasks:
- mail-1.4.1.jar
- commons-io-1.3.2.jar
For the library:
- commons-codec-1.3.jar
For the Ant tasks [commons-collections for velocity]:
- commons-collections-3.2.jar
- velocity-1.5-dev.jar
For the Antidote library:
- The Ant runtime.
Custom Maintainer Scripts
See com/threerings/jpkg/ant/dpkg/scripts/standard/HelloWorld.java for an example. If you create any custom TemplateScript classes you will need to do something like the following.
Example custom-scripts.xml:
<?xml version="1.0"?>
<antlib>
<typedef name="customscript" classname="com.example.CustomScript"/>
</antlib>Pattern for including the Ant task in your build with custom TemplateScript classes:
<path id="jpkg.classpath">
<pathelement location="${buildlibs.dir}/jpkg-combined.jar"/>
<pathelement location="${buildlibs.dir}/custom-scripts.jar"/>
</path>
<taskdef resource="antlib.xml" classpathref="jpkg.classpath" loaderref="jpkg.loader"/>
<typedef resource="custom-scripts.xml" classpathref="jpkg.classpath" loaderref="jpkg.loader"/>Release Notes
- Version 1.5 - Documentation improvements.
- Version 1.4 - Allow maintainer scripts to optionally fail quietly.
- Version 1.3 - Improve script_runner error handling.
- Version 1.2 - Make the recursive property of the <permission> field optional and default to false.
- Version 1.1 - Fix bug in applying recursive permissions.
- Version 1.0 - Initial release.
Author
Jpkg was written by Jonathan Le Plastrier, based on an original Python implementation by Landon Fuller. It is copyright Three Rings Design and is released under a BSD license.
