My wishlist of Java related checks in portlint
I am no Perl hacker nor I have time to learn Perl for now. Still there are many Java related sanity checks that could be performed by portlint. I will list them here just in case some volunteer shows up...
Use of Java features without USE_JAVA
WHEN: !defined(USE_JAVA) && (defined(JAVA_VERSION) || defined(JAVA_OS) || defined(JAVA_VENDOR) || defined(USE_ANT) || defined(JAVA_RUN) || defined(JAVA_BUILD) || defined(USE_JIKES))
LEVEL: Critical
MESSAGE: The port uses Java features but USE_JAVA is not defined.
Use of Java features without the 'java' category
WHEN: defined(USE_JAVA) && "${CATEGORIES:Mjava}"==""
LEVEL: Warning
MESSAGE: The port uses Java but is not part of the 'java' category.
NO_BUILD and JAVA_BUILD
WHEN: defined(NO_BUILD) && defined(JAVA_BUILD)
LEVEL: Critical
MESSAGE: JAVA_BUILD and NO_BUILD cannot be set at the same time.
NOTE: This check is already performed by bsd.java.mk but I would prefer it to be in portlint to speedup index build (and cleanup bsd.*.mk).
Use of JAVAJARDIR
WHEN: grep -q '\${PREFIX}/share/java/classes' Makefile
LEVEL: Critical
MESSAGE: You should use ${JAVAJARDIR} rather than ${PREFIX}/share/java/classes
Use of JAVASHAREDIR
WHEN: grep -q '\${PREFIX}/share/java' Makefile
LEVEL: Critical
MESSAGE: You should use ${JAVASHAREDIR} rather than ${PREFIX}/share/java
Use of JAVALIBDIR
WHEN: make PREFIX=XXX -V BUILD_DEPENDS -V RUN_DEPENDS | grep -q 'XXX/share/java/classes'
LEVEL: Critical
MESSAGE: You should use ${JAVALIBDIR} in BUILD_DEPENDS/RUN_DEPENDS to define dependencies on JAR files installed in ${JAVAJARDIR}.
Use of 'javavm'
WHEN: grep -q 'javavm' ${FILESDIR}/*
LEVEL: Warning
MESSAGE: Since javavmwrapper 2.0, the 'javavm' command to invoke a JVM is deprecated. Use 'java' instead.
Now that 1.0 syntax support, was removed from bsd.java.mk, here is a set of new tests to be performed by portlint:
Syntax for USE_JAVA
WHEN: USE_JAVA is not of the form 1\.[0-9]+?( 1\.[0-9]+?)* (e.g. "1.2", "1.1 1.4+", "1.1 1.2 1.3 1.4")
LEVEL: Critical
MESSAGE: USE_JAVA should be of the form 1.[0-9]+?( 1\.[0-9]+?)*
Use of %%JAVAJARDIR%% in pkg-plist
WHEN: pkg-plist contains share/java/classes
LEVEL: Critical
MESSAGE: Consider using %%JAVAJARDIR%% rather than "share/java/classes" in pkg-plist
Use of %%JAVAJARDIR%% in rc scripts
WHEN: some file as ${FILESDIR}/*.sh.in contains share/java/classes
LEVEL: Warning
MESSAGE: Consider using %%JAVAJARDIR%% rather than "share/java/classes" in <filename>