Skip to content

Commit be9452e

Browse files
committed
check klayout version
Signed-off-by: vijayank88 <[email protected]>
1 parent b5dbfc1 commit be9452e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

etc/DependencyInstaller.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ fi
1212
# package versions
1313
klayoutVersion=0.28.8
1414

15+
_versionCompare(){
16+
local a b IFS=. ; set -f
17+
printf -v a %08d $1; printf -v b %08d $3
18+
test $a "$2" $b
19+
}
20+
1521
_installORDependencies() {
1622
./tools/OpenROAD/etc/DependencyInstaller.sh ${OR_INSTALLER_ARGS}
1723
}
@@ -42,11 +48,10 @@ _installCentosPackages() {
4248
if ! [ -x "$(command -v klayout)" ]; then
4349
yum install -y https://www.klayout.org/downloads/CentOS_7/klayout-${klayoutVersion}-0.x86_64.rpm
4450
else
45-
currentver="$(klayout -v)"
46-
currentver=$(echo $currentver | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
47-
currentver=$(echo $currentver | tr -d '.')
48-
requiredver=$(echo $klayoutVersion | tr -d '.')
49-
if [ "$currentver" -ge "$requiredver" ]; then
51+
currentVersion="$(klayout -v)"
52+
currentVersion=$(echo $currentVersion | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
53+
requiredVersion=$(echo $klayoutVersion)
54+
if _versionCompare $currentVersion -ge $requiredVersion; then
5055
echo "KLayout version greater than or equal to ${klayoutVersion}"
5156
else
5257
echo "KLayout version less than ${klayoutVersion}"

0 commit comments

Comments
 (0)