Ajout gestion achitecture cible

This commit is contained in:
William Petit 2015-10-22 14:02:51 +02:00
parent 1dec78875a
commit 8afd107858
2 changed files with 12 additions and 3 deletions

View File

@ -15,7 +15,7 @@ BUILD_TAG=${4}
function build_project() function build_project()
{ {
info "Building project '${PROJECT_NAME}'..." info "Building project '${PROJECT_NAME}' for ${TARGET_ARCH} architecture..."
set_opt project_name "${PROJECT_NAME}" set_opt project_name "${PROJECT_NAME}"
set_opt build_dir "${BUILD_DIR}" set_opt build_dir "${BUILD_DIR}"
@ -34,7 +34,7 @@ function build_project()
cd "${workspace}" cd "${workspace}"
dpkg-buildpackage -b 2> >(error) 1> >(info) dpkg-buildpackage -b -a "${TARGET_ARCH}" 2> >(error) 1> >(info)
if [ $? != 0 ]; then if [ $? != 0 ]; then
fatal "The build process has not completed successfuly !" fatal "The build process has not completed successfuly !"

View File

@ -14,6 +14,7 @@ function show_usage {
echo "Parameters: " echo "Parameters: "
echo echo
echo " -p Path to the project to build" echo " -p Path to the project to build"
echo " -a Optional : Target architecture (default amd64)"
echo " -d Optional : Destination of the builed packages (default ./packages)" echo " -d Optional : Destination of the builed packages (default ./packages)"
echo " -i Optional : Name of the Docker image to use for build (default: debian:jessie)" echo " -i Optional : Name of the Docker image to use for build (default: debian:jessie)"
echo " -k Optional : Keep the Docker container after build " echo " -k Optional : Keep the Docker container after build "
@ -92,10 +93,14 @@ function main {
# Expose host uid & gid # Expose host uid & gid
docker_opt="${docker_opt} -e HOST_UID=$(id -u) -e HOST_GID=$(id -g)" docker_opt="${docker_opt} -e HOST_UID=$(id -u) -e HOST_GID=$(id -g)"
# Expose host proxy variables # Expose host proxy variables
docker_opt="${docker_opt} -e HTTP_PROXY=${HTTP_PROXY} -e HTTPS_PROXY=${HTTPS_PROXY}" docker_opt="${docker_opt} -e HTTP_PROXY=${HTTP_PROXY} -e HTTPS_PROXY=${HTTPS_PROXY}"
docker_opt="${docker_opt} -e http_proxy=${http_proxy} -e https_proxy=${https_proxy}" docker_opt="${docker_opt} -e http_proxy=${http_proxy} -e https_proxy=${https_proxy}"
# Target architecture
docker_opt="${docker_opt} -e TARGET_ARCH=${TARGET_ARCH}"
if [[ ${PERSIST_CONTAINER} -eq 0 ]] if [[ ${PERSIST_CONTAINER} -eq 0 ]]
then then
docker_opt="${docker_opt} --rm " docker_opt="${docker_opt} --rm "
@ -122,7 +127,7 @@ function main {
# #
# Parsing options # Parsing options
# #
while getopts "kp:d:i:b:B:t:" option while getopts "kp:d:i:b:B:t:a:" option
do do
case $option in case $option in
k) k)
@ -146,6 +151,9 @@ do
t) t)
BUILD_TAG=${OPTARG} BUILD_TAG=${OPTARG}
;; ;;
a)
TARGET_ARCH=${OPTARG}
;;
*) *)
show_usage show_usage
;; ;;
@ -157,6 +165,7 @@ done
[[ -z ${BASE_IMAGE} ]] && BASE_IMAGE="debian:jessie" [[ -z ${BASE_IMAGE} ]] && BASE_IMAGE="debian:jessie"
[[ -z ${BUILD_BRANCH} ]] && BUILD_BRANCH="dist/ubuntu/precise/master" [[ -z ${BUILD_BRANCH} ]] && BUILD_BRANCH="dist/ubuntu/precise/master"
[[ -z ${PERSIST_CONTAINER} ]] && PERSIST_CONTAINER=0 [[ -z ${PERSIST_CONTAINER} ]] && PERSIST_CONTAINER=0
[[ -z ${TARGET_ARCH} ]] && TARGET_ARCH=amd64
# #
# Warn user about "proxy" # Warn user about "proxy"