Skip to content

Commit ba26e89

Browse files
committed
fix version matching
1 parent e011bc7 commit ba26e89

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/dart/install.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ find_version_from_git_tags() {
2929
local repository=$2
3030
local prefix=${3:-"tags/v"}
3131
local separator=${4:-"."}
32-
local last_part_optional=${5:-"false"}
32+
local last_part_optional=${5:-""}
3333
if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then
3434
local escaped_separator=${separator//./\\.}
3535
local last_part
36-
if [ "${last_part_optional}" != "false" ]; then
37-
last_part="(${escaped_separator}[0-9]+)*.*${last_part_optional}"
36+
if [ -n "${last_part_optional}" ]; then
37+
last_part=".*${last_part_optional}"
3838
else
39-
last_part="${escaped_separator}[0-9]+"
39+
last_part=""
4040
fi
41-
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${last_part}$"
41+
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${escaped_separator}[0-9]+${last_part}$"
4242
local version_list
4343
check_git
4444
check_packages ca-certificates
@@ -75,7 +75,7 @@ if [ "${CHANNEL}" = "main" ]; then
7575
URL="https://storage.googleapis.com/dart-archive/channels/be/raw/latest/sdk/dartsdk-linux-${SDK_ARCH}-release.zip"
7676
else
7777
if [ "${CHANNEL}" = "stable" ]; then
78-
LAST_PART="false"
78+
LAST_PART=""
7979
elif [ "${CHANNEL}" = "beta" ]; then
8080
LAST_PART="beta"
8181
elif [ "${CHANNEL}" = "dev" ]; then
@@ -85,7 +85,7 @@ else
8585
exit 1
8686
fi
8787
# Soft version matching
88-
find_version_from_git_tags VERSION "https://github.com/dart-lang/sdk" "tags/v" "." "${LAST_PART}"
88+
find_version_from_git_tags VERSION "https://github.com/dart-lang/sdk" "tags/" "." "${LAST_PART}"
8989

9090
URL="https://storage.googleapis.com/dart-archive/channels/${CHANNEL}/release/${VERSION}/sdk/dartsdk-linux-${SDK_ARCH}-release.zip"
9191
fi

test/dart/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ check_packages() {
2020
}
2121

2222
check_packages git
23-
LATEST_VERSION="$(git ls-remote --tags https://github.com/dart-lang/sdk | grep -oP "[0-9]+\\.[0-9]+\\.[0-9]+" | sort -V | tail -n 1)"
23+
LATEST_VERSION="$(git ls-remote --tags https://github.com/dart-lang/sdk | grep -oP "refs/tags/[0-9]+\\.[0-9]+\\.[0-9]+$" | sort -V | tail -n 1)"
2424

2525
check 'dart' dart --version | grep "${LATEST_VERSION}"
2626

0 commit comments

Comments
 (0)