Initial thoughts on module packaging
Dalibor.Topic at Sun.COM
Fri May 22 15:52:58 PDT 2009
Dalibor Topic wrote:
> Mark Reinhold wrote:
>> Dalibor -- To start, I suggest you work on the simple case of pure
>> Java modules. We'll tackle native libraries, resource files, and
>> configuration files later on.
> First cut committed. It creates debian binary packages from jigsaw
> modules. Tested with the classic greeting routine:
> $ jpkg -L /tmp/pkg -v -m javac_compiled_modules -d . deb org.astro com.greetings
> Creating binary Debian package for org.astro
> Creating binary Debian package for com.greetings
> $ sudo dpkg -i org.astro_1.2_all.deb com.greetings_0.1_all.deb
> Selecting previously deselected package org.astro.
> (Reading database ... 271672 files and directories currently installed.)
> Unpacking org.astro (from org.astro_1.2_all.deb) ...
> Selecting previously deselected package com.greetings.
> Unpacking com.greetings (from com.greetings_0.1_all.deb) ...
> Setting up org.astro (1.2) ...
> Setting up com.greetings (0.1) ...
> $ java -ea -L /tmp/pkg/ -m com.greetings
> Hello, world!
> The call interface is
> jpkg [-v] [-L <library>] [-m <module_dir>] [-d <output_dir>] deb <module_name>*
> -v : verbose output
> -L : library the modules are installed to
> -m : directory with modules to package
> -d : destination directory to put the package in
> You can ask jpkg to create modules for multiple packages, as in
> the example above. In order to create packages one needs to have
> jmod, jpkg, which, fakeroot and dpkg-deb on $PATH.
> The generated packages contain a generated postinst script,
> that calls jmod to reconfigure the library after a package is
> installed, and generated preinst script, that creates
> the library, in case that it doesn't exist yet, as well as
> as postrm script, that takes care of removing the generated
> config file.
> Not handled yet are native files, resources and configuration
I've added a few more things since, so the interface expanded to:
jpkg [-v] [-L <library>] [-r <resource-dir>] [-i include-dir] [-m <module_dir>] [-d <output_dir>] [-c <command>] deb <module_name>*
-r : directory with resources to bundle as part of the module
-i : directory with files to include as part of the package
-c : command name for launcher invoking main class
so that you could now do something like
jpkg -L /tmp/pkg -v -m javac_compiled_modules -d . deb -c greeter -r translations -i debian-extras com.greetings
and get a small launcher in /usr/bin/greeter , whose module
includes the resources in the subdirectory translations and
whose package includes all the additional data in debian-extras,
for example the /usr/share/doc/greeter/copyright file, etc.
Basically, this allows decoupling the files that are resources
used by the module (but not touched by the compiler), like icons,
translations, etc to be included in the package along with
useful, packaging specific files, like all the good stuff
lintian expects to see in a binary package (copyright files,
man pages, etc.) that can't be trivially generated from the
Dalibor Topic Tel: (+49 40) 23 646 738
Java F/OSS Ambassador AIM: robiladonaim
Sun Microsystems GmbH Mobile: (+49 177) 2664 192
Nagelsweg 55 http://openjdk.java.net
D-20097 Hamburg mailto:Dalibor.Topic at sun.com
Sitz der Gesellschaft: Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
More information about the jigsaw-dev