
This patch set only covers the scenario when user is installing/upgrading Kimchi from a package. We also need to think about users whom installed Kimchi using make-install or even those running locally. So to cover all installation types, I suggest to make a solution outside SPEC files / build process. As I suggested before, we can add a tag "version" to the objectstore which reflects the Kimchi version. On server starts up, we verify the version and do the update if needed. That way we make sure the user will get the update objectstore independent on how he/she has installed it before. What do you think about it? Regards, Aline Manera On 26/10/2015 17:16, pvital@linux.vnet.ibm.com wrote:
From: Paulo Vital <pvital@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@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