The following commit has been merged in the jarwrapper-migration branch:
commit dbed1666cbc2d5baa4a74a2b673ce5fdc077c0d0
Author: Niels Thykier <ni...@thykier.net>
Date:   Sat Oct 29 11:16:23 2011 +0200

    Documented jh_wrapjars and did minor bugfixes
    
    Signed-off-by: Niels Thykier <ni...@thykier.net>

diff --git a/debian/javahelper.install b/debian/javahelper.install
index 3ac2d20..a0c119b 100644
--- a/debian/javahelper.install
+++ b/debian/javahelper.install
@@ -10,6 +10,7 @@ jh_installjavadoc /usr/bin
 jh_makepkg /usr/bin
 jh_repack /usr/bin
 jh_linkjars /usr/bin
+jh_wrapjars /usr/bin
 jh_installeclipse /usr/bin
 jh_generateorbitdir /usr/bin
 jh_setupenvironment /usr/bin
diff --git a/debian/rules b/debian/rules
index 74a6c82..f162c5a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,6 +20,7 @@ override_dh_auto_build: jh_lib.sh
        $(POD2MAN) jh_setupenvironment tmp/jh_setupenvironment.1
        $(POD2MAN) jh_compilefeatures tmp/jh_compilefeatures.1
        $(POD2MAN) jh_manifest tmp/jh_manifest.1
+       $(POD2MAN) jh_wrapjars tmp/jh_wrapjars.1
        $(POD2MAN) fetch-eclipse-source.pod tmp/fetch-eclipse-source.1
        $(POD2MAN) -s 1 jh_clean.pod tmp/jh_clean.1
        $(POD2MAN) $(MOD_PATH)/Eclipse.pm tmp/Debian::Javahelper::Eclipse.3
diff --git a/javahelper.mk b/javahelper.mk
index 5935d99..a169308 100644
--- a/javahelper.mk
+++ b/javahelper.mk
@@ -49,5 +49,6 @@ $(patsubst %,binary-post-install/%,$(DEB_ALL_PACKAGES)) :: 
binary-post-install/%
        jh_manifest -p$(cdbs_curpkg) $(JH_MANIFEST_ARGS)
        jh_exec -p$(cdbs_curpkg) $(JH_EXEC_ARGS)
        jh_depends -p$(cdbs_curpkg) $(JH_DEPENDS_ARGS)
+       jh_wrapjars -p$(cdbs_curpkg) $(JH_WRAPJARS_ARGS)
 
 endif # _cdbs_class_javahelper
diff --git a/javahelper.pm b/javahelper.pm
index b2fe5fd..689e3d2 100644
--- a/javahelper.pm
+++ b/javahelper.pm
@@ -8,6 +8,7 @@ insert_after("jh_installlibs", "jh_classpath");
 insert_after("jh_classpath", "jh_manifest");
 insert_after("jh_manifest", "jh_exec");
 insert_after("jh_exec", "jh_depends");
+insert_after("jh_depends", "jh_wrapjars");
 insert_before("dh_installdocs", "jh_installjavadoc");
 insert_before("dh_clean", "jh_clean");
 insert_before("dh_auto_build", "jh_linkjars");
diff --git a/jh_wrapjars b/jh_wrapjars
index feffc33..f49f1fe 100644
--- a/jh_wrapjars
+++ b/jh_wrapjars
@@ -17,6 +17,53 @@ use Debian::Javahelper::Manifest( qw(MAIN_SECTION) );
 
 use Archive::Zip qw( :ERROR_CODES );
 
