diff --git a/.gitignore b/.gitignore index 6f2dbb9..4463bf0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -dist +packages *.log *~ diff --git a/hooks/git/install-git-containerbuild b/hooks/git/install-git-containerbuild index 585549f..223f1d8 100755 --- a/hooks/git/install-git-containerbuild +++ b/hooks/git/install-git-containerbuild @@ -1,3 +1,3 @@ #!/usr/bin/env bash -echo "RUN apt-get install --yes --no-install-recommends git-core" >> Dockerfile +echo "RUN apt-get install --yes --no-install-recommends git-core git-buildpackage" >> Dockerfile diff --git a/hooks/tamarin/export-dist-postbuild b/hooks/tamarin/export-dist-postbuild index cd06a60..779e02e 100755 --- a/hooks/tamarin/export-dist-postbuild +++ b/hooks/tamarin/export-dist-postbuild @@ -1,10 +1,18 @@ #!/bin/bash +source "${TAMARIN_UTIL}" + +function move_output_to_dist { + find '../' -maxdepth 1 -name "$1" -type f -print0 | xargs -0r mv -t /dist/ +} + # Create new directory mkdir -p /dist # Move generated files -mv ../*.deb /dist -mv ../*.changes /dist -mv ../*.dsc /dist -mv ../*.tar.xz /dist +move_output_to_dist "*.deb" +move_output_to_dist "*.changes" +move_output_to_dist "*.dsc" +move_output_to_dist "*.tar.{bz2,gz,lzma,xz}" + +chown -R ${HOST_UID}:${HOST_GID} /dist diff --git a/lib/build.sh b/lib/build.sh index a3f3ffc..fb1d796 100755 --- a/lib/build.sh +++ b/lib/build.sh @@ -33,7 +33,8 @@ function build_project() exec_hooks "prebuild" "${workspace}" cd "${workspace}" - dpkg-buildpackage -us -uc 2> >(error) 1> >(info) + + dpkg-buildpackage -b 2> >(error) 1> >(info) if [ $? != 0 ]; then fatal "The build process has not completed successfuly !" diff --git a/package.sh b/package.sh index 8df1e37..ec09d45 100755 --- a/package.sh +++ b/package.sh @@ -47,7 +47,7 @@ function create_container { ENV DEBIAN_FRONTEND noninteractive RUN apt-get update &&\ - apt-get install --yes build-essential devscripts equivs git-buildpackage + apt-get install --yes --no-install-recommends build-essential devscripts equivs RUN mkdir /root/.tamarin RUN mkdir /project @@ -90,22 +90,25 @@ function main { local docker_opt="run -e \"DISTRIB=$BASE_IMAGE\" -e \"PROJECT_NAME=$project_name\"" - if [[ ${PERSIST_CONTAINER} -eq 0 ]] + # Expose host uid & gid + docker_opt="${docker_opt} -e HOST_UID=$(id -u) -e HOST_GID=$(id -g)" + + if [[ ${PERSIST_CONTAINER} -eq 0 ]] then docker_opt="${docker_opt} --rm " else docker_opt="${docker_opt}" fi - + if [[ -z ${BUILD_DIR} ]] then - docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src\" -v=\"$PROJECT_DEST:/dist\" $container_tag" + docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src:ro\" -v=\"$PROJECT_DEST:/dist:rw\" $container_tag" else - docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src\" -v=\"$PROJECT_DEST:/dist\" -v=\"${BUILD_DIR}:/build\" $container_tag" + docker_opt="${docker_opt} -v=\"$PROJECT_PATH:/src:ro\" -v=\"$PROJECT_DEST:/dist:rw\" -v=\"${BUILD_DIR}:/build\" $container_tag" fi info "Switching to container..." - echo "docker ${docker_opt}" + debug "docker ${docker_opt}" docker ${docker_opt} res=${?} @@ -114,8 +117,8 @@ function main { } # -# Parsing options -# +# Parsing options +# while getopts "kp:d:i:b:B:t:" option do case $option in