[Erp5-report] r28907 - /experimental/erp5.buildout/recipes/create_erp5_instance.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 10 18:08:56 CEST 2009


Author: kazuhiko
Date: Thu Sep 10 18:08:54 2009
New Revision: 28907

URL: http://svn.erp5.org?rev=28907&view=rev
Log:
do not force-install all business templates, but install or update only required ones.

Modified:
    experimental/erp5.buildout/recipes/create_erp5_instance.py

Modified: experimental/erp5.buildout/recipes/create_erp5_instance.py
URL: http://svn.erp5.org/experimental/erp5.buildout/recipes/create_erp5_instance.py?rev=28907&r1=28906&r2=28907&view=diff
==============================================================================
--- experimental/erp5.buildout/recipes/create_erp5_instance.py [utf8] (original)
+++ experimental/erp5.buildout/recipes/create_erp5_instance.py [utf8] Thu Sep 10 18:08:54 2009
@@ -66,9 +66,9 @@
 
 newSecurityManager(None, user.__of__(app.acl_users))
 
-print 'Adding ERP5 site %s' % options.portal_id
 portal = getattr(app, options.portal_id, None)
 if portal is None:
+  print 'Adding ERP5 site %s' % options.portal_id
   app.manage_addProduct['ERP5'].manage_addERP5Site(
               id=options.portal_id,
               erp5_sql_connection_string=options.erp5_sql_connection_string,
@@ -95,7 +95,20 @@
 bt5_list = []
 for arg in args:
   bt_path = os.path.join(options.bt5_path, arg)
-  print 'Installing bt %s' % bt_path
+  installed_bt = portal.portal_templates.getInstalledBusinessTemplate(arg)
+  if installed_bt is not None:
+    # XXX this way works only for extracted business template, not for
+    # *.bt5 packed business template.
+    version = file('%s/bt/version' % bt_path).read().strip()
+    revision = file('%s/bt/revision' % bt_path).read().strip()
+    if version == installed_bt.getVersion() and \
+       revision == installed_bt.getRevision():
+      print 'Skipping bt %s' % bt_path
+      continue
+    else:
+      print 'Updating bt %s' % bt_path
+  else:
+    print 'Installing bt %s' % bt_path
   bt = portal.portal_templates.download(bt_path)
   bt.install(force=True)
   transaction.commit()




More information about the Erp5-report mailing list