+=head1 SYNOPSIS
+
+B<jh_wrapjars> [S<I<debhelper options>>] [S<I<jar wrapper>>]
+
+=head1 DESCRIPTION
+
+B<jh_wrapjars> is a debhelper-like javahelper program that wraps
+jar-files with small executable scripts.
+
+This approach replaces B<jh_exec> and B<jarwrapper>, which relies on
+the linux-only binfmt-misc.  The core idea (to avoid having to write
+the same boiler scripts) has not changed.
+
+If a wrapper script is installed for a jar, B<jh_wrapjars> will add a
+dependency on B<javawrapper> in the I<java:Depends> substituation
+variable.  If used manually with B<jh_depends>, B<jh_wrapjars> should
+always be called I<after> B<jh_depends>.
+
+Before installing a wrapper, B<jh_wrapjars> does a number of basic
+checks to ensure the jar file can be executed (it has a Main-Class
+etc.).  It is allowed to pass symlinks to jars, as long as they can be
+resolved when B<jh_wrapjars> is run.
+
+=head1 FILES
+
+=over 4
+
+=item debian/I<package>.wrap-jars
+
+The format is 0 or more lines of:
+
+ jar [wrapper]
+
+This will install script at I<wrapper> for I<jar>.  If I<wrapper> is
+omitted, then it will default to I</usr/bin/base>, where I<base> is
+the base name of the jar file (without directories and the .jar
+extension).
+
+=cut
+
+=head1 OPTIONS
+
+This tool have all the normal debhelper options.  Note that the B<-X>
+option is ignored.
+
+=cut
+
 my $RUNNER = '/usr/lib/java-wrapper/runner';
 my $RUNNER_PKG = 'java-wrapper';
 my $RUNNER_PKG_DEPVER = '>= ?';
@@ -24,14 +71,20 @@ my $RUNNER_PKG_DEPVER = '>= ?';
 init();
 
 foreach my $pkg ( @{ $dh{DOPACKAGES} } ) {
-    my $jaref = pkgfile ($pkg, 'jar-exec');
+    my $jaref = pkgfile ($pkg, 'wrap-jars');
     my @filesets = filedoublearray ($jaref);
     my $pkgdir = tmpdir ($pkg);
     my $needdep = 0;
+
+    if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+        push @links, [@ARGV];
+    }
+
     foreach my $fset (@filesets) {
         my ($jar, $binf) = @$fset;
         my ($pkgjar, $pkgbinf);
         my $dir;
+
         # Default to "/usr/bin/$base" if $binf is not specified
         unless ($binf) {
             my $base = $jar;
@@ -41,8 +94,8 @@ foreach my $pkg ( @{ $dh{DOPACKAGES} } ) {
             $binf = "usr/bin/$base";
         }
         # strip leading "/" and "./" (if any)
-        $binf =~ s,^.?/*,,g;
-        $jar =~ s,^.?/*,,g;
+        $binf =~ s,^\.?/*,,g;
+        $jar =~ s,^\.?/*,,g;
 
         $pkgjar = "$pkgdir/$jar";
         $pkgbinf = "$pkgdir/$binf";
@@ -123,3 +176,24 @@ sub _check_jarfile {
         unless $zip->memberNamed ($mainfn);
 }
 
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of javahelper and uses debhelper as backend. There are
+also tutorials in /usr/share/doc/javahelper.
+
+=head1 AUTHOR
+
+Niels Thykier <ni...@thykier.net>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2011 by Niels Thykier
+
+This tool is free software; you may redistribute it and/or modify
+it under the terms of GNU GPL 2.
+
+=cut
+
+
diff --git a/tutorial.txt b/tutorial.txt
index d34a1b6..1339575 100644
--- a/tutorial.txt
+++ b/tutorial.txt
@@ -155,9 +155,21 @@ be run before `jh_installlibs`.  In these versions the 
jars were usually
 referred to by their location in the build directories rather than their
 install location.
 
+jh_wrapjars
+-----------
+
+`jh_wrapjars` can be used to auto-generate small wrapper scripts for
+jar files.  These will use `javawrapper` as a backend for doing their
+actual work.
+
+See the "Runtime support" section below for more information.
+
 jh_exec
 -------
 
+This tool is generally deprecated in favour of `jh_wrapjars`.  It is
+kept to avoid breaking packages that still use it.
+
 The Runtime support section below describes running executable jars
 directly. `jh_exec` will scan package directories for jars in the paths,
 or symlinks to jar from the paths, and ensure that they have been set

-- 
UNNAMED PROJECT

_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to