X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=commands%2Fpackage.py;h=bbb20bed7f62b1bbd22c5b62f9d4f5d9deb14ee2;hb=512d8e507e03381f229b389baceef8a9e6afda9f;hp=f23290da26977b6fed2397c504481ce2de3a057d;hpb=54d88a65a3735ff7820a68667575aa1fba120d94;p=tools%2Fsat.git diff --git a/commands/package.py b/commands/package.py index f23290d..bbb20be 100644 --- a/commands/package.py +++ b/commands/package.py @@ -46,7 +46,8 @@ IGNORED_EXTENSIONS = [] PACKAGE_EXT=".tar.gz" # the extension we use for the packages -PROJECT_TEMPLATE = """#!/usr/bin/env python +if src.architecture.is_windows(): + PROJECT_TEMPLATE = """#!/usr/bin/env python #-*- coding:utf-8 -*- # The path to the archive root directory @@ -65,6 +66,25 @@ JOBPATH : $project_path + "jobs/" # Where to search the pyconf of the machines of the project MACHINEPATH : $project_path + "machines/" """ +else: + PROJECT_TEMPLATE = """#!/usr/bin/env python +#-*- coding:utf-8 -*- + +# path to the PROJECT +project_path : $PWD + "/" + +# Where to search the archives of the products +ARCHIVEPATH : $project_path + "ARCHIVES" +# Where to search the pyconf of the applications +APPLICATIONPATH : $project_path + "applications/" +# Where to search the pyconf of the products +PRODUCTPATH : $project_path + "products/" +# Where to search the pyconf of the jobs of the project +JOBPATH : $project_path + "jobs/" +# Where to search the pyconf of the machines of the project +MACHINEPATH : $project_path + "machines/" +""" + LOCAL_TEMPLATE = ("""#!/usr/bin/env python #-*- coding:utf-8 -*- @@ -81,8 +101,9 @@ LOCAL_TEMPLATE = ("""#!/usr/bin/env python PROJECTS : { -project_file_paths : [$VARS.salometoolsway + $VARS.sep + \"..\" + $VARS.sep""" -""" + \"""" + PROJECT_DIR + """\" + $VARS.sep + "project.pyconf"] + project_file_paths : + [ + ] } """) @@ -100,7 +121,8 @@ parser.add_option('', 'bin_products', 'boolean', 'bin_products', _('Optional: Create binary archives for all products.'), False) parser.add_option('', 'with_vcs', 'boolean', 'with_vcs', _('Optional: Do not make archive for products in VCS mode (git, cvs, svn). ' - 'Sat prepare will use VCS mode instead to retrieve them'), + 'Sat prepare will use VCS mode instead to retrieve them.' + '\n Also, when combined with "--bin_products" option, restrict the building of product archives to VCS products.'), False) parser.add_option('', 'ftp', 'boolean', 'ftp', _('Optional: Do not embed archives for products in archive mode.' @@ -280,6 +302,8 @@ def produce_relative_launcher(config, additional_env['sat_python_version'] = 2 additional_env['ABSOLUTE_APPLI_PATH'] = "out_dir_Path" + config.VARS.sep + app_root_dir + launcher_name = src.get_launcher_name(config) + additional_env['APPLI'] = "out_dir_Path" + config.VARS.sep + file_name # create an environment file writer writer = src.environment.FileEnvWriter(config, @@ -568,7 +592,7 @@ def product_appli_creation_script(config, return tmp_file_path -def bin_products_archives(config, logger): +def bin_products_archives(config, logger, only_vcs): '''Prepare binary packages for all products :param config Config: The global configuration. :return: the error status @@ -593,6 +617,8 @@ def bin_products_archives(config, logger): or src.product.product_is_fixed(prod_info) or not src.product.product_compiles(prod_info)): continue + if only_vcs and not src.product.product_is_vcs(prod_info): + continue if not src.product.check_installation(config, prod_info): l_not_installed.append(prod_name) continue # product is not installed, we skip it @@ -768,6 +794,14 @@ WARNING: existing binaries directory from previous detar installation: path_in_archive = os.path.join("SOURCES", prod_name) d_products[prod_name + " (sources)"] = (source_dir, path_in_archive) + # create an archives of compilation logs, and insert it into the tarball + logpath=os.path.join(config.APPLICATION.workdir, "LOGS") + path_targz_logs = os.path.join(tmp_working_dir, "logs.tgz") + tar_log = tarfile.open(path_targz_logs, mode='w:gz') + tar_log.add(logpath, arcname="LOGS") + tar_log.close() + d_products["LOGS"] = (path_targz_logs, "logs.tgz") + # for packages of SALOME applications including KERNEL, # we produce a salome launcher or a virtual application (depending on salome version) if 'KERNEL' in config.APPLICATION.products: @@ -813,7 +847,13 @@ WARNING: existing binaries directory from previous detar installation: if options.sources: # if we mix binaries and sources, we add a copy of the launcher, # prefixed with "bin",in order to avoid clashes - d_products["launcher (copy)"] = (launcher_package, "bin"+launcher_name) + launcher_copy_name="bin"+launcher_name + launcher_package_copy = produce_relative_launcher(config, + logger, + tmp_working_dir, + launcher_copy_name, + binaries_dir_name) + d_products["launcher (copy)"] = (launcher_package_copy, launcher_copy_name) else: # Provide a script for the creation of an application EDF style appli_script = product_appli_creation_script(config, @@ -899,23 +939,26 @@ def source_package(sat, config, logger, options, tmp_working_dir): # Add salomeTools tmp_sat = add_salomeTools(config, tmp_working_dir) - d_sat = {"salomeTools" : (tmp_sat, "salomeTools")} + d_sat = {"salomeTools" : (tmp_sat, "sat")} # Add a sat symbolic link if not win if not src.architecture.is_windows(): - tmp_satlink_path = os.path.join(tmp_working_dir, 'sat') try: t = os.getcwd() except: # In the jobs, os.getcwd() can fail t = config.LOCAL.workdir os.chdir(tmp_working_dir) - if os.path.lexists(tmp_satlink_path): - os.remove(tmp_satlink_path) - os.symlink(os.path.join('salomeTools', 'sat'), 'sat') + + # create a symlink, to avoid reference with "salomeTool/.." + os.chdir("PROJECT") + if os.path.lexists("ARCHIVES"): + os.remove("ARCHIVES") + os.symlink("../ARCHIVES", "ARCHIVES") os.chdir(t) - d_sat["sat link"] = (tmp_satlink_path, "sat") + d_sat["sat archive link"] = (os.path.join(tmp_working_dir,"PROJECT", "ARCHIVES"), + os.path.join("PROJECT", "ARCHIVES")) d_source = src.merge_dicts(d_archives, d_archives_vcs, d_project, d_sat) return d_source @@ -1608,7 +1651,7 @@ def run(args, runner, logger): do_create_package = options.binaries or options.sources or options.project or options.sat if options.bin_products: - ret = bin_products_archives(runner.cfg, logger) + ret = bin_products_archives(runner.cfg, logger, options.with_vcs) if ret!=0: return ret if not do_create_package: