From 25224caead78635abfdaad4c4f6af113071b85f9 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 7 Feb 2011 08:48:50 +0000
Subject: [PATCH] 2011-02-07 Kazuhiko * remove set and upgrade product_path,
 that should be handled by instance creation in buildout.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43115 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../ERP5UpgraderCompatibility.py              | 55 -----------
 .../ERP5UpgraderUtils.py                      | 21 ----
 .../ERP5Site_beforeUpgradeProductPath.xml     | 72 --------------
 .../erp5_upgrader/ERP5Site_setProductPath.xml | 28 ------
 .../ERP5Site_upgradeProductPath.xml           | 96 -------------------
 .../ERP5Site_verifyProductPathUpgrade.xml     | 28 ------
 .../ERP5Site_verifyUpgradeIntegrity.xml       |  2 -
 bt5/erp5_upgrader/bt/change_log               |  6 ++
 bt5/erp5_upgrader/bt/revision                 |  2 +-
 9 files changed, 7 insertions(+), 303 deletions(-)
 delete mode 100644 bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_beforeUpgradeProductPath.xml
 delete mode 100644 bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_setProductPath.xml
 delete mode 100644 bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeProductPath.xml
 delete mode 100644 bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyProductPathUpgrade.xml

diff --git a/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderCompatibility.py b/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderCompatibility.py
index 38c91da7b4..1bf9676a62 100644
--- a/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderCompatibility.py
+++ b/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderCompatibility.py
@@ -119,58 +119,3 @@ def _getZopeConfigurationFile(relative_path="", mode="r"):
     raise IOError, 'The file: %s does not exist.' % file_path
 
   return open(file_path, mode)
-
-# XXX This method is a copy and paste of IntrospectionTool.setProductPath
-# This should be kept until versions lower than 5.4.3 still supported. 
-def setProductPath(self, relative_path):
-  """
-    Set the value of SOFTWARE_HOME for zopectl startup script
-    or from zope.conf (whichever is most relevant)
-
-    Rationale: multiple versions of Products can be present
-    on the same system
-
-    relative_path is usually defined by a number of release 
-     (ex. 5.4.2)
-
-    WARNING: the list of possible path should be protected 
-    if possible (ex. /etc/erp5/product)
-  """
-  # XXX Local to remove "self"
-  config = _loadExternalConfig()
-  allowed_path_list = config.get("main", "products").split("\n")
-  base_product_path_list = config.get("base", "base_product_path").split("\n")
-  if len(base_product_path_list) == 0:
-    raise Unauthorized(
-             "base_product_path_list is not defined into configuration.")
-
-  base_product_path = base_product_path_list[0]
-  path = base_product_path + relative_path
-
-  if path not in allowed_path_list:
-    raise Unauthorized(
-               "You are setting one Unauthorized path as Product Path (%s)." \
-                        % (path))
-
-  # XXX Local to remove "self"
-  config_file = _getZopeConfigurationFile("etc/zope.conf")
-  new_file_list = []
-  ignore_list = ['parts/cmf15', "parts/products-deps" , "parts/products-other"]
-  for line in config_file:
-    new_line = line
-    #if line.strip(" ").startswith("products %s" % (base_product_path)):
-    if line.strip(" ").startswith("products"):
-      # Only comment the line, so it can easily reverted 
-      if len([i for i in ignore_list if i in line]) == 0:
-        new_line = "#%s" % (line)
-    new_file_list.append(new_line)
-  new_file_list.append("products %s\n" % (path))
-  config_file.close()    
-
-  # reopen file for write
-  # XXX Local to remove "self"
-  config_file = _getZopeConfigurationFile("etc/zope.conf", "w")
-  config_file.write("".join(new_file_list))
-  config_file.close()
-  return 
-
diff --git a/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderUtils.py b/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderUtils.py
index b5ab93ea27..f5b6ae5665 100644
--- a/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderUtils.py
+++ b/bt5/erp5_upgrader/ExtensionTemplateItem/ERP5UpgraderUtils.py
@@ -47,27 +47,6 @@ def ERP5Site_editERP5SiteProperty(self, prop, value):
   method(prop, value)
   return True
 
