On Sun, 03 Dec 2023 16:09:54 +0100 Markus Koschany <[email protected]> wrote:
> On Tue, 28 Nov 2023 17:59:18 +0100 Joan <[email protected]> wrote:
> > Package: tomcat10-common
> > Version: 10.1.15-1
> > Severity: normal
> > X-Debbugs-Cc: [email protected]
> >
> > Dear Maintainer,
> >
> >    * What led up to the situation?
> > I am trying to use debian's tomcat 10 with java 21, since it's not
present on
> debian I used the one from
> > https://adoptium.net/installation/linux/ that has a repository.
>
> [...]
>
> Hello,
>
> we support only OpenJDK and there is even openjdk-21-jre in unstable. For
> stable releases only one version of openjdk is supported in general,
currently
> OpenJDK 17.

While I understand the logic of not searching for every vendor-specific
pattern possible (even if Temurin is growing close to a standard), what
about relying on the "alternatives" system (which is definitely a standard
on Debian)? It feels more future-proof than some custom pattern-based
matching, and that would cover any vendor that properly registers there. It
would be more consistent with the fact that the package uses the very
generic virtual packages as dependencies, which usually match all vendors
that provide Debian packages (like Temurin).

For example something like this (to use the current default whatever it is):

JAVA_BIN=$(update-alternatives --query java 2>/dev/null | sed -n 's/^Value:
//p')
if [ -n "$JAVA_BIN" ]; then
    JAVA_HOME=$(dirname "$(dirname "$JAVA_BIN")")
fi

Or, if you want to keep the currrent logic of enforcing a range of
supported versions, something like the following (warning: quick
LLM-suggested version script which can probably be written better):

find_jdks()
{
    for java_version in 25 24 23 22 21 20 19 17
    do
        # Any JDK registered in the java alternatives, whatever its
vendor/layout
        for java_bin in $(update-alternatives --list java 2>/dev/null ||
true)
        do
            jvmdir=$(dirname "$(dirname "$java_bin")")
            if [ -r "$jvmdir/release" ] && \
               grep -q "^JAVA_VERSION=\"${java_version}[.\"]"
"$jvmdir/release"
            then
                JDK_DIRS="${JDK_DIRS} ${jvmdir}"
            fi
        done
        for jvmdir in /usr/lib/jvm/java-${java_version}-openjdk-* \
                      ... (existing patterns unchanged)

Thanks,
--
Thomas Mortagne

Reply via email to