Skip to content

Commit

Permalink
Merged the two expressions to single regex
Browse files Browse the repository at this point in the history
  • Loading branch information
judovana committed May 3, 2024
1 parent 669a1a5 commit 99d3253
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ function setOpenJdkVersion() {
# The argument passed here have actually very strict format of jdk8, jdk8u..., jdk
# the build may fail later if this is not honoured.
# If your repository has a different name, you can use --version or build from dir/snapshot
local forest_name_check1=0
local forest_name_check2=0
echo "$forest_name" | grep "^jdk[0-9]\\{1,3\\}[u]\\{0,1\\}$" >/dev/null || forest_name_check1=$?
echo "$forest_name" | grep "^jdk$" >/dev/null || forest_name_check2=$?
if [ ${forest_name_check1} -ne 0 ] && [ ${forest_name_check2} -ne 0 ]; then
local forest_name_check=0
echo "$forest_name" | grep "^\(jdk\|jdk[0-9]\\{1,3\\}[u]\\{0,1\\}\)$" >/dev/null || forest_name_check=$?
if [ ${forest_name_check} -ne 0 ]; then
echo "The mandatory repo argument has a very strict format 'jdk[0-9]{1,3}[u]{0,1}' or just plain 'jdk' for tip. '$forest_name' does not match."
echo "This can be worked around by using '--version jdkXYu'. If set (and matching) then the main argument can have any value."
exit 1
fi

fi
}
# Derive the openjdk_core_version from the forest name.
local openjdk_core_version=${forest_name}
if [[ ${forest_name} == *u ]]; then
Expand Down

0 comments on commit 99d3253

Please sign in to comment.