Commit a8d78f8d authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

No longer remove unneeded repos, disable them

parent e2e2cbf3
Pipeline #67027 passed with stage
in 12 seconds
......@@ -321,7 +321,7 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
return True
def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, packages=None, dry_run=False, filter_repos=None, only_project=False):
def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, packages=None, dry_run=False, filter_repos=None, only_project=False, remove_old=False):
if parent:
for attribute in config_attributes + default_attributes:
print("Copying attribute '{0}' from parent project".format(attribute))
......@@ -366,8 +366,9 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
prjconf = [start_marker]
# Remove existing repositories
for oldrepo in root.findall("./repository"):
root.remove(oldrepo)
if remove_old:
for oldrepo in root.findall("./repository"):
root.remove(oldrepo)
def repo(name, *dependencies, **kwargs):
is_compiler = kwargs.pop("compiler", False)
......@@ -381,6 +382,13 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
have_mpi = is_mpi or is_cuda_mpi
have_cuda = is_cuda or is_cuda_mpi
existing_repo = root.find("./repository[@name='{0}']".format(name))
if existing_repo is not None:
print("Modifying existing repository", name)
root.remove(existing_repo)
else:
print("New repository", name)
r = ElementTree.SubElement(root, "repository")
r.set("name", name)
r.text = "\n "
......
......@@ -20,6 +20,8 @@ import osc.cmdln
help="Temporarily disable all repositories containing REPO")
@osc.cmdln.option('--only-project', action="store_true", default=False,
help="Only change project metadata 'prj' and 'prjconf', leave individual packages unchanged")
@osc.cmdln.option('--remove-old', action="store_true", default=False,
help="Remove all obsolete repositories instead of only disabling builds for packages there")
@osc.cmdln.alias("mpcdf_setup_repos")
def do_mpcdf_setup_repositories(self, subcmd, opts, *args):
"""${cmd_name}: Create all repository combinations for an MPCDF project
......@@ -45,4 +47,7 @@ def do_mpcdf_setup_repositories(self, subcmd, opts, *args):
else:
raise osc.oscerr.WrongArgs("Too many arguments")
mpcdf_setup_repositories(self.get_api_url(), project, opts.distribution, parent=opts.parent, dry_run=opts.dry_run, filter_repos=opts.disable_repo, only_project=opts.only_project)
mpcdf_setup_repositories(self.get_api_url(),
project, opts.distribution,
parent=opts.parent, dry_run=opts.dry_run, filter_repos=opts.disable_repo,
only_project=opts.only_project, remove_old=opts.remove_old)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment