From 93ef7cdf83d41840dd0055eacb873b950513c7e6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 10 Jan 2022 21:50:21 +0100 Subject: [PATCH] Fixes after tests on the battlefield --- .gitignore | 2 +- config/config | 2 +- scripts/build_deb | 56 ++++++++++++++++++++++++++------------- scripts/make-chroots | 11 +++----- scripts/ynh-custom-builds | 2 +- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 6de2a8e..dffaa06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -chroots/* +.chroots config/keys/* gitrepos/* diff --git a/config/config b/config/config index e88e111..e13076b 100644 --- a/config/config +++ b/config/config @@ -8,6 +8,6 @@ BUILD_DEB="$HOME_VINAIGRETTE/scripts/build_deb" REPO_URL="forge.yunohost.org" REPO_DIR="/var/www/repo/debian" -REPO_CONFIG=$REPO_DIR/config/distributions +REPO_CONFIG=$REPO_DIR/conf/distributions REPO_ARCHS="$(grep "Architectures" $REPO_CONFIG | head -n 1 | awk -F: '{print $2}' | sed 's/source//g')" diff --git a/scripts/build_deb b/scripts/build_deb index 837a2ae..4029e8a 100755 --- a/scripts/build_deb +++ b/scripts/build_deb @@ -4,14 +4,11 @@ readonly THISSCRIPT=$0 readonly DISTRIB=$1 readonly BRANCH=$2 readonly FOLDER=$3 +readonly ARCHS=$4 source /home/vinaigrette/config/config source /home/vinaigrette/scripts/common.sh -#export DEBSIGN_KEYID -#export DEBFULLNAME -#export DEBEMAIL - # ##### # # Usage # # ##### # @@ -27,6 +24,7 @@ Arguments: buster or bullseye stable, testing, or unstable the folder in which to build... + list of archs to build (or empty for autodetect). For example: amd63,armhf EOF } @@ -46,9 +44,12 @@ function main() boxed "Building ${PACKAGE} ${VERSION} ..." - # Architecture-agnostic packages have 'architecture: all' in their control files - # others have 'architecture: any' - if grep -q "Architecture: all" $PKG_DIR/debian/control + if [[ -n "$ARCHS" ]] + then + archs="$(echo $ARCHS | tr ',' ' ')" + # Architecture-agnostic packages have 'architecture: all' in their control files + # others have 'architecture: any' + elif grep -q "Architecture: all" $PKG_DIR/debian/control then archs="all" else @@ -57,18 +58,25 @@ function main() for arch in $archs do - sendxmpppy "⏳ Starting build for ${package}/${version} for $DISTRIB/$BRANCH/$ARCH ..." + sendxmpppy "⏳ Starting build for ${PACKAGE}/${VERSION} for $DISTRIB/$BRANCH/$arch ..." if ! build $arch then - sendxmpppy "❌ Failed build for ${package}/${version} for $DISTRIB/$BRANCH/$ARCH ?!" - critical "Failed to build ${package}/${version} for $DISTRIB/$BRANCH/$ARCH" + sendxmpppy "❌ Failed build for ${PACKAGE}/${VERSION} for $DISTRIB/$BRANCH/$arch ?!" + critical "Failed to build ${PACKAGE}/${VERSION} for $DISTRIB/$BRANCH/$arch" fi - if reprepro --waitforlock 6 -b $REPO_DIR -C $BRANCH include $DISTRIB ${ROOT_DIR}/${PACKAGE}_${VERSION}_$arch.changes + if [[ $arch == "all" ]] then - sendxmpppy "✔️ Completed build for ${package}/${version} for $DISTRIB/$BRANCH/$ARCH." + changearch="amd64" else - sendxmpppy "❌ Failed to include change of ${package}/${version} for $DISTRIB/$BRANCH/$ARCH ?!" + changearch=$arch + fi + + if reprepro --waitforlock 6 -b $REPO_DIR -C $BRANCH include $DISTRIB ${ROOT_DIR}/${PACKAGE}_${VERSION}_$changearch.changes + then + sendxmpppy "✔️ Completed build for ${PACKAGE}/${VERSION} for $DISTRIB/$BRANCH/$arch." + else + sendxmpppy "❌ Failed to include change of ${PACKAGE}/${VERSION} for $DISTRIB/$BRANCH/$arch ?!" fi done } @@ -78,14 +86,24 @@ function build() { local arch=$1 - if [[ "$arch" == "all" ]] + local opts="" + + opts+=" -d $DISTRIB" + opts+=" --no-run-lintian" + opts+=" --no-run-piuparts" + opts+=" --no-run-autopkgtest" + + if [[ "$arch" != "all" ]] then - local arch_opt="" - else - local arch_opt="--host=$arch" + opts+=" --host=$arch" fi - - sbuild $arch_opt -d $DISTRIB # --anything-failed-commands='%s' + + if [[ -n "$DEBUG" ]] + then + opts+="--anything-failed-commands='%s'" + fi + + sbuild $opts } diff --git a/scripts/make-chroots b/scripts/make-chroots index 1d7506f..0ca5cd6 100755 --- a/scripts/make-chroots +++ b/scripts/make-chroots @@ -1,11 +1,8 @@ #!/bin/bash +DIST=$1 +PREINSTALL="eatmydata,ccache,build-essential,perl-openssl-defaults,debhelper,cmake,wget,devscripts,git,aptitude,debhelper,dh-python,python3-all,python3-yaml,python3-jinja2,python3-setuptools,python3-psutil,lua5.1,liblua5.1-0-dev,libidn11-dev,libssl-dev,txt2man,quilt,npm,nodejs" +mkdir -p /home/vinaigrette/.chroots/ -# FIXME : to be replaced with - -# sbuild-createchroot --include=eatmydata,ccache $DIST /some/location -# sbuild-createchroot --include=eatmydata,ccache --arch=$ARCH $DIST /some/location -# + check how to preinstall dependencies - - +sbuild-createchroot --include=$PREINSTALL $DIST /home/vinaigrette/.chroots/$DIST-all diff --git a/scripts/ynh-custom-builds b/scripts/ynh-custom-builds index f19aa20..ed44e42 100755 --- a/scripts/ynh-custom-builds +++ b/scripts/ynh-custom-builds @@ -73,7 +73,7 @@ function tweak_gevent-websocket() function tweak_metronome() { - readonly VERSION="$(dpkg-parsechangelog -S Version 2>/dev/null)+ynh$DISTRIB_N-1" + readonly VERSION="$(dpkg-parsechangelog -S Version 2>/dev/null)+ynh$DISTRIB_N" } function build()