Skip to content
Snippets Groups Projects
Commit ecdf5350 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Only add new-packages by default in mpcdf_sync_projects

parent 11355d0f
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ import osc.core ...@@ -9,6 +9,8 @@ import osc.core
import osc.cmdln import osc.cmdln
@osc.cmdln.option('-a', '--all', action="store_true",
help="Update all packages in the target repository, not only new ones")
def do_mpcdf_sync_projects(self, subcmd, opts, *args): def do_mpcdf_sync_projects(self, subcmd, opts, *args):
"""${cmd_name}: Push all packages from a project to another """${cmd_name}: Push all packages from a project to another
...@@ -35,12 +37,18 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args): ...@@ -35,12 +37,18 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
raise osc.oscerr.WrongArgs("Too many arguments") raise osc.oscerr.WrongArgs("Too many arguments")
api_url = self.get_api_url() api_url = self.get_api_url()
to_packages = osc.core.meta_get_packagelist(api_url, to_project)
if package is None: if package is None:
from_packages = osc.core.meta_get_packagelist(api_url, from_project) from_packages = osc.core.meta_get_packagelist(api_url, from_project)
if not opts.all:
from_packages = list(sorted(set(from_packages) - set(to_packages)))
elif opts.all:
raise osc.oscerr.WrongArgs('Cannot specify `--all` and PACKAGE')
else: else:
from_packages = [package] from_packages = [package]
to_packages = osc.core.meta_get_packagelist(api_url, to_project)
project_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules"] project_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules"]
package_attributes = ["MPCDF:enable_repositories"] + project_attributes package_attributes = ["MPCDF:enable_repositories"] + project_attributes
...@@ -72,7 +80,7 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args): ...@@ -72,7 +80,7 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
continue continue
mpcdf_common.set_attribute(api_url, to_project, orig_package, attr) mpcdf_common.set_attribute(api_url, to_project, orig_package, attr)
if package is None: if package is None and opts.all:
# Check if distribution is already set in to_project # Check if distribution is already set in to_project
to_prj_meta = mpcdf_common.project_meta(api_url, to_project) to_prj_meta = mpcdf_common.project_meta(api_url, to_project)
sys_repo = to_prj_meta.find('./repository[@name="System"]') sys_repo = to_prj_meta.find('./repository[@name="System"]')
...@@ -84,5 +92,6 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args): ...@@ -84,5 +92,6 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
print("Creating repository configuration") print("Creating repository configuration")
mpcdf_common.mpcdf_setup_repositories(api_url, to_project, distribution) mpcdf_common.mpcdf_setup_repositories(api_url, to_project, distribution)
else: else:
if not mpcdf_common.mpcdf_enable_repositories(api_url, to_project, package): for orig_package in from_packages:
print("ATTENTION: Not changing unmanaged package {0}".format(package)) if not mpcdf_common.mpcdf_enable_repositories(api_url, to_project, orig_package):
print("ATTENTION: Not changing unmanaged package {0}".format(orig_package))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment