Merge #588 Fix #580: add --skiptests option to mbs-build and manage.py build_module_locally

This commit is contained in:
Jan Kaluža
2017-06-16 06:39:41 +00:00
3 changed files with 18 additions and 7 deletions

View File

@@ -263,7 +263,7 @@ def submit_module_build(scm_url, branch, server, id_provider, pyrpkg, verify=Tru
return data['id']
return -3
def do_local_build(scm_url, branch):
def do_local_build(scm_url, branch, skiptests):
"""
Starts the local build using the 'mbs-manager build_module_locally'
command. Returns exit code of that command or None when scm_url or
@@ -274,9 +274,15 @@ def do_local_build(scm_url, branch):
if not scm_url or not branch:
return None
logging.info("Starting local build of %s, branch %s", scm_url, branch)
process = subprocess.Popen(['mbs-manager', 'build_module_locally',
scm_url, branch])
command = ['mbs-manager', 'build_module_locally']
if skiptests:
command.append('--skiptests')
logging.info("Tests will be skipped due to --skiptests option.")
command.extend([scm_url, branch])
process = subprocess.Popen(command)
process.communicate()
return process.returncode
@@ -412,6 +418,8 @@ def main():
"repository with a module.")
parser_local.add_argument("scm_url", nargs='?')
parser_local.add_argument("branch", nargs='?')
parser_local.add_argument('--skiptests', dest='skiptests', action='store_true',
help="add macro for skipping check section/phase")
parser_overview = subparsers.add_parser(
'overview', help="show overview of module builds",
@@ -446,7 +454,7 @@ def main():
else:
logging.info("Submitted module build %r" % build_id)
elif args.cmd_name == "local":
sys.exit(do_local_build(args.scm_url, args.branch))
sys.exit(do_local_build(args.scm_url, args.branch, args.skiptests))
elif args.cmd_name == "watch":
# Watch the module build.
try:

View File

@@ -122,7 +122,7 @@ def cleardb():
@manager.command
def build_module_locally(url, branch):
def build_module_locally(url, branch, skiptests=False):
""" Performs local module build using Mock
"""
conf.set_item("system", "mock")
@@ -149,7 +149,8 @@ def build_module_locally(url, branch):
db.create_all()
username = getpass.getuser()
submit_module_build_from_scm(username, url, branch, allow_local_url=True)
submit_module_build_from_scm(username, url, branch, allow_local_url=True,
skiptests=skiptests)
stop = module_build_service.scheduler.make_simple_stop_condition(db.session)

View File

@@ -722,7 +722,7 @@ def submit_module_build_from_yaml(username, handle, optional_params=None):
_url_check_re = re.compile(r"^[^:/]+:.*$")
def submit_module_build_from_scm(username, url, branch, allow_local_url=False,
optional_params=None):
skiptests=False, optional_params=None):
# Translate local paths into file:// URL
if allow_local_url and not _url_check_re.match(url):
log.info(
@@ -730,6 +730,8 @@ def submit_module_build_from_scm(username, url, branch, allow_local_url=False,
url = os.path.abspath(url)
url = "file://" + url
mmd, scm, yaml = _fetch_mmd(url, branch, allow_local_url)
if skiptests:
mmd.buildopts.rpms.macros += "\n\n%check exit 0\n"
return submit_module_build(username, url, mmd, scm, yaml, optional_params)