Skip to content

Commit

Permalink
Merge pull request #1315 from dmach/commit-no-service
Browse files Browse the repository at this point in the history
Unify how the 'commit' and 'build' commands work with '--noservice' option
  • Loading branch information
dmach authored Sep 14, 2023
2 parents a671b68 + 1d47dfc commit 14ce3b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions osc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,10 @@ def main(apiurl, store, opts, argv):
buildargs.append('--noinit')

if not store.is_package:
opts.noservice = True
opts.skip_local_service_run = True

# check for source services
if not opts.offline and not opts.noservice:
if not opts.offline and not opts.skip_local_service_run:
p = core.Package(os.curdir)
r = p.run_source_services(verbose=True)
if r:
Expand Down
16 changes: 11 additions & 5 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5547,8 +5547,8 @@ def do_addremove(self, subcmd, opts, *args):
help='read log message from FILE, \'-\' denotes standard input.')
@cmdln.option('-f', '--force', default=False, action="store_true",
help='Allow empty commit with no changes. When commiting a project, allow removing packages even if other packages depend on them.')
@cmdln.option('--skip-local-service-run', '--noservice', default=False, action="store_true",
help='Skip service run of configured source services for local run')
@cmdln.option("--skip-local-service-run", "--noservice", "--no-service", default=False, action="store_true",
help="Skip run of local source services as specified in _service file.")
def do_commit(self, subcmd, opts, *args):
"""
Upload content to the repository server
Expand Down Expand Up @@ -5590,6 +5590,7 @@ def _commit(self, subcmd, opts, args):
msg = open(opts.file).read()
except:
sys.exit('could not open file \'%s\'.' % opts.file)

skip_local_service_run = False
if not conf.config['local_service_run'] or opts.skip_local_service_run:
skip_local_service_run = True
Expand Down Expand Up @@ -7053,8 +7054,8 @@ def parse_repoarchdescr(self, args, noinit=False, alternative_project=None, igno
help='Skip signature verification (via pgp keys) of packages used for build. (Global config in oscrc: no_verify)')
@cmdln.option('--nodebugpackages', '--no-debug-packages', action='store_true',
help='Skip installation of additional debug packages for CLI builds')
@cmdln.option('--noservice', '--no-service', action='store_true',
help='Skip run of local source services as specified in _service file.')
@cmdln.option("--skip-local-service-run", "--noservice", "--no-service", default=False, action="store_true",
help="Skip run of local source services as specified in _service file.")
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
help='Prefer packages from this directory when installing the build-root')
@cmdln.option('-k', '--keep-pkgs', metavar='DIR',
Expand Down Expand Up @@ -7328,8 +7329,13 @@ def do_build(self, subcmd, opts, *args):
if opts.offline and opts.preload:
raise oscerr.WrongOptions('--offline and --preload are mutually exclusive')

if not opts.skip_local_service_run:
# if the option is not set by the user read the default from config
if not conf.config['local_service_run']:
opts.skip_local_service_run = True

if opts.shell or opts.wipe:
opts.noservice = True
opts.skip_local_service_run = True

if opts.preload:
opts.nopreinstallimage = True
Expand Down

0 comments on commit 14ce3b9

Please sign in to comment.