Quick fix of database migration 98/36798/1
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 13 Mar 2015 14:12:05 +0000 (15:12 +0100)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 13 Mar 2015 14:12:05 +0000 (15:12 +0100)
During upgrade of downgrade of cynara package "from version"
is always set to 0.0.0 and is ignored in migration tool.

Migration tool always tries to do generate or remove checksum files
whichever is needed due to NEW_VERSION. OLD_VERSION is ignored
during database migration.

Change-Id: I1141c7c6f15f3a11bd740330995a5bf1bae45db0

migration/cynara-db-migration
packaging/cynara.spec

index d31897c..ff9bd61 100644 (file)
@@ -208,20 +208,24 @@ migrate_db() {
         exit_success
     fi
 
-    case $(version_compare ${OLD_VERSION} ${NEW_VERSION}) in
-        -1 )
-            upgrade_db
-            ;;
-        0 )
-            :
-            # Same version given twice; take no action
-            ;;
-        1 )
-            downgrade_db
-            ;;
-        * )
-            failure
-    esac
+#quick fix - always generate or remove checksums if needed
+    upgrade_db
+    downgrade_db
+
+#    case $(version_compare ${OLD_VERSION} ${NEW_VERSION}) in
+#        -1 )
+#            upgrade_db
+#            ;;
+#        0 )
+#            :
+#            # Same version given twice; take no action
+#            ;;
+#        1 )
+#            downgrade_db
+#            ;;
+#        * )
+#            failure
+#    esac
 }
 
 remove_db() {
index 1e9643e..778e718 100644 (file)
@@ -233,23 +233,7 @@ fi
 
 if [ $1 -gt 1 ] ; then
     # upgrade
-    OLD_VERSION=""
-    VERSION_INDICATOR="$(ls %{_libdir}/libcynara-commons\.so\.*\.*\.*)"
-    if [ -z "${VERSION_INDICATOR}" ] ; then
-        # For releases which dropped "%{_libdir}/libcynara-commons\.so\.*" file
-        OLD_VERSION="$(/usr/bin/cynara --version)"
-    else
-        VERSION="${VERSION_INDICATOR##*so\.}"
-        SIGNIFICANT="${VERSION%\.*}"
-        if [ 0 -eq "${SIGNIFICANT%%\.*}" -a 5 -ge "${SIGNIFICANT##*\.}" ] ; then
-            # For releases which did not provide "--version" functionality
-            OLD_VERSION="${VERSION}"
-        else
-            OLD_VERSION="$(/usr/bin/cynara --version)"
-        fi
-    fi
-
-    %{_sbindir}/cynara-db-migration upgrade -f ${OLD_VERSION} -t %{version}
+    %{_sbindir}/cynara-db-migration upgrade -f 0.0.0 -t %{version}
 else
     # install
     %{_sbindir}/cynara-db-migration install -t %{version}