1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 18:26:15 +01:00

Merge branch 'undeprecate-disabledrun' of https://github.com/cmurphy/osc

Add a "manual" service mode. A service with mode "manual" is not executed
by default (that is, via "osc service run"). As of now, "manual" is in
some sense just an alias for "disabled". However, this might change in the
future [1]. Also, "localrun" now executes services with mode "serveronly".
Moreover, the documentation of "disabledrun" is updated ("disabledrun"
never executed services with mode "serveronly"). Additionally, "localrun"
and "disabledrun" are marked as "[n]ot for common usage anymore" in the
service command's description.
The rationale for these changes is (partly) described in [1]. The main
motivation is to add some clarity (in contrast to the "disabled" mode,
it is probably easier to get/guess the semantics of the "manual" mode).

[1] https://github.com/openSUSE/osc/pull/826
This commit is contained in:
Marcus Huewe 2020-07-31 15:01:23 +02:00
commit 7612fe1614
2 changed files with 15 additions and 7 deletions

View File

@ -6949,13 +6949,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
specified source service. In case parameters exist for this one in _service file
they are used.
runall ra run all services independent of the used mode
localrun lr run all services except the ones with mode "buildtime", "disabled", or
"serveronly" (deprecated)
disabledrun dr run all services with mode "disabled" or "serveronly" (deprecated)
manualrun mr run all services with mode "manual"
remoterun rr trigger a re-run on the server side
merge commits all server side generated files and drops the _service definition
wait waits until the service finishes and returns with an error if it failed
Not for common usage anymore:
localrun lr the same as "run" but services with mode "serveronly" are also executed
disabledrun dr run all services with mode "disabled"
${cmd_option_list}
"""
# disabledrun and localrun exists as well, but are considered to be obsolete
@ -6988,7 +6990,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
command = args[0]
if not (command in ( 'runall', 'ra', 'run', 'localrun', 'disabledrun', 'remoterun', 'lr', 'dr', 'r', 'rr', 'merge', 'wait' )):
if not (command in ( 'runall', 'ra', 'run', 'localrun', 'manualrun', 'disabledrun', 'remoterun', 'lr', 'dr', 'mr', 'rr', 'merge', 'wait' )):
raise oscerr.WrongArgs('Wrong command given.')
if command == "remoterun" or command == "rr":
@ -7003,12 +7005,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print(mergeservice(apiurl, project, package))
return
if command in ('runall', 'ra', 'run', 'localrun', 'disabledrun', 'lr', 'dr', 'r'):
if command in ('runall', 'ra', 'run', 'localrun', 'manualrun', 'disabledrun', 'lr', 'mr', 'dr', 'r'):
if not is_package_dir(os.curdir):
raise oscerr.WrongArgs('Local directory is no package')
p = Package(".")
if command == "localrun" or command == "lr":
mode = "local"
elif command == "manualrun" or command == "mr":
mode = "manual"
elif command == "disabledrun" or command == "dr":
mode = "disabled"
elif command == "runall" or command == "ra":

View File

@ -453,7 +453,11 @@ class Serviceinfo:
continue
if service['mode'] == "buildtime":
continue
if service['mode'] == "serveronly" and callmode != "disabled":
if service['mode'] == "serveronly" and callmode != "local":
continue
if service['mode'] == "manual" and callmode != "manual":
continue
if service['mode'] != "manual" and callmode == "manual":
continue
if service['mode'] == "disabled" and callmode != "disabled":
continue
@ -479,7 +483,7 @@ class Serviceinfo:
# updating _services.
return r
if service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local" or callmode == "trylocal" or callmode == "all":
if service['mode'] == "manual" or service['mode'] == "disabled" or service['mode'] == "trylocal" or service['mode'] == "localonly" or callmode == "local" or callmode == "trylocal" or callmode == "all":
for filename in os.listdir(temp_dir):
os.rename(os.path.join(temp_dir, filename), os.path.join(dir, filename))
else: