[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dh_java



On Monday 28 May 2001 10:46, Egon Willighagen wrote:
> The current Java policy states there is no dh_java... I plan to start
> writing one...
>
> I guess it should be places in the debhelper package, correct?
>
> Are there policies specific for dh_* programs? Like API's?
>
> My idea is to scan *java files for import clauses and look these up
> in a table with known imports for available debian java libraries...
>
> The result would be a list of jars the *java files depend on, which as far
> as i know is the sole purpose of dh_java.... correct?

Status:

i have written two programs (in Perl :) that compiles two types of indices:
1. an index of libraries provided by Debian packages
2. an index of libraries provided by a *local* set of jar files...

The first indices is likely to be distributed with the software...

These two indices can be used to determine dependencies for your Java classes.
It does not consider class dependencies yet (like java.io.Reader), but only
library dependencies (like java.io.*)... This is one of the shortcomings at this moment...

But I believe it is a nice start and handy tool with a growing set of Java
libraries included in Debian: it simply shows which Debian packages provide libraries you might have used a .jar file for...

A simple scenario (for Jmol (www.openscience.org/jmol) :

# to index jars included in the Jmol CVS
> dh_java_make_index -v -p ~/CVS/Jmol/jars
Processing private jar /home/egonw/CVS/Jmol/jars/Acme.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/aelfred.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/cml.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/jas.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/junit.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/multi.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/sax.jar...
Duplicate library path: org.xml.sax in both /home/egonw/CVS/Jmol/jars/jas.jar and /home/egonw/CVS/Jmol/jars/sax.jar!
Duplicate library path: org.xml.sax.helpers in both /home/egonw/CVS/Jmol/jars/jas.jar and /home/egonw/CVS/Jmol/jars/sax.jar!
Processing private jar /home/egonw/CVS/Jmol/jars/saxon.jar...
Duplicate library path: org.xml.sax in both /home/egonw/CVS/Jmol/jars/jas.jar and /home/egonw/CVS/Jmol/jars/sax.jar,/home/egonw/CVS/Jmol/jars/saxon.jar!
Duplicate library path: org.xml.sax.helpers in both /home/egonw/CVS/Jmol/jars/jas.jar and /home/egonw/CVS/Jmol/jars/sax.jar,/home/egonw/CVS/Jmol/jars/saxon.jar!
Duplicate library path: org.w3c.dom in both /home/egonw/CVS/Jmol/jars/jas.jar and /home/egonw/CVS/Jmol/jars/saxon.jar!
Processing private jar /home/egonw/CVS/Jmol/jars/swing.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/vecmath1.1-1.12.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/jmol.jar...
Processing private jar /home/egonw/CVS/Jmol/jars/jmol-applet.jar...
Duplicate library path: org.openscience.jmol in both /home/egonw/CVS/Jmol/jars/jmol.jar and /home/egonw/CVS/Jmol/jars/jmol-applet.jar!

# the second step is to determine which Debian packages provide needed libraries
> dh_java -p dh_make.index.private `find ~/CVS/Jmol/src/ -name "*.java"`
Needed libraries:
  Acme.JPM.Encoders: needed by 1 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/Acme.jar
  com.microstar.xml: needed by 1 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/aelfred.jar
  jas.hist: needed by 1 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/jas.jar
  junit.framework: needed by 7 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/junit.jar
  org.openscience.cdopi: needed by 4 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/cml.jar
  org.openscience.cml: needed by 3 Java file(s)
        provided by private jar /home/egonw/CVS/Jmol/jars/cml.jar
  org.xml.sax: needed by 3 Java file(s)
        provided by Debian package(s) libxerces-java,lib-sax-java,lib-openxml-java,libxalan2-java
        provided by private jar /home/egonw/CVS/Jmol/jars/jas.jar,/home/egonw/CVS/Jmol/jars/sax.jar,/home/egonw/CVS/Jmol/jars/saxon.jar
  org.xml.sax.helpers: needed by 2 Java file(s)
        provided by Debian package(s) libxerces-java,lib-sax-java,lib-openxml-java,libxalan2-java
        provided by private jar /home/egonw/CVS/Jmol/jars/jas.jar,/home/egonw/CVS/Jmol/jars/sax.jar,/home/egonw/CVS/Jmol/jars/saxon.jar


TODO:
- make Debian package for dh_java
- have dh_java output a "control" line
- have dh_java output a classpath
- read/comment and implement debian-java comments/wishes etc (hint, hint)


Egon



Reply to: