Matthew Johnson wrote: > On Wed May 02 16:54, Michael Koch wrote: >> On Wed, May 02, 2007 at 03:15:39PM +0100, Matthew Johnson wrote: >>> On Wed May 02 15:57, Michael Koch wrote: >>>> On Wed, May 02, 2007 at 01:58:46PM +0100, Matthew Johnson wrote: >>>>> Two subjects to this mail. Firstly, I had a go at writing a dh_javadeps >>>>> which will search for jar files, find the classes they reference and >>>>> find the packages they are in. This can be found at >>>>> http://mjj29.matthew.ath.cx/dh_javadeps It updates $package.substvars so >>>>> you can use ${java:Depends} in control files. >>>> Thats really nice to have. Unfortunately it didnt worked on a pretty >>>> simple example for me. >>> Hmm, could you let me know what the example was (it worked on my pretty >>> simple example) >> I created debian/test and put ant.jar into it. Then I executed >> >> dh_javadeps -p test >> >> As output I got this: >> >> xargs: unmatched einfache quote; by default quotes are special to xargs >> unless you use the -0 option > > Hmm, odd. I've just updated the one at that URL in case I rewrote it and > the following works for me: > > mkdir -p debian/test > cp /usr/share/java/ant-1.6.jar debian/test > touch debian/control > dh_javadeps -p test > cat debian/test.substvars > >> I think about code paths that are only used when you use certain >> features of a program. When the dependency itself has a long list of >> depdencies it can make sense to not hardly depend on it when its only >> needed/used by 0.1% of the users of a program. > > and you assume the program nicely handles this case? I think anything > which causes the JVM to throw an exception failing to load a class > requires a depends. (not that my code above does this, it's a bit of a > hack and is likely to over-depend) > >> No, thats no bug. E.g. we ship different versions of the servlet >> specification in Debian. ASM is another example. We have currently two >> major versions in Debian. A third is coming soon. All have similar to >> equal class names (with sometimes different APIs). Thats no bug. Thats >> common practice in Java-land. > > Hmm, that feels totally wrong to me. Possibly a --prefer= parameter? > > Matt
Thanks for submitting this idea - you've reawakened my interest in compiling a "Java Packagers Wishlist"! I think the idea of writing a program to determine Jar dependencies is a good one, but I'm not sure it can ever be fully automatic, for the reasons Michael has given above. As such I don't think it would be appropriate to make it a debhelper dh_xxxxxx command - these are expected to work flawlessly without the need for any user "tweaking". But I think your idea would work very well if integrated into "dh_make". The expectation of dh_make is that it will make a good "first draft" which must then be tweaked by the user. (Assuming dh_make is ever enhanced to recognise Java packages of course). I've got a couple of queries about your program: * It's getting late so I may have misread the regular expressions, but are you only searching for a matching _class_ name (without the package part). E.g. org.codehaus.plexus.classworlds.realm.Entry might match against org.someone.else.Entry? Or have I misunderstood your RE? * Using the "strings" command seems to me a bit unsafe, in that you could get false positives if there are (normal) strings that end in "class". I'm not sure if that is a real-life concern, or just my over-active imagination. At this point I should probably confess that I've written a fairly similar utility myself. It generates a package cross-reference as an HTML file, and has its own set of problems - e.g. if more than one Jar provides a class. I've never got around to finishing it, so it's a bit rough around the edges. If you are interested: Example output for the Maven Jars: http://www.paulcager.org/debian/Maven-2.0.5.html Example output for all Jars (warning: about 100KB): http://www.paulcager.org/debian/AllJars.html Source Code (you will need libbcel-java to compile / run it): http://www.paulcager.org/debian/JarDepends.java Run by: cd /usr/share/java java -cp /download/dir:/usr/share/java/bcel.jar cager.jars.JarDepends `find -type f | sort` >/var/www/paul/AllJars.html -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]