Project

General

Profile

Tâche #11097

Scénario #11062: Publier la mise à jour 2.3.16 Stable

Zephir 2.3.16 : Intégrer les modifications en cours sur l'upgrade des modules écologie.

Added by Bruno Boiget about 6 years ago. Updated almost 6 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Target version:
Start date:
03/30/2015
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Remaining (hours):
0.0

Description

Des adaptations sont encore en cours sur upgrade.py de creole 2.3 pour l'upgrade des modules essl/esbl/...

A intégrer dans la librairie 'creole3' de Zéphir quand ils seront prêts.

Attention, la branche 2.4.1 de creole ne comprend pas certaines adaptations faites pour Zéphir (seulement dans master). Il faudra soit les intégrer dans la branche 2.4.1 (préférable pour la maintenance), soit les ajouter 'à la main' au niveau du dossier 'creole3' de creole 2.3.

Pour référence (git diff 20f78312..a7d79e19) :

diff --git a/creole/loader.py b/creole/loader.py
index 31c43e4..2c182c4 100644
--- a/creole/loader.py
+++ b/creole/loader.py
@@ -5,6 +5,7 @@ import fcntl

 from os.path import isdir, isfile, join, basename, dirname
 from os import listdir, makedirs
+from distutils.version import StrictVersion
 try:
     from collections import OrderedDict
 except:
@@ -225,13 +226,33 @@ def load_extras(config, load_values=True):
         if isfile(eol_file):
             config_load_values(config, extraname)

-
-def load_config_eol(config, configfile=None, try_upgrade=True, force_load_owner=None):
+def load_config_eol(config, configfile=None, try_upgrade=True, force_load_owner=None, current_eol_version=None):
     if not configfile:
         configfile = _gen_eol_file('creole')
     config.impl_set_information('creole', configfile)
     config_load_values(config, 'creole', force_load_owner=force_load_owner)
-    remove_unknown_vars = False
+    load_values(config,
+                configfile=configfile,
+                try_upgrade=try_upgrade,
+                force_load_owner=force_load_owner,
+                current_eol_version=current_eol_version)
+
+def load_config_store(config, store, unset_default=False,
+                      force_load_owner=None, current_eol_version=None,
+                      force_instanciate=None, remove_unknown_vars=False):
+    """used on Zéphir to upgrade values (2.4.X -> 2.4.X+1) on a configuration
+       that has already been migrated (2.2/2.3 −> 2.4)
+    """ 
+    config_load_store(config, 'creole', store, force_load_owner=force_load_owner,
+                      unset_default=unset_default, force_instanciate=force_instanciate)
+    load_values(config,
+                try_upgrade=False,
+                force_load_owner=force_load_owner,
+                current_eol_version=current_eol_version,
+                remove_unknown_vars=remove_unknown_vars)
+
+def load_values(config, configfile=None, try_upgrade=True, force_load_owner=None,
+                current_eol_version=None, remove_unknown_vars=False):
     if config.impl_get_information('load_error', False) and try_upgrade:
         #Try to upgrade
         from creole.upgrade import upgrade
@@ -243,21 +264,23 @@ def load_config_eol(config, configfile=None, try_upgrade=True, force_load_owner=
         except Exception, e:
             config.impl_set_information('load_error', True)
             #print "fichier de configuration invalide 2.2 ou 2.3: {0} : {1}".format(configfile, e)
-    from distutils.version import StrictVersion
-    current_eol_version = get_version('EOLE_RELEASE')
+    if current_eol_version == None:
+        current_eol_version = get_version('EOLE_RELEASE')
     eol_version = str(config.impl_get_information('eol_version'))

-    if StrictVersion(eol_version) < StrictVersion('2.4.1'):
-        try:
-            from creole.upgrade24 import upgrade240_241
-            upgrade240_241(config)
-            if config.impl_get_information('upgrade', '') == '':
-                #set the version only if it is the first upgrade
-                config.impl_set_information('upgrade', eol_version)
-        except Exception, e:
-            config.impl_set_information('load_error', True)
-    elif StrictVersion(eol_version) > StrictVersion(current_eol_version):
-        raise Exception(_('eol_version ({0}) is greater than current version ({1})').format(eol_version, current_eol_version))
+    if StrictVersion(current_eol_version) >= StrictVersion('2.4.0'):
+        #can be used to edit lower versions on Zéphir
+        if StrictVersion(eol_version) < StrictVersion('2.4.1'):
+            try:
+                from creole.upgrade24 import upgrade240_241
+                upgrade240_241(config)
+                if config.impl_get_information('upgrade', '') == '':
+                    #set the version only if it is the first upgrade
+                    config.impl_set_information('upgrade', eol_version)
+            except Exception, e:
+                config.impl_set_information('load_error', True)
+        elif StrictVersion(eol_version) > StrictVersion(current_eol_version):
+            raise Exception(_('eol_version ({0}) is greater than current version ({1})').format(eol_version, current_eol_version))

     if remove_unknown_vars:
         # nettoyage des variables inconnues en dernier (#9858)
@@ -546,7 +569,7 @@ def config_get_values(config, namespace, check_mandatory=True, ignore_autofreeze
     store.update(config.impl_get_information('unknown_options', {}))
     return store

-def config_save_values(config, namespace, reload_config=True, eol_file=None, check_mandatory=True):
+def config_save_values(config, namespace, reload_config=True, eol_file=None, check_mandatory=True, eol_version=None):
     subconfig = getattr(config, namespace)
     if eol_file is not None:
         config.impl_set_information(namespace, eol_file)
@@ -555,7 +578,12 @@ def config_save_values(config, namespace, reload_config=True, eol_file=None, che
     except AttributeError:
         raise Exception(_(u'config must have eol_file attribute'))
     store = config_get_values(config, namespace, check_mandatory)
-    store['___version___'] = get_version('EOLE_RELEASE')
+    # on stocke la version passée en paramètre (si >= 2.4.1) ou celle du système le cas échéant
+    if eol_version:
+        if StrictVersion(eol_version) >= StrictVersion('2.4.1'):
+            store['___version___'] = eol_version
+    else:
+        store['___version___'] = get_version('EOLE_RELEASE')
     try:
         dirn = dirname(eol_file)
         if not isdir(dirn):

Related issues

Related to creole - Tâche #10866: Intégrer les dernières modifications à Zéphir 2.3 (migration esbl / noms réels des conteneurs) Reporté 03/09/2015

Associated revisions

Revision 70dd8d76 (diff)
Added by Bruno Boiget about 6 years ago

zephir-creole3 : Modifications sur ugprade.py pour les modules écologie

ref #11097 @45m

History

#1 Updated by Bruno Boiget about 6 years ago

  • Description updated (diff)

#2 Updated by Bruno Boiget about 6 years ago

  • Description updated (diff)

#3 Updated by Bruno Boiget about 6 years ago

  • Assigned To changed from force violette to Bruno Boiget

#4 Updated by Joël Cuissinat about 6 years ago

  • Status changed from Nouveau to En cours

#5 Updated by Scrum Master almost 6 years ago

  • Status changed from En cours to Résolu

#6 Updated by Bruno Boiget almost 6 years ago

  • % Done changed from 0 to 100
  • Remaining (hours) changed from 2.0 to 0.25

Les modifications ont été intégrées dans le dernier paquet stable.

#7 Updated by Fabrice Barconnière almost 6 years ago

  • Status changed from Résolu to Fermé
  • Remaining (hours) changed from 0.25 to 0.0

Also available in: Atom PDF