[aarch64-port-dev ] FW: [Mach5] mach5-one-phh-JDK-8151779-20200427-2151-10554367: FAILED
Erik Joelsson
erik.joelsson at oracle.com
Fri May 1 13:04:59 UTC 2020
Hello,
My OracleJDK 14 displays:
java version "14" 2020-03-17
Not sure where you found a version output without the word "version" in it.
From what I understand, any distributor is free to change the "openjdk"
prefix of this line, so relying on there only being 2 cases is not a
good idea. If we assume the boot jdk must be an OpenJDK derivative, then
a regular expression that tries to capture the line in more detail would
be preferred. The aspects I would try to capture would be the word
version and a bunch of numbers and dots (and possibly underscore if we
want to keep it compatible with even older java versions for easier
backports) inside double quotes. Something like this perhaps:
grep "version \"[0-9\._]*\""
I tried that expression manually on Mac, Linux and Solaris so should be
portable enough.
/Erik
On 2020-04-30 16:48, Liu, Xin wrote:
> Hi, Andrew,
>
> How about this? I can use awk to capture java -version. There're 2 cases.
>
> I) openjdk
> openjdk version "14.0.1" 2020-04-14
> 2) oraclejdk
> java 14.0.1 2020-04-14
>
> if somehow java displays some error/warning messages, awk can filter them out and capture the version line.
> Eg.
> $ ~/builds/jdk-14.0.1+7/bin/java -version
> [0.009s][error][cds] Unable to map CDS archive -- os::vm_allocation_granularity() expected: 65536 actual: 4096
> openjdk version "14.0.1" 2020-04-14
> OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode)
> $ ~/builds/jdk-14.0.1+7/bin/java -version 2>&1 | awk '/^(openjdk version|java)/ {print $0}'
> openjdk version "14.0.1" 2020-04-14
>
> I think this awk stmt is portable, but it's always good to ask experts to review it, so I cc build-dev.
>
> Hers is the change.
>
> diff --git a/make/autoconf/boot-jdk.m4 b/make/autoconf/boot-jdk.m4
> --- a/make/autoconf/boot-jdk.m4
> +++ b/make/autoconf/boot-jdk.m4
> @@ -74,7 +74,7 @@
> BOOT_JDK_FOUND=no
> else
> # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
> - BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $HEAD -n 1`
> + BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java$EXE_SUFFIX" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $AWK '/^(openjdk version|java)/ {print [$]0}'`
> if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
> AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
> AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
> @@ -529,7 +529,7 @@
> BUILD_JDK_FOUND=no
> else
> # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
> - BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
> + BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $AWK '/^(openjdk version|java)/ {print [$]0}'`
>
> # Extra M4 quote needed to protect [] in grep expression.
> [FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP "\"$VERSION_FEATURE([\.+-].*)?\""`]
>
>
>
> On 4/30/20, 2:52 PM, "aarch64-port-dev on behalf of Liu, Xin" <aarch64-port-dev-bounces at openjdk.java.net on behalf of xxinliu at amazon.com> wrote:
>
> Hi, Andrew,
>
> That's a hack. A general way should use grep or sed to capture the needed line instead of hardcoding first or second line.
> Okay, Let me try to do that.
>
> Thanks,
> --lx
>
>
> On 4/30/20, 1:19 AM, "aph at redhat.com" <aph at redhat.com> wrote:
>
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.
>
>
>
> On 4/30/20 12:43 AM, Liu, Xin wrote:
> > One trick here. It's very easy to cheat configure by hacking the boot-jdk.m4 to "$HEAD -n 2". Everything looks fine then.
>
> The fix should be submitted to build-dev.
>
> --
> Andrew Haley (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>
>
More information about the build-dev
mailing list