Build quilt packages

This commit is contained in:
William Petit 2015-09-23 21:21:30 +02:00
parent 5bd63ab0ef
commit 2cff8041dc
8 changed files with 47 additions and 14 deletions

View File

@ -22,7 +22,7 @@ else
tagbranch="build-tag-${BUILD_TAG}"
git checkout -b ${tagbranch}
set_opt "tag_branch" "${tag_branch}"
tags="${BUILD_TAG}"
local tags="${BUILD_TAG}"
fi
if [[ -z ${tags} ]]
@ -44,16 +44,31 @@ do
project_name=$(get_opt project_name)
version=${tag#*/} #$(get_opt version 0.0.0)
version=${version/_/-} #$(get_opt version 0.0.0)
distribution=$(get_opt distribution UNRELEASED)
urgency=$(get_opt urgency low)
commit_count=$(git rev-list --count --first-parent HEAD)
current_commit=$(git log -n 1 --pretty=format:"%h")
version_suffix=${commit_count}~${current_commit}
version_suffix=tamarin${commit_count}~${current_commit}
package_version=${version}-${version_suffix}
package_version=${version}.tamarin${version_suffix}
# Define package_version opt if not defined
if [ -z "$(get_opt package_version)" ]; then
# Share computed package version
set_opt package_version ${package_version}
set_opt package_version "${package_version}"
fi
# Define project_version opt if not defined
if [ -z "$(get_opt project_version)" ]; then
# Share computed package version
set_opt project_version "${version}"
fi
# Native packages should not have a revision number
if [ $(get_opt package_format) == 'native' ]; then
package_version=$(echo ${version} | grep -oE '^[0-9.]+')
fi
echo "${project_name} (${package_version}) ${distribution}; urgency=${urgency}" >> debian/changelog

View File

@ -0,0 +1,15 @@
#!/bin/bash
source "${TAMARIN_UTIL}"
if [ -f "debian/source/format" ]; then
format=$(cat debian/source/format)
case ${format} in
"3.0 (native)")
set_opt package_format "native"
;;
"3.0 (quilt)")
set_opt package_format "quilt"
;;
esac
fi

View File

@ -4,5 +4,5 @@ source "${TAMARIN_UTIL}"
if [ -f debian/control ]; then
info "Installing build dependencies..."
mk-build-deps -t "apt-get --force-yes -y" --install debian/control
mk-build-deps -r -t "apt-get --force-yes -y --no-install-recommends" --install debian/control
fi

View File

@ -1,9 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash
source "${TAMARIN_UTIL}"
project_name=$(get_opt project_name)
src_tarball="../${project_name}_${package_version}.orig.tar.gz"
project_version=$(get_opt project_version)
src_tarball="../${project_name}_${project_version}.orig.tar.gz"
info "Creating sources tarball ${src_tarball}"

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
echo "RUN apt-get install --yes --no-install-recommends git-core git-buildpackage" >> Dockerfile
echo "RUN apt-get install --yes --no-install-recommends git-core" >> Dockerfile

View File

@ -2,6 +2,7 @@
HOOKS_DIR="${BASE_DIR}/hooks"
OPT_FILE="${BASE_DIR}/tmp/.tamarin_opts"
OPT_PREFIX="tamarin_opt_"
function info {
if [ -z "$@" ]; then
@ -50,7 +51,7 @@ function log {
}
function get_opt {
local opt_name=${1}
local opt_name=${OPT_PREFIX}${1}
local default_value=${2}
touch "${OPT_FILE}"
source "${OPT_FILE}"
@ -61,8 +62,8 @@ function set_opt {
local opt_name=${1}
local opt_value=${2}
touch "${OPT_FILE}"
sed -i "s/^${opt_name}*$//" "${OPT_FILE}"
echo "${opt_name}=\"${opt_value}\"" >> "${OPT_FILE}"
sed -i "s/^${OPT_PREFIX}${opt_name}*$//" "${OPT_FILE}"
echo "${OPT_PREFIX}${opt_name}=\"${opt_value}\"" >> "${OPT_FILE}"
}
function exec_hooks {

View File

@ -60,6 +60,8 @@ function create_container {
VOLUME /dist
EOF
exec_hooks "containerbuild" "$temp_dir"
if [[ -z ${BUILD_DIR} ]]
then
echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /tmp ${BUILD_TAG}" >> "$temp_dir/Dockerfile"
@ -68,8 +70,6 @@ EOF
echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /build ${BUILD_TAG}" >> "$temp_dir/Dockerfile"
fi
exec_hooks "containerbuild" "$temp_dir"
# Build image
tar -C "$temp_dir" -czh . | docker build -t "$container_tag" - 2> >(error) 1> >(info)