[Ezbench-dev] [PATCH 02/15] profile: introduce a helper to compare versions reliably

Martin Peres martin.peres at linux.intel.com
Mon Jan 30 20:54:00 UTC 2017


---
 profiles.d/utils/auto-deploy.sh | 4 ++--
 profiles.d/utils/common.sh      | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/profiles.d/utils/auto-deploy.sh b/profiles.d/utils/auto-deploy.sh
index e41118a..12e364e 100644
--- a/profiles.d/utils/auto-deploy.sh
+++ b/profiles.d/utils/auto-deploy.sh
@@ -67,7 +67,7 @@ function auto_deploy_make_and_deploy() {
     local depl_version=$(profile_repo_deployed_version)
 
     # If we did not get the expected version, let's compile it
-    if [[ "$depl_version" != "$version" ]]; then
+    if ! are_same_versions "$version" "$depl_version"; then
         # Verify that the commit is not marked as broken
         local dep_version_dir=$(profile_repo_deployment_version_dir)
         local broken_commit_file="$dep_version_dir/ezbench_marked_broken"
@@ -107,7 +107,7 @@ function auto_deploy_make_and_deploy() {
                 # wanted one and, if not, say the deployment failed.
                 if [[ $compile_error -eq 0 ]]; then
                     local depl_version=$(profile_repo_deployed_version)
-                    if [[ "$depl_version" != "$version" ]]; then
+                    if ! are_same_versions "$version" "$depl_version"; then
                         local compile_error=72
 
                         # Mark the commit as broken, to avoid recompilations
diff --git a/profiles.d/utils/common.sh b/profiles.d/utils/common.sh
index 9d3db0b..affef8f 100644
--- a/profiles.d/utils/common.sh
+++ b/profiles.d/utils/common.sh
@@ -392,3 +392,10 @@ function opengl_version() {
     out=$(glxinfo 2> /dev/null | grep "OpenGL core profile version string:" | cut -d : -f 2 | cut -d ' ' -f 2-)
     [ -n "$out" ] && __opengl_clean_version__ "$out" && return 0
 }
+
+function are_same_versions {
+    local v1=$(profile_repo_version_from_human $1)
+    local v2=$(profile_repo_version_from_human $2)
+    [[ "$v1" == "$v2" ]]
+    return $?
+}
-- 
2.11.0



More information about the Ezbench-dev mailing list