Commit 93a86232 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Restrict osc mpcdf_push to home:* -> software

Consequentially, the last arguments becomes deprecated, as it always
would be "software"
parent deed7984
......@@ -29,9 +29,9 @@ def do_mpcdf_push(self, subcmd, opts, *args):
the osc mpcdf_set_as_branch command)
Usage:
osc mpcdf_push TO_PROJECT (from within a package checkout)
osc mpcdf_push PACKAGE TO_PROJECT (from within a project checkout)
osc mpcdf_push FROM_PROJECT PACKAGE TO_PROJECT (anywhere)
osc mpcdf_push ["software"] (from within a package checkout)
osc mpcdf_push PACKAGE ["software"] (from within a project checkout)
osc mpcdf_push FROM_PROJECT PACKAGE ["software"] (anywhere)
Examples:
- Add a new package from your home:project to software:
......@@ -41,26 +41,34 @@ def do_mpcdf_push(self, subcmd, opts, *args):
"""
import sys
if len(args) < 1:
raise osc.oscerr.WrongArgs("Not enough arguments")
elif len(args) == 1:
to_project, = args
if len(args) > 0 and args[-1] == "software":
print("Deprecation Notice:\n"
" 'osc mpcdf_push' can only be used to push to the 'software' project,\n"
" it is thus no longer necessary as an argument\n")
args = args[:-1]
to_project = "software"
if len(args) == 0:
if osc.core.is_package_dir(os.curdir):
package = osc.core.store_read_package(os.curdir)
from_project = osc.core.store_read_project(os.curdir)
else:
raise osc.oscerr.WrongArgs('Specify FROM_PROJECT and/or PACKAGE or run command in a package or project checkout directory')
elif len(args) == 2:
package, to_project = args
elif len(args) == 1:
package, = args
if osc.core.is_project_dir(os.curdir):
from_project = osc.core.store_read_project(os.curdir)
else:
raise osc.oscerr.WrongArgs('Specify FROM_PROJECT or run command in an osc package or project checkout directory')
elif len(args) == 3:
from_project, package, to_project = args
elif len(args) == 2:
from_project, package = args
else:
raise osc.oscerr.WrongArgs("Too many arguments")
if not from_project.startswith("home:"):
raise osc.oscerr.WrongArgs("'osc mpcdf_push' can only be used from packages in a home: project")
api_url = self.get_api_url()
project_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules"]
......
Supports Markdown
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