Hello,
As I've not posted to this list before, allow me to introduce myself. I'm a
software intern at Red Hat, attached mainly to the open source java project (ie
IcedTea: http://icedtea.classpath.org/wiki/Main_Page).
For those not following developments in the Java world, there is something
called Project Jigsaw[1], which aims to modularize java, breaking the JDK up
into smaller chunks and allowing developers to produce their own modules.
Similar to the OSGi initiative, but with the goal of eventually becoming an
official part of the language. It is of course not yet part of the Java spec,
and all signs point to it not being an *official* part of the language in the
(fairly) soon to be released version 7. That said, there is a good chance that
the open-source implementation from Sun will support it.
Folks at Sun have been building a tool to help with package building for
software using this modularized java, with the idea being that this tool
consumes .jar (and potentially other) files and produces packages. However,
until recently this was focussed on .deb packages, and did not take into
account the processes involved for distros such as fedora and its derivatives,
using rpm as a central build system. Specifically, resolving dependencies is
the main issue. Packages may contain one or more modules, and the idea is to
have these modules as virtual dependencies in the rpm system.
Our friends at Sun have agreed to add functionality to their package building
tool, so that with appropriate arguments it will emit module information,
including dependencies, on stdout instead of attempting to build the package.
This tool will only need to see the .jar files in order to generate the details
RPM needs. The full details of how this information will be formatted are
still somewhat fluid, but with the information so far myself and Man Wong have
gone ahead and made some changes in RPM so that Sun's tool can be called, its
output parsed, and the virtual dependencies extracted. The solution is
modelled loosely after similar functionality which already exists for Perl
modules. I've attached a patch based off of the 4.7.1 release. Once the patch
is applied, configuring the build with --enable-jigsaw should enable our
changes. Note that because the packaging tool's output is not yet quantified,
the scripts included in the patch are bound to change; the important part at
this point is that we have the hooks in so that .jar files will trigger the
scripts to be called in the first place!
Even though this is not really commit-ready, if anyone has any feedback as to
these changes, that would be very much appreciated. Neither of us has any
experience contributing to RPM.
Many thanks,
jon
[1] http://openjdk.java.net/projects/jigsaw/
diff -r -U 3 ./build/rpmfc.c ../../rpm-4.7.1/build/rpmfc.c
--- ./build/rpmfc.c 2009-07-21 02:37:32.000000000 -0400
+++ ../../rpm-4.7.1/build/rpmfc.c 2009-10-14 16:01:57.000000000 -0400
@@ -1085,6 +1085,14 @@
#endif
}
+#ifdef JIGSAW
+static int rpmfcJAVA(rpmfc fc) {
+ int xx1 = rpmfcHelper(fc, 'P', "java");
+ int xx2 = rpmfcHelper(fc, 'R', "java");
+ return (xx1 + xx2);
+}
+#endif
+
typedef const struct rpmfcApplyTbl_s {
int (*func) (rpmfc fc);
int colormask;
@@ -1097,6 +1105,9 @@
{ rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_BOURNE|
RPMFC_PERL|RPMFC_PYTHON|RPMFC_MONO|
RPMFC_PKGCONFIG|RPMFC_LIBTOOL) },
+#ifdef JIGSAW
+ { rpmfcJAVA, RPMFC_JAVA },
+#endif
{ NULL, 0 }
};
@@ -1133,6 +1144,16 @@
}
}
+ /* Ensure .jar files are marked RPMFC_JAVA */
+#ifdef JIGSAW
+ { const char *fs1 = fc->fn[fc->ix] + (int) strlen(fc->fn[fc->ix]) - 4;
+ const char *fs2 = strstr(fc->fn[fc->ix], ".jar");
+ if (fs1 == fs2) {
+ fc->fcolor->vals[fc->ix] |= RPMFC_JAVA;
+ }
+ }
+#endif
+
if (fc->fcolor->vals[fc->ix])
for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) {
if (!(fc->fcolor->vals[fc->ix] & fcat->colormask))
diff -r -U 3 ./configure.ac ../../rpm-4.7.1/configure.ac
--- ./configure.ac 2009-07-21 04:20:46.000000000 -0400
+++ ../../rpm-4.7.1/configure.ac 2009-10-14 15:31:42.000000000 -0400
@@ -831,6 +831,11 @@
LIBS="$LIBS -ldmalloc"
fi
+AC_ARG_ENABLE(jigsaw, [ --enable-jigsaw build with jigsaw java modularization support ],,[enable_jigsaw=yes])
+if test "$enable_jigsaw" == yes ; then
+ AC_DEFINE(JIGSAW, 1, [ Conditional compilation of jigsaw support])
+fi
+
AC_CHECK_FUNCS(setlocale)
AC_CHECK_FUNCS(getpassphrase)
diff -r -U 3 ./macros.in ../../rpm-4.7.1/macros.in
--- ./macros.in 2009-07-21 02:49:56.000000000 -0400
+++ ../../rpm-4.7.1/macros.in 2009-10-14 15:32:38.000000000 -0400
@@ -499,6 +499,9 @@
%__pkgconfig_provides %{_rpmconfigdir}/pkgconfigdeps.sh --provides
%__pkgconfig_requires %{_rpmconfigdir}/pkgconfigdeps.sh --requires
+%__java_provides %{_rpmconfigdir}/java.prov
+%__java_requires %{_rpmconfigdir}/java.req
+
#==============================================================================
# ---- Database configuration macros.
# Macros used to configure Berkley db parameters.
diff -r -U 3 ./scripts/java.prov ../../rpm-4.7.1/scripts/java.prov
--- ./scripts/java.prov 2009-10-14 13:37:33.000000000 -0400
+++ ../../rpm-4.7.1/scripts/java.prov 2009-10-13 17:01:14.000000000 -0400
@@ -0,0 +1,33 @@
+#!/bin/bash
+HELPEREXEC="jpkg"
+HELPERARGS="-p"
+TARGETSUBSTR="provides"
+TARGETSUFFIX=".jar$"
+FIELDSEP="="
+
+function processJar ()
+{
+ # Only attempt to call helper if this is a jarfile.
+ echo $1 | grep "$TARGETSUFFIX" &>/dev/null
+ if [ $? ]
+ then
+ $HELPEREXEC $HELPERARGS $1 | grep $TARGETSUBSTR | \
+ awk -F $FIELDSEP '{ print $NF }'
+ fi
+}
+
+if [ $# -gt 0 ]
+then
+ {
+ for arg
+ do
+ processJar "$arg"
+ done
+ }
+fi
+while read line
+do
+ echo "Processing $line"
+ processJar "$line"
+done
+exit 0
diff -r -U 3 ./scripts/java.req ../../rpm-4.7.1/scripts/java.req
--- ./scripts/java.req 2009-10-14 13:37:48.000000000 -0400
+++ ../../rpm-4.7.1/scripts/java.req 2009-10-13 17:01:32.000000000 -0400
@@ -0,0 +1,33 @@
+#!/bin/bash
+HELPEREXEC="jpkg"
+HELPERARGS="-r"
+TARGETSUBSTR="requires"
+TARGETSUFFIX=".jar$"
+FIELDSEP="="
+
+function processJar ()
+{
+ # Only attempt to call helper if this is a jarfile.
+ echo $1 | grep "$TARGETSUFFIX" &>/dev/null
+ if [ $? ]
+ then
+ $HELPEREXEC $HELPERARGS $1 | grep $TARGETSUBSTR | \
+ awk -F $FIELDSEP '{ print $NF }'
+ fi
+}
+
+if [ $# -gt 0 ]
+then
+ {
+ for arg
+ do
+ processJar "$arg"
+ done
+ }
+fi
+while read line
+do
+ echo "Processing $line"
+ processJar "$line"
+done
+exit 0
diff -r -U 3 ./scripts/Makefile.am ../../rpm-4.7.1/scripts/Makefile.am
--- ./scripts/Makefile.am 2009-06-23 07:40:59.000000000 -0400
+++ ../../rpm-4.7.1/scripts/Makefile.am 2009-10-13 17:22:40.000000000 -0400
@@ -12,6 +12,7 @@
check-buildroot check-rpaths check-rpaths-worker \
find-debuginfo.sh find-lang.sh \
perldeps.pl perl.prov perl.req pythondeps.sh osgideps.pl \
+ java.prov java.req \
rpmdb_loadcvt rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd rpm2cpio.sh \
tcl.req tgpg u_pkg.sh \
@@ -29,6 +30,7 @@
check-buildroot check-rpaths check-rpaths-worker \
find-lang.sh \
perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
+ java.prov java.req \
mono-find-requires mono-find-provides \
pkgconfigdeps.sh libtooldeps.sh \
rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg
diff -r -U 3 ./scripts/Makefile.in ../../rpm-4.7.1/scripts/Makefile.in
--- ./scripts/Makefile.in 2009-07-21 04:21:04.000000000 -0400
+++ ../../rpm-4.7.1/scripts/Makefile.in 2009-10-13 17:22:07.000000000 -0400
@@ -312,6 +312,7 @@
brp-strip-static-archive check-files check-prereqs \
check-buildroot check-rpaths check-rpaths-worker \
find-debuginfo.sh find-lang.sh perldeps.pl perl.prov perl.req \
+ java.prov java.req\
pythondeps.sh osgideps.pl rpmdb_loadcvt rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd rpm2cpio.sh tcl.req tgpg u_pkg.sh \
vpkg-provides.sh vpkg-provides2.sh find-requires.php \
@@ -326,6 +327,7 @@
check-buildroot check-rpaths check-rpaths-worker \
find-lang.sh \
perl.prov perl.req perldeps.pl pythondeps.sh osgideps.pl \
+ java.prov java.req \
mono-find-requires mono-find-provides \
pkgconfigdeps.sh libtooldeps.sh \
rpmdb_loadcvt rpmdiff rpm2cpio.sh tcl.req tgpg
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint