[Kimchi-devel] [PATCH 3/4] Upgrade to Kimchi 2.0: change SPEC files to update objectstore content.

pvital at linux.vnet.ibm.com pvital at linux.vnet.ibm.com
Mon Oct 26 19:16:28 UTC 2015


From: Paulo Vital <pvital at linux.vnet.ibm.com>

Changed the spec file to execute the script to update the content of the
objectstore file after upgrade from Kimchi 1.5.1 (or previous versions) to
the new Wok and Kimchi 2.0 RPM's.

Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
 src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in | 9 +++++++++
 src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in   | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in b/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
index fbc59c4..e987856 100644
--- a/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
+++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.fedora.in
@@ -71,17 +71,26 @@ if [ $1 -eq 2 ]; then
     if [ -e %{_sharedstatedir}/kimchi/objectstore ] && [ $cur_version -lt 2 ]; then
         mkdir -p %{_tmppath}/kimchi
         cp %{_sharedstatedir}/kimchi/objectstore %{_tmppath}/kimchi/
+        touch %{_tmppath}/kimchi/need_update
     fi
 fi
 
+
 %install
 rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
 
+# Install update_objectstore.py to execute update to Kimchi/Wok version 2.0.0
+install -Dm 0744 contrib/update_objectstore.py %{buildroot}%{_datadir}/wok/plugins/kimchi/utils/update_objectstore.py
+
+
 %posttrans
 # Copy backup'ed objectstore file to correct place.
 if [ -e %{_tmppath}/kimchi/objectstore ]; then
     cp %{_tmppath}/kimchi/objectstore %{_sharedstatedir}/kimchi/
+    if [ -e %{_tmppath}/kimchi/need_update ]; then
+        python %{_datadir}/wok/plugins/kimchi/utils/update_objectstore.py
+    fi
     rm -rf %{_tmppath}/kimchi
 fi
 
diff --git a/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in b/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
index 5346c17..571cb1f 100644
--- a/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
+++ b/src/wok/plugins/kimchi/contrib/kimchi.spec.suse.in
@@ -59,6 +59,7 @@ if [ $1 -eq 2 ]; then
     if [ -e %{_var}/lib/kimchi/objectstore ] && [ $cur_version -lt 2 ]; then
         mkdir -p %{_tmppath}/kimchi
         cp %{_var}/lib/kimchi/objectstore %{_tmppath}/kimchi/
+        touch %{_tmppath}/kimchi/need_update
     fi
 fi
 
@@ -66,10 +67,16 @@ fi
 rm -rf %{buildroot}
 make DESTDIR=%{buildroot} install
 
+# Install update_objectstore.py to execute update to Kimchi/Wok version 2.0.0
+install -Dm 0744 contrib/update_objectstore.py %{buildroot}%{_datadir}/wok/plugins/kimchi/utils/update_objectstore.py
+
 %posttrans
 # Copy backup'ed objectstore file to correct place.
 if [ -e %{_tmppath}/kimchi/objectstore ]; then
     cp %{_tmppath}/kimchi/objectstore %{_var}/lib/kimchi/
+    if [ -e %{_tmppath}/kimchi/need_update ]; then
+        python %{_datadir}/wok/plugins/kimchi/utils/update_objectstore.py
+    fi
     rm -rf %{_tmppath}/kimchi
 fi
 
-- 
2.4.3




More information about the Kimchi-devel mailing list