]> SALOME platform Git repositories - tools/sat.git/commitdiff
Salome HOME
sat #17359 bug fix : take into account incremental mode in sat package
authorcrouzet <nicolas.crouzet@cea.fr>
Mon, 9 Sep 2019 13:44:48 +0000 (15:44 +0200)
committercrouzet <nicolas.crouzet@cea.fr>
Mon, 9 Sep 2019 13:44:48 +0000 (15:44 +0200)
commands/package.py
src/product.py

index 707bbab5fc5db4c4046b19f08b37e3de2e491909..1e3ca2d35b389fd8cabf5a7e03c69e5b2559a9a3 100644 (file)
@@ -1044,22 +1044,18 @@ def find_product_scripts_and_pyconf(p_name,
     '''
     
     # read the pyconf of the product
-    product_pyconf_path = src.find_file_in_lpath(p_name + ".pyconf",
-                                           config.PATHS.PRODUCTPATH)
-    product_pyconf_cfg = src.pyconf.Config(product_pyconf_path)
+    product_pyconf_cfg = src.pyconf.Config(p_info.from_file)
 
     # find the compilation script if any
     if src.product.product_has_script(p_info):
         compil_script_path = src.Path(p_info.compil_script)
         compil_script_path.copy(compil_scripts_tmp_dir)
-        product_pyconf_cfg[p_info.section].compil_script = os.path.basename(
-                                                    p_info.compil_script)
+
     # find the environment script if any
     if src.product.product_has_env_script(p_info):
         env_script_path = src.Path(p_info.environ.env_script)
         env_script_path.copy(env_scripts_tmp_dir)
-        product_pyconf_cfg[p_info.section].environ.env_script = os.path.basename(
-                                                p_info.environ.env_script)
+
     # find the patches if any
     if src.product.product_has_patches(p_info):
         patches = src.pyconf.Sequence()
@@ -1068,25 +1064,26 @@ def find_product_scripts_and_pyconf(p_name,
             p_path.copy(patches_tmp_dir)
             patches.append(os.path.basename(patch_path), "")
 
-        product_pyconf_cfg[p_info.section].patches = patches
-    
-    if with_vcs:
-        # put in the pyconf file the resolved values
-        for info in ["git_info", "cvs_info", "svn_info"]:
-            if info in p_info:
-                for key in p_info[info]:
-                    product_pyconf_cfg[p_info.section][info][key] = p_info[
-                                                                      info][key]
-    else:
-        # if the product is not archive, then make it become archive.
-        if src.product.product_is_vcs(p_info):
-            product_pyconf_cfg[p_info.section].get_source = "archive"
-            if not "archive_info" in product_pyconf_cfg[p_info.section]:
-                product_pyconf_cfg[p_info.section].addMapping("archive_info",
+    if (not with_vcs) and src.product.product_is_vcs(p_info):
+        # in non vcs mode, if the product is not archive, then make it become archive.
+
+        # depending upon the incremental mode, select impacted sections
+        if "properties" in p_info and "incremental" in p_info.properties and\
+            p_info.properties.incremental == "yes":
+            sections = ["default", "default_win", p_info.section, p_info.section+"_win"]
+        else:
+            sections = [p_info.section]
+        for section in sections:
+            if section in product_pyconf_cfg and "get_source" in product_pyconf_cfg[section]:
+                DBG.write("sat package set archive mode to archive for product %s and section %s" %\
+                          (p_name,section))
+                product_pyconf_cfg[section].get_source = "archive"
+                if not "archive_info" in product_pyconf_cfg[section]:
+                    product_pyconf_cfg[section].addMapping("archive_info",
                                         src.pyconf.Mapping(product_pyconf_cfg),
                                         "")
-            product_pyconf_cfg[p_info.section
-                              ].archive_info.archive_name = p_info.name + ".tgz"
+                    product_pyconf_cfg[section].archive_info.archive_name =\
+                        p_info.name + ".tgz"
     
     # write the pyconf file to the temporary project location
     product_tmp_pyconf_path = os.path.join(products_pyconf_tmp_dir,
index 4d08c79dc6db1389b6b496dbde5fdd4661d05f6f..48baea2c9506c2e18085e61f1c41cfc78f7a6e57 100644 (file)
@@ -370,7 +370,7 @@ Please provide a 'compil_script' key in its definition.""") % product_name
                 
     return prod_info
 
-def get_product_section(config, product_name, version, section=None, verbose=False):
+def get_product_section(config, product_name, version, section=None):
     """Build the product description from the configuration
     
     :param config Config: The global configuration
@@ -396,7 +396,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
         # in this (historic) mode the definition of the product is given by a full unique section
         is_incr=False
     if is_incr:
-        DBG.write("Incremental definition mode activated for %s" % (product_name), "", verbose)
+        DBG.write("Incremental definition mode activated for", product_name)
 
     # decode version number
     try:
@@ -404,7 +404,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
     except: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
       versionMMP = None
     DBG.write("get_product_section for product %s '%s' as version '%s'" % (product_name, version, versionMMP),
-              (section, aProd.keys()), verbose)
+              (section, aProd.keys()))
 
     # if a section is explicitely specified we select it
     if section:
@@ -418,7 +418,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
     # If it exists, get the information of the product_version
     # ex: 'version_V6_6_0' as salome version classical syntax
     elif "version_" + version in aProd:
-        DBG.write("found section for version_" + version, "", verbose)
+        DBG.write("found section for version_" + version)
         # returns specific information for the given version
         pi = aProd["version_" + version]
         pi.section = "version_" + version
@@ -433,7 +433,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
           # DBG.write("name", name,True)
           aRange = VMMP.getRange_majorMinorPatch(name)
           if aRange is not None:
-            DBG.write("found version range for section '%s'" % name, aRange, verbose)
+            DBG.write("found version range for section '%s'" % name, aRange)
             l_section_ranges.append((name, aRange))
 
         if versionMMP is not None and len(l_section_ranges) > 0:
@@ -443,11 +443,11 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
 
         if len(tagged) > 1:
           DBG.write("multiple version ranges tagged for '%s', fix it" % version,
-                         PP.pformat(tagged), True)
+                         PP.pformat(tagged))
           pi=None
         elif len(tagged) == 1: # ok
           DBG.write("one version range tagged for '%s'" % version,
-                       PP.pformat(tagged), verbose)
+                       PP.pformat(tagged))
           name, (vmin, vmax) = tagged[0]
           pi = aProd[name]
           pi.section = name
@@ -457,7 +457,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
         elif "default" in aProd:
             # returns the generic information (given version not found)
             pi = aProd.default
-            DBG.write("default tagged for '%s'" % version, pi, verbose)
+            DBG.write("default tagged for '%s'" % version, pi)
             pi.section = "default"
             pi.from_file = aProd.from_file
         else:
@@ -483,6 +483,7 @@ def get_product_section(config, product_name, version, section=None, verbose=Fal
             if src.architecture.is_windows() and win_section in aProd:
                 for key in aProd[win_section]:
                     prod_info[key]=aProd[win_section][key]
+        DBG.write("Incremental definition, return product info :", prod_info)
     else:
         prod_info=pi