POC fonctionnel
This commit is contained in:
4
hooks/build/debian/build
Executable file
4
hooks/build/debian/build
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd src
|
||||
dpkg-buildpackage -b -a"${TAMARIN_TARGET_ARCH}"
|
@ -1,14 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HAS_SYSTEMD=$(which systemctl)
|
||||
ENGINE=chroot
|
||||
if [ ! -z "${HAS_SYSTEMD}" ]; then
|
||||
ENGINE=systemd-nspawn
|
||||
fi
|
||||
|
||||
${TAMARIN_ACBUILD} environment add DEBIAN_FRONTEND noninteractive
|
||||
|
||||
if [ "${ENGINE}" == 'chroot' ]; then
|
||||
if [ "${TAMARIN_ACBUILD_ENGINE}" == 'chroot' ]; then
|
||||
# Ugly fix for Python installation in chrooted environment (require /dev/urandom)
|
||||
head -c 65536 /dev/urandom > ./urandom
|
||||
${TAMARIN_ACBUILD} copy ./urandom /dev/urandom
|
||||
@ -16,15 +10,15 @@ fi
|
||||
|
||||
sudo -E /usr/bin/env bash - <<EOF
|
||||
export PATH=${PATH}
|
||||
${TAMARIN_ACBUILD} run --engine "${ENGINE}" -- apt-get update
|
||||
${TAMARIN_ACBUILD} run --engine "${ENGINE}" -- apt-get install --yes --no-install-recommends build-essential devscripts equivs
|
||||
${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get update
|
||||
${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get install --yes --no-install-recommends build-essential devscripts equivs python3
|
||||
EOF
|
||||
|
||||
if [ "${ENGINE}" == 'chroot' ]; then
|
||||
if [ "${TAMARIN_ACBUILD_ENGINE}" == 'chroot' ]; then
|
||||
# Clean up Python fix (see above)
|
||||
sudo -E /usr/bin/env bash - <<EOF
|
||||
export PATH=${PATH}
|
||||
${TAMARIN_ACBUILD} run --engine "${ENGINE}" -- rm -f /dev/urandom
|
||||
${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- rm -f /dev/urandom
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
@ -1,15 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
HAS_SYSTEMD=$(which systemctl)
|
||||
ENGINE=chroot
|
||||
if [ ! -z "${HAS_SYSTEMD}" ]; then
|
||||
ENGINE=systemd-nspawn
|
||||
fi
|
||||
|
||||
${TAMARIN_ACBUILD} environment add DEBIAN_FRONTEND noninteractive
|
||||
sudo -E /usr/bin/env bash - <<EOF
|
||||
export PATH=${PATH}
|
||||
${TAMARIN_ACBUILD} run --engine "${ENGINE}" -- apt-get update
|
||||
${TAMARIN_ACBUILD} run --engine "${ENGINE}" -- apt-get install --yes --no-install-recommends git-core
|
||||
${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get update
|
||||
${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get install --yes --no-install-recommends git-core
|
||||
EOF
|
||||
${TAMARIN_ACBUILD} environment remove DEBIAN_FRONTEND
|
||||
|
@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "${TAMARIN_UTIL}"
|
||||
|
||||
function move_output_to_dist {
|
||||
find '../' -maxdepth 1 -name "$1" -type f -print0 | xargs -0r mv -t /dist/
|
||||
find . -maxdepth 1 -name "$1" -type f -print0 | xargs -0r mv -t /dist/
|
||||
}
|
||||
|
||||
# Create new directory
|
||||
@ -14,6 +12,3 @@ move_output_to_dist "*.deb"
|
||||
move_output_to_dist "*.changes"
|
||||
move_output_to_dist "*.dsc"
|
||||
move_output_to_dist "*.tar.{bz2,gz,lzma,xz}"
|
||||
|
||||
# Configure files permissions
|
||||
chown -R ${HOST_UID}:${HOST_GID} /dist
|
@ -1,23 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
source "${TAMARIN_UTIL}"
|
||||
|
||||
cd src
|
||||
|
||||
if [ ! -f debian/changelog ]; then
|
||||
info "No changelog. Skipping..."
|
||||
tamarin_info "No changelog. Skipping..."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $(get_opt no_version_suffix 'no') == 'yes' ]; then
|
||||
info "Not adding version suffix."
|
||||
if [ $(tamarin_db get no_version_suffix 'no') == 'yes' ]; then
|
||||
tamarin_info "Not adding version suffix."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -d .git ]; then
|
||||
info "It seems to be a Git repository. Generating version suffix based on Git history..."
|
||||
tamarin_info "It seems to be a Git repository. Generating version suffix based on Git history..."
|
||||
commit_count=$(git rev-list --count HEAD)
|
||||
current_commit=$(git log -n 1 --pretty=format:"%h")
|
||||
version_suffix=tamarin${commit_count}~${current_commit}
|
||||
else
|
||||
info "Not a Git project. Fallback to timestamp for suffix generation..."
|
||||
tamarin_info "Not a Git project. Fallback to timestamp for suffix generation..."
|
||||
version_suffix=tamarin$(date +%Y%m%d%H%M)
|
||||
fi
|
||||
|
7
hooks/prebuild/debian/copy-sources-to-workspace
Executable file
7
hooks/prebuild/debian/copy-sources-to-workspace
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tamarin_info "Copying sources to workspace 'src' directory..."
|
||||
|
||||
mkdir src
|
||||
# Copying all read-only sources to the current workspace src
|
||||
cp -r /src/. ./src
|
@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
source "${TAMARIN_UTIL}"
|
||||
|
||||
cd src
|
||||
|
||||
if [ -f debian/changelog ] || [ ! -d .git ]; then
|
||||
info "Not a Git repository or Debian changelog already exists !"
|
||||
tamarin_info "Not a Git repository or Debian changelog already exists !"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Get commits log as changelog
|
||||
|
||||
BUILD_TAG=$(get_opt build_tag "last")
|
||||
BUILD_TAG=$(tamarin_db get build_tag "last")
|
||||
|
||||
echo "BUILD TAG IS ${BUILD_TAG}"
|
||||
tamarin_debug "BUILD TAG IS ${BUILD_TAG}"
|
||||
|
||||
if [[ ${BUILD_TAG} == "last" ]]
|
||||
then
|
||||
@ -18,13 +19,13 @@ then
|
||||
else
|
||||
tagbranch="build-tag-${BUILD_TAG}"
|
||||
git checkout -b ${tagbranch}
|
||||
set_opt "tag_branch" "${tag_branch}"
|
||||
tamarin_db set "tag_branch" "${tag_branch}"
|
||||
local tags="${BUILD_TAG}"
|
||||
fi
|
||||
|
||||
if [[ -z ${tags} ]]
|
||||
then
|
||||
warn "No release tag found, you repo must have a tag like 'release/X.X'"
|
||||
tamarin_warn "No release tag found, you repo must have a tag like 'release/X.X'"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -36,21 +37,21 @@ do
|
||||
|
||||
# Set the top commiter as the maintainer of the project if not defined
|
||||
top_contributor=$(git log --pretty=short | git shortlog -s -n -e | sed 's/^\s*[0-9]*\s*//g' | head -n 1)
|
||||
maintainer=$(get_opt maintainer "${top_contributor}")
|
||||
maintainer=$(tamarin_db get maintainer "${top_contributor}")
|
||||
|
||||
project_name=$(get_opt project_name)
|
||||
project_name=$(tamarin_db get 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)
|
||||
distribution=$(tamarin_db get distribution UNRELEASED)
|
||||
urgency=$(tamarin_db get urgency low)
|
||||
|
||||
package_version=${version}
|
||||
|
||||
# Define project_version opt if not defined
|
||||
if [ -z "$(get_opt project_version)" ]; then
|
||||
# Define project_version if not defined
|
||||
if [ -z "$(tamarin_db get project_version)" ]; then
|
||||
# Share computed project version
|
||||
set_opt project_version "${version}"
|
||||
tamarin_db set project_version "${version}"
|
||||
fi
|
||||
|
||||
echo "${project_name} (${version}) ${distribution}; urgency=${urgency}" >> debian/changelog
|
@ -1,14 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
source "${TAMARIN_UTIL}"
|
||||
|
||||
cd src
|
||||
|
||||
if [ -f debian/changelog ] || [ ! -d .git ]; then
|
||||
info "Not a Git repository or Debian changelog already exists !"
|
||||
tamarin_info "Not a Git repository or Debian changelog already exists !"
|
||||
exit
|
||||
fi
|
||||
|
||||
changelog="debian/changelog"
|
||||
project_name=$(get_opt project_name)
|
||||
project_version=$(get_opt project_version 0.0.0)
|
||||
project_name=$(tamarin_db get project_name)
|
||||
project_version=$(tamarin_db get project_version 0.0.0)
|
||||
date=$(date -R)
|
||||
top_contributor=$(git log --pretty=short | git shortlog -s -n -e | sed 's/^\s*[0-9]*\s*//g' | head -n 1)
|
||||
current_commit=$(git log -n 1 --pretty=format:%h)
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd src
|
||||
|
||||
if [ -f debian/control ]; then
|
||||
echo "Installing build dependencies..."
|
||||
apt-get update
|
3
hooks/prebuild/debian/load-project-db
Executable file
3
hooks/prebuild/debian/load-project-db
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tamarin_db load
|
Reference in New Issue
Block a user