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

Re: Bug#923756: libhac-java: FTBFS in buster/sid



Hello Andreas,

Am 05.03.19 um 06:11 schrieb Andreas Tille:
[...]
> Any idea how to fix this?

In my opinion this is a bug in OpenJDK and the new javadoc behavior is
too strict but it is probably useless to argue about it.

We currently work around this error in Maven by setting
detectJavaApiLinks to false by default. We could do a similar change in
javahelper.

jh_build, which is responsible for calling the javadoc command,
automatically tries to link against external classes with

-link /usr/share/doc/default-jdk-doc/api -link
/usr/share/doc/default-jre-headless/api

This way users can click on a link to an external class. If Debian's
corresponding -doc package is installed, the javadoc for this external
class would have been displayed in the past. This is why we recommend to
build-depend on -doc packages because jh_build scans the control file
for -doc packages and links against them. Now there is an
incompatibility between your documented code and the documented code in
default-jdk-doc. The workaround for javahelper could be to remove the
-link option and to not try to link against external classes by default.
The result would be links to external classes would be no longer
displayed but at least your own package with its own classes would be
documented again.

Maybe we should change our javadoc policy too. Developers shall not
build-depend on other -doc packages by default and override jh_build if
they wish to link against external packages. This way they have more
fine grained control about their -doc packages and we don't have to
worry about those errors anymore.

Here is my proposed patch for jh_build against src:javatools master.

Regards,

Markus
From e731cb503712fea1618b9b3bff041c89800bcf1d Mon Sep 17 00:00:00 2001
From: Markus Koschany <apo@debian.org>
Date: Tue, 5 Mar 2019 13:19:24 +0100
Subject: [PATCH] jh_build: Remove CLASSPATHDOCS variable and do not link to
 external classes

by default anymore.
---
 jh_build | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/jh_build b/jh_build
index 91ce0e2..3795096 100755
--- a/jh_build
+++ b/jh_build
@@ -116,7 +116,7 @@ my $CLASSPATH = $CLASSPATH_ORIG;
 my @JH_JAR_EXTRA;
 my $build_javadoc = 1;
 my (@javac_opts, @javadoc_opts, $main_class, $do_clean);
-my (@JAVAC, @JAVADOC, @JAR, @CLASSPATHDOCS, @builds);
+my (@JAVAC, @JAVADOC, @JAR, @builds);
 
 $CLASSPATH =~ tr/:/ / if defined($CLASSPATH_ORIG);
 @JH_JAR_EXTRA = split(' ', $ENV{'JH_JAR_EXTRA'}) if @JH_JAR_EXTRA;
@@ -222,13 +222,13 @@ sub do_build {
 		my $files_escaped = escape_shell(@srcfiles);
 		complex_doit(qq{find $dirs_escaped -name '*.java' -and -type f -print0 | xargs -s 512000 -0 @JAVAC -g -cp ${CLASSPATH_ORIG}:debian/_jh_build.$ext -d debian/_jh_build.$ext @javac_opts $files_escaped});
 		if ($build_javadoc) {
-			complex_doit(qq{find $dirs_escaped -name '*.java' -and -type f -print0 | xargs -s 512000 -0 @JAVADOC @CLASSPATHDOCS -classpath ${CLASSPATH_ORIG}:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $files_escaped});
+			complex_doit(qq{find $dirs_escaped -name '*.java' -and -type f -print0 | xargs -s 512000 -0 @JAVADOC -classpath ${CLASSPATH_ORIG}:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS $files_escaped});
 		}
 
 	} elsif (@srcfiles) {
 		doit(@JAVAC, '-g', '-cp', "${CLASSPATH_ORIG}:_jh_build.$ext", '-d', "debian/_jh_build.$ext", '-quiet', @javac_opts, @srcfiles);
 		if ($build_javadoc) {
-			doit(@JAVADOC, @CLASSPATHDOCS, '-classpath', "${CLASSPATH_ORIG}:_jh_build.$ext", '-d', "debian/_jh_build.javadoc/api", '-quiet', @javadoc_opts, @srcfiles);
+			doit(@JAVADOC, '-classpath', "${CLASSPATH_ORIG}:_jh_build.$ext", '-d', "debian/_jh_build.javadoc/api", '-quiet', @javadoc_opts, @srcfiles);
 		}
 	} else {
 		return;
@@ -242,14 +242,6 @@ sub do_build {
 	return;
 }
 
-sub _classpath_docs {
-	my $source = sourcepackage();
-	return map {
-		chomp;
-		('-link', $_)
-	} `for i in \$(grep-dctrl --no-field-names --show-field Build-Depends,Build-Depends-Indep -F source "${source}" debian/control | tr , ' ' | sed 's/([^)]*)//g') ; do dpkg -L \$i 2>/dev/null | grep /usr/share/doc/.*/api\$; done`;
-}
-
 # By default, jh_build does nothing without a debian/javabuild file or explicit arguments.
 # PROMISE: DH NOOP WITHOUT pkgfile(javabuild)
 
@@ -269,7 +261,6 @@ if (@builds) {
 	@JAVAC = ("${JAVA_HOME}/bin/javac");
 	@JAVADOC = ("${JAVA_HOME}/bin/javadoc", '-locale', 'en_US');
 	@JAR = ("${JAVA_HOME}/bin/jar");
-	@CLASSPATHDOCS = _classpath_docs();
 	for my $build (@builds) {
 		do_build(@{$build});
 	}
-- 
2.20.1

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: