Commit 732b0b5e authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Add option --only-project to mpcdf_setup_repositories

parent 5ef9a048
......@@ -256,7 +256,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):
def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, packages=None, dry_run=False, filter_repos=None, only_project=False):
if parent:
for attribute in ["compiler_modules", "default_compiler", "mpi_modules", "default_mpi", "cuda_modules", "default_cuda"]:
print("Copying attribute 'MPCDF:{0}' from parent project".format(attribute))
......@@ -399,14 +399,15 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
print("osc meta prj {0} -F - <<EOF\n{1}\nEOF\n".format(project, prj))
print("osc meta prjconf {0} -F - <<EOF\n{1}\nEOF\n".format(project, prjconf))
else:
# First set-up the <enable/> flags, that way no
# spurious builds are launched
if packages is None:
packages = osc.core.meta_get_packagelist(api_url, project)
for package in packages:
print("Updating repositories for", package)
if not mpcdf_enable_repositories(api_url, project, package, filter_repos=filter_repos):
print("ATTENTION: Not changing unmanaged package {0}".format(package))
if not only_project:
# First set-up the <enable/> flags, that way no
# spurious builds are launched
if packages is None:
packages = osc.core.meta_get_packagelist(api_url, project)
for package in packages:
print("Updating repositories for", package)
if not mpcdf_enable_repositories(api_url, project, package, filter_repos=filter_repos):
print("ATTENTION: Not changing unmanaged package {0}".format(package))
# Update repositories
print("Updating prj meta")
......
......@@ -18,6 +18,8 @@ import osc.cmdln
help="Base distribution, necessary argument unless set previously for this project")
@osc.cmdln.option('--disable-repo', metavar="REPO", action="append",
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.alias("mpcdf_setup_repos")
def do_mpcdf_setup_repositories(self, subcmd, opts, *args):
"""${cmd_name}: Create all repository combinations for an MPCDF project
......@@ -43,4 +45,4 @@ 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)
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)
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