Skip to content

Commit

Permalink
Build: fix semver_into so that it doesnt misparse versions like "2.3.4"
Browse files Browse the repository at this point in the history
  • Loading branch information
bjourne committed Dec 2, 2015
1 parent bb43e27 commit f730f81
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions build-support/factor.sh
Expand Up @@ -113,22 +113,22 @@ set_md5sum() {
}

semver_into() {
CLANG_RE_OLD="^([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3-5
RE_SEMVER="^([0-9]*)\.([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3.3-5
if [[ $1 =~ $CLANG_RE_OLD ]] ; then
export "$2=${BASH_REMATCH[1]}"
export "$3=${BASH_REMATCH[2]}"
export "$4=0"
export "$5=${BASH_REMATCH[3]}"
elif [[ $1 =~ $RE_SEMVER ]] ; then
export "$2=${BASH_REMATCH[1]}"
export "$3=${BASH_REMATCH[2]}"
export "$4=${BASH_REMATCH[3]}"
export "$5=${BASH_REMATCH[4]}"
else
echo "unsupported version number, please report a bug: $1"
exit 123
fi
RE_SEMVER="^([0-9]*)\.([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3.3-5
CLANG_RE_OLD="^([0-9]*)\.([0-9]*)-?(.*)?$" # 3.3-5
if [[ $1 =~ $RE_SEMVER ]] ; then
export "$2=${BASH_REMATCH[1]}"
export "$3=${BASH_REMATCH[2]}"
export "$4=${BASH_REMATCH[3]}"
export "$5=${BASH_REMATCH[4]}"
elif [[ $1 =~ $CLANG_RE_OLD ]] ; then
export "$2=${BASH_REMATCH[1]}"
export "$3=${BASH_REMATCH[2]}"
export "$4=0"
export "$5=${BASH_REMATCH[3]}"
else
echo "unsupported version number, please report a bug: $1"
exit 123
fi
}

# issue 1440
Expand Down

0 comments on commit f730f81

Please sign in to comment.