X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fbuild-tools.git;a=blobdiff_plain;f=build_images.sh;h=281b166e1c071417d09bc7957cd5915ad3e82ffa;hp=9d94f597296d389e032a5541f35c509fd5be5351;hb=HEAD;hpb=900738828f48bade06f69c1e3a8f6fb988b97950 diff --git a/build_images.sh b/build_images.sh index 9d94f59..281b166 100755 --- a/build_images.sh +++ b/build_images.sh @@ -14,15 +14,16 @@ # limitations under the License. set -x -set -eu +set -e +set -o pipefail usage() { - echo "Usage: $0 -m -w " + echo "Usage: $0 -m -w [-r -p ]" exit 1 } -[ "$#" -ne 4 ] && usage -while getopts "m:w:" OPT; do +rpm_search_paths="" +while getopts "m:w:p:r:" OPT; do case $OPT in m) export MANIFEST_PATH=$(readlink -f $OPTARG) @@ -30,20 +31,46 @@ while getopts "m:w:" OPT; do w) export WORK=$OPTARG ;; + r) + export RPMBUILDER_PATH=$(readlink -f $OPTARG) + ;; + p) + rpm_search_paths+=" $OPTARG" + ;; *) usage ;; esac done +[ -z "$MANIFEST_PATH" ] && usage +[ -z "$WORK" ] && usage +[ -n "$rpm_search_paths" -a -z "$RPMBUILDER_PATH" ] && usage +shift "$((OPTIND-1))" +[ "$#" -ne 0 ] && usage + scriptdir="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" source $scriptdir/lib.sh _initialize_work_dirs +dib_file="${scriptdir}/docker-context/Dockerfile-dib" +dib_patch="${dib_file}.$(uname -m).patch" +if [ -e "${dib_patch}" ] && ! patch -R --dry-run "${dib_file}" "${dib_patch}"; then + patch "${dib_file}" "${dib_patch}" +fi + +docker build --network=host -f $scriptdir/docker-context/Dockerfile-dib -t dib $scriptdir/docker-context +docker build --network=host -f $scriptdir/docker-context/Dockerfile-buildtools -t buildtools $scriptdir/docker-context + # Create manifest RPM $LIBDIR/create_manifest_rpm.sh +# Create RPMs +if [ -n "$rpm_search_paths" ]; then + $LIBDIR/build_rpms.sh $rpm_search_paths +fi + # Create repo config $LIBDIR/build_step_create_yum_repo_files.sh