Status report Jigsaw num. 2 for GSoC 2011
My internship is now finished, this means that I will be able to work on
my GSoC project a lot more than the previous weeks. I hope to make some
good progress in the next days.
This last 2 weeks, I was still studying how Jigsaw works. Even if there
is no progress on the Jigsaw packaging I have done some packages that
will help later.
I've spend a lot of time trying to package JT Harness and JTReg.
I've successfully built JT Harness using CDBS but I've finally rewritten
the package using only debhelper and javahelper. Javahelper was
really useful to build JAR files, move them to the right directory, put
the Javadoc in the right place as well as the examples. The Debian
directory of JT Harness can be found on the Java team SVN.
The source package of jtharness build 2 binary packages:
libjtharness-java and libjtharness-java-doc. You can see that by looking
at the "control" file in the "debian" directory. There are some
interesting files in this package, let's take a look at them.
First of all, some of the source files needed to be patched for the
package to build. So to accomplish this, there is a couple of patches in
* dependencies.diff, used to locate JAR files in "/usr/share/java",
* rxtx.diff, done by Tom Marble used to change some imports from
* "javax.comm" to "gnu.io".
To generate these patches, I've used the "edit-patch" command which is a
really awesome tool. This command uses a temporary shell where we can
edit files we want to patch. When the job is done, CTRL + D terminates
the temporary shell and the patch is generated.
There are 4 interesting files which are used to build the binary
packages and put the files in the right directories. These files are:
Of course "rules" is the most important one. This file tells us how
packages are built. A good thing is that "rules" is quite simple in the
JAVA_HOME = /usr/lib/jvm/default-java
ant -f build/build.xml
dh $@ --with javahelper
We just tell where Java is and to use javahelper (--with javahelper).
Overriding "dh_auto_build" is interesting because since the JT Harness
uses Ant as build system we need to give to Ant where the "build.xml"
file is. By default Ant is searching it in the current directory but in
jtharness the file is in the "build" directory. Since the Ant build file
is correctly written, the build generates JAR files, Javadoc and
examples code. And "libjtharness-java*" files are here to put the
generated things in the right places.
The job of "libjtharness-java.jlibs" is to tell where to find the JAR
libraries. In this case, the intesresting JAR files were "javatest.jar"
and "jt-junit.jar". So in the .jlibs file we just give where those files
are after being built.
The job of "libjtharness-java-doc.javadoc" is to tell where the Javadoc
is and where to put it. So there is only one line that says the
generated Javadoc is in "jar-build/javadoc" and put it in
And finally, "libjtharness-java-doc.install" is used to move the
examples. The syntax is same as "libjtharness-java-doc.javadoc".
The JT Harness package can be found in Sid now thanks to Sylvestre
Ledru who uploaded it for me. So the ITP bug that I created is now
Building the package for jtreg is quite similar. In fact, it probably
easier but I'm still facing a problem. jtharness is just a library,
jtreg does have main classes and generate some binaries. The difficulty
here is to generate the man pages for the 2 generated binaries: jtdiff
and jtreg. These 2 files are shell scripts which just use "jtreg.jar"
with the correct parameters.
I tried several tools to generate the man pages of each script. Sadly, I
can't find a way that does not causes any problems.
My first choice was to use help2man. This tool looked like to be
perfect for the job. But I couldn't find how to launch the scripts
correctly. The scripts needs "jtreg.jar" but they also need
"javatest.jar" from the libjtharness-java package. The classpath cannot
be set correctly due how the scripts are written. So to use help2man
I'll probably have to patch and completely rewrite "jtdiff.sh" and
"jtreg.sh" in the sources.
My second choice was to use txt2man. During the build of jtreg there
is a "usage.txt" file which is generated and which can be used as a man
page. txt2man can take this text file and output a man page based on the
text. I thought it was working but when building the package, lintian
threw some warnings about syntax errors in the man pages.
Finally, few days ago I decided to try rst2man. This tool looks cool
and easy to use. But the text that I have to convert into a man page is
not a reStructured text so it cannot without patching the "usage.txt"
file for example. I was going to do it but there is no such file in the
sources of jtreg. Actually this file is generated during the build but
the text had to come from somewhere. And it was from two properties
files in the source code.
I'm still looking for a good solution to generate the man pages. If
someone has any idea just let me know ;-)
The debian packaging of jtreg is not in the Java team SVN yet because of
the man pages problem. I opened an ITP bug so people know that
someone is working on jtreg.
My goal for the next two weeks is to finish the jtreg package,
understand how "jpkg" (which is supposed to create Debian packages)
works in Jigsaw and write more examples using the modular JVM.