Skip to content

Commit

Permalink
Try to autodetect a local package when running "osc build"
Browse files Browse the repository at this point in the history
Note that this detection might fail... in the this case osc will
eventually error out and suggest to rerun with "--local-package".
  • Loading branch information
marcus-h committed Mar 31, 2017
1 parent 7a4f7b0 commit 3397acc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6048,6 +6048,17 @@ def do_build(self, subcmd, opts, *args):
print("WARNING: package is not existing on server yet")
opts.local_package = True

if not opts.local_package:
try:
package = store_read_package(os.curdir)
prj = Project(os.pardir, getPackageList=False, wc_check=False)
if prj.status(package) == 'A':
# a package with state 'A' most likely does not exist on
# the server - hence, treat it as a local package
opts.local_package = True
except oscerr.NoWorkingCopy:
pass

if opts.offline or opts.local_package or r == None:
print("WARNING: source service from package or project will not be executed. This may not be the same build as on server!")
elif (conf.config['local_service_run'] and not opts.noservice) and not opts.noinit:
Expand Down

0 comments on commit 3397acc

Please sign in to comment.