summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2017-09-05 16:04:23 -0400
committerTim Rozet <trozet@redhat.com>2017-09-06 07:59:45 -0400
commit27018324387d4ef0efa908b315403a636f92de55 (patch)
tree5fbae8e4e76ed6b56ed8d34883e5c9609d4ac14c
parent13377044e0cafd1e27ff66da2b264d8fa19e09af (diff)
Removes build.sh
We now have build.py which handles all the building and build.sh was just a wrapper to include ansible playbook. Now that we have built in apex libs to run ansible there is no reason to keep build.sh anymore. Also simplifies the logic to determine apex root by using the git properties. Change-Id: I00d2e5c7c198e549d21936bb1e9b562ba93d3010 Signed-off-by: Tim Rozet <trozet@redhat.com>
-rw-r--r--apex/build.py25
-rwxr-xr-xci/build.sh16
-rw-r--r--docs/release/release-notes/release-notes.rst2
3 files changed, 19 insertions, 24 deletions
diff --git a/apex/build.py b/apex/build.py
index cda4e061..2d0786a8 100644
--- a/apex/build.py
+++ b/apex/build.py
@@ -15,6 +15,8 @@ import sys
import uuid
import yaml
+from apex.common import utils
+
CACHE_JOURNAL = 'cache_journal.yaml'
TMP_CACHE = '.cache'
BUILD_ROOT = 'build'
@@ -116,6 +118,12 @@ def build(build_root, version, iso=False, rpms=False):
make_args = ['RELEASE={}'.format(version)]
else:
make_args = []
+ logging.info('Running make clean...')
+ try:
+ subprocess.check_call(['make', '-C', build_root, 'clean'])
+ except subprocess.CalledProcessError:
+ logging.error('Failure to make clean')
+ raise
logging.info('Building targets: {}'.format(make_targets))
try:
output = subprocess.check_output(["make"] + make_args + ["-C",
@@ -216,13 +224,13 @@ if __name__ == '__main__':
console.setLevel(log_level)
console.setFormatter(logging.Formatter(formatter))
logging.getLogger('').addHandler(console)
- apex_root = os.path.split(os.getcwd())[0]
- if 'apex/apex' in apex_root:
- apex_root = os.path.split(apex_root)[0]
- for root, dirs, files in os.walk(apex_root):
- if BUILD_ROOT in dirs and 'apex/apex' not in root:
- apex_root = root
- break
+ # Since we only support building inside of git repo this should be fine
+ try:
+ apex_root = subprocess.check_output(
+ ['git', 'rev-parse', '--show-toplevel']).decode('utf-8').strip()
+ except subprocess.CalledProcessError:
+ logging.error("Must be in an Apex git repo to execute build")
+ raise
apex_build_root = os.path.join(apex_root, BUILD_ROOT)
if os.path.isdir(apex_build_root):
cache_tmp_dir = os.path.join(apex_root, TMP_CACHE)
@@ -232,6 +240,9 @@ if __name__ == '__main__':
raise ApexBuildException("Invalid path for apex root: {}. Must be "
"invoked from within Apex code directory.".
format(apex_root))
+ dep_playbook = os.path.join(apex_root,
+ 'lib/ansible/playbooks/build_dependencies.yml')
+ utils.run_ansible(None, dep_playbook)
unpack_cache(cache_tmp_dir, args.cache_dir)
build(apex_build_root, args.build_version, args.iso, args.rpms)
build_cache(cache_tmp_dir, args.cache_dir)
diff --git a/ci/build.sh b/ci/build.sh
deleted file mode 100755
index 113f35d6..00000000
--- a/ci/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-##############################################################################
-# Copyright (c) 2016 Dan Radez (Red Hat) and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-set -e
-rpm -q ansible || sudo yum -y install ansible
-ansible-playbook --become -i "localhost," -c local $DIR/../lib/ansible/playbooks/build_dependencies.yml -vvv
-make -C $DIR/../build clean
-python3 $DIR/../apex/build.py $@
diff --git a/docs/release/release-notes/release-notes.rst b/docs/release/release-notes/release-notes.rst
index a4d653ee..7d8a78f9 100644
--- a/docs/release/release-notes/release-notes.rst
+++ b/docs/release/release-notes/release-notes.rst
@@ -243,7 +243,7 @@ Software Deliverables
- Apex overcloud .rpm (opnfv-apex) - For nosdn and OpenDaylight Scenarios
- Apex undercloud .rpm (opnfv-apex-undercloud)
- Apex common .rpm (opnfv-apex-common)
-- build.sh - Builds the above artifacts
+- build.py - Builds the above artifacts
- opnfv-deploy - Automatically deploys Target OPNFV System
- opnfv-clean - Automatically resets a Target OPNFV Deployment
- opnfv-util - Utility to connect to or debug Overcloud nodes + OpenDaylight