-def ERP5Site_verifyProductPathUpgrade(self):
-  """
-    Due activities concurrency, it is needed that the upgrade process
-    only proceed after restart be sucessfully done. 
-
-    This script make sure that the process will wait for the
-    Prodcuts be upgraded to proceed.
-
-    This method is not elegant solution but it is essential part 
-    between restart zope and update Activities.
-  """
-  # check if the products are already updated.
-  if len(self.ERP5Site_upgradeProductPath()) > 0:
-    # Wait at least 20 seconds before try again
-    # This will prevent the activities be invoked
-    # too early.
-    sleep(20)
-    # Force failure for restart the activity
-    raise 
-  return
-
 def ERP5Site_restartZopeInstance(self):
   """
     Zope must be restart after update the Products or Software
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_beforeUpgradeProductPath.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_beforeUpgradeProductPath.xml
deleted file mode 100644
index 67dc937807..0000000000
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_beforeUpgradeProductPath.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string># Update activity tables before upgrade upgrade products.\n
-# XXX The followed scripts could be even more generic.\n
-\n
-column_list = [i[0] for i in context.portal_activities.ActivityTool_showMessageQueueTableColumns()]\n
-if \'group_method_id\' not in column_list:\n
-  context.portal_activities.ActivityTool_upgradeMessageQueueTable()\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string></string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>ERP5Site_beforeUpgradeProductPath</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_setProductPath.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_setProductPath.xml
deleted file mode 100644
index d1f01715cb..0000000000
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_setProductPath.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_function</string> </key>
-            <value> <string>setProductPath</string> </value>
-        </item>
-        <item>
-            <key> <string>_module</string> </key>
-            <value> <string>ERP5UpgraderCompatibility</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>ERP5Site_setProductPath</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string>Method not present after 5.4.3 into portal Introspections</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeProductPath.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeProductPath.xml
deleted file mode 100644
index d41b9bcc2c..0000000000
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_upgradeProductPath.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>Script_magic</string> </key>
-            <value> <int>3</int> </value>
-        </item>
-        <item>
-            <key> <string>_bind_names</string> </key>
-            <value>
-              <object>
-                <klass>
-                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
-                </klass>
-                <tuple/>
-                <state>
-                  <dictionary>
-                    <item>
-                        <key> <string>_asgns</string> </key>
-                        <value>
-                          <dictionary>
-                            <item>
-                                <key> <string>name_container</string> </key>
-                                <value> <string>container</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_context</string> </key>
-                                <value> <string>context</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_m_self</string> </key>
-                                <value> <string>script</string> </value>
-                            </item>
-                            <item>
-                                <key> <string>name_subpath</string> </key>
-                                <value> <string>traverse_subpath</string> </value>
-                            </item>
-                          </dictionary>
-                        </value>
-                    </item>
-                  </dictionary>
-                </state>
-              </object>
-            </value>
-        </item>
-        <item>
-            <key> <string>_body</string> </key>
-            <value> <string>"""\n
-  Update Product Path in zope.conf\n
-\n
-  ERP5Site_getSystemSignatureDict and ERP5Site_setProductPath are \n
-  used to keep backward compatibility with newer implementations.\n
-"""\n
-\n
-signature = context.ERP5Site_getUpgraderSignature()\n
-try:\n
-  product_version = context.portal_introspections.getSystemSignatureDict()[\'erp5\']\n
-except:\n
-  # Try to use externals instead because portal_introspections is not available.\n
-  product_version = context.ERP5Site_getSystemSignatureDict()[\'erp5\']\n
-\n
-if product_version == signature["release"]:\n
-  return []\n
-\n
-if not upgrade:\n
-  return ["Upgrade required for Products. Current: %s , Expect %s" % (\n
-            product_version, signature["release"]) ]\n
-\n
-context.ERP5Site_beforeUpgradeProductPath()\n
-\n
-try:\n
-  context.portal_introspections.setProductPath(signature["release"])\n
-except:\n
-  # Try to use externals instead because portal_introspections is not available.\n
-  context.ERP5Site_setProductPath(signature["release"])\n
-\n
-return ["Upgraded Product Path List to %s" % (signature["release"])]\n
-</string> </value>
-        </item>
-        <item>
-            <key> <string>_params</string> </key>
-            <value> <string>upgrade=0</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>ERP5Site_upgradeProductPath</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyProductPathUpgrade.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyProductPathUpgrade.xml
deleted file mode 100644
index 27b192c332..0000000000
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyProductPathUpgrade.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_function</string> </key>
-            <value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
-        </item>
-        <item>
-            <key> <string>_module</string> </key>
-            <value> <string>ERP5UpgraderUtils</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string></string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyUpgradeIntegrity.xml b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyUpgradeIntegrity.xml
index 0d09ce0b68..30dd88b8c1 100644
--- a/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyUpgradeIntegrity.xml
+++ b/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/ERP5Site_verifyUpgradeIntegrity.xml
@@ -63,8 +63,6 @@ message_list.extend(context.ERP5Site_upgradePythonExecutable())\n
 \n
 message_list.extend(context.ERP5Site_upgradeSoftwareHome())\n
 \n
-message_list.extend(context.ERP5Site_upgradeProductPath())\n
-\n
 message_list.extend(context.ERP5Site_upgradeBusinessTemplateList())\n
 \n
 message_list.extend(context.ERP5Site_upgradeGlobalPropertyList())\n
diff --git a/bt5/erp5_upgrader/bt/change_log b/bt5/erp5_upgrader/bt/change_log
index 2450a003d2..c637163af2 100644
--- a/bt5/erp5_upgrader/bt/change_log
+++ b/bt5/erp5_upgrader/bt/change_log
@@ -1,3 +1,9 @@
+2011-02-07 Kazuhiko
+* remove set and upgrade product_path, that should be handled by instance creation in buildout.
+
+2011-02-04 Kazuhiko
+* remove system_upgrader and product_upgrader, that should be handled by instance creation in buildout.
+
 2010-09-30 lucas
 * Added message to be logged if during the upgrade of the Local Roles for security groups the Portal Type document does not exists.
 
diff --git a/bt5/erp5_upgrader/bt/revision b/bt5/erp5_upgrader/bt/revision
index 51f1d23291..2bf5aee89b 100644
--- a/bt5/erp5_upgrader/bt/revision
+++ b/bt5/erp5_upgrader/bt/revision
@@ -1 +1 @@
-566
\ No newline at end of file
+567
\ No newline at end of file
-- 
2.30.9