libreoffice/0001-Adapt-getcompver.awk-to-Java-9.patch

39 lines
1.2 KiB
Diff

From b44f062df9f541b0a1bea974556483c7a5876b35 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Wed, 30 Aug 2017 15:16:22 +0200
Subject: [PATCH] Adapt getcompver.awk to Java 9
...where at least <http://jdk.java.net/9/> "JDK 9 Early-Access Builds" 'java
-version' outputs a single-digit
java version "9"
Change-Id: I7807f56593e5436418b49950ca6c2a178d6721f5
---
solenv/bin/getcompver.awk | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/solenv/bin/getcompver.awk b/solenv/bin/getcompver.awk
index ae08f4e21790..6744c4dc5c7c 100644
--- a/solenv/bin/getcompver.awk
+++ b/solenv/bin/getcompver.awk
@@ -40,8 +40,13 @@ BEGIN {
/java version/ || /openjdk version/ {
compiler_matched = 1
# match on the format of the java versions ( d[d].d[d].d[d] )
- x = match( $0, /[0-9]*\.[0-9]*\.[0-9]*/ )
- CCversion = substr( $0, RSTART, RLENGTH)
+ if (match($0, /[0-9]+\.[0-9]+\.[0-9]+/)) {
+ CCversion = substr($0, RSTART, RLENGTH)
+ } else if (match($0, /[0-9]+\.[0-9]+/)) {
+ CCversion = substr($0, RSTART, RLENGTH) "."
+ } else if (match($0, /[0-9]+/)) {
+ CCversion = substr($0, RSTART, RLENGTH) ".."
+ }
}
/^[0-9]*[.][0-9]*\r*$/ {
if ( compiler_matched == 0 ) {
--
2.14.1