Skip to content

Commit a079125

Browse files
authored
Merge pull request #1105 from vijayank88/klayout_check
check klayout version for centos
2 parents 92dfb1b + 24901f0 commit a079125

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

etc/DependencyInstaller.sh

Lines changed: 18 additions & 1 deletion
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
}
@@ -39,7 +45,18 @@ _installCentosPackages() {
3945
ruby-devel \
4046
tcl-devel
4147

42-
yum install -y https://www.klayout.org/downloads/CentOS_7/klayout-${klayoutVersion}-0.x86_64.rpm
48+
if ! [ -x "$(command -v klayout)" ]; then
49+
yum install -y https://www.klayout.org/downloads/CentOS_7/klayout-${klayoutVersion}-0.x86_64.rpm
50+
else
51+
currentVersion=$(klayout -v | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
52+
if _versionCompare $currentVersion -ge $klayoutVersion; then
53+
echo "KLayout version greater than or equal to ${klayoutVersion}"
54+
else
55+
echo "KLayout version less than ${klayoutVersion}"
56+
sudo yum remove -y klayout
57+
yum install -y https://www.klayout.org/downloads/CentOS_7/klayout-${klayoutVersion}-0.x86_64.rpm
58+
fi
59+
fi
4360
}
4461

4562
_installUbuntuCleanUp() {

0 commit comments

Comments
 (0)