From ddc6307dd99d33f096b1a107ceb26ac3f6958d32 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 10 Jan 2022 02:07:43 +0100 Subject: [PATCH 1/2] WIP: simplify the madness --- chroots/.gitkeep | 0 chroots/make-chroots | 64 ------------- config/config | 33 +------ config/distributions | 2 - config/pbuilder/pbuilder.conf | 18 ---- config/rebuildd.conf | 21 ----- config/rebuildd.default | 8 -- config/sources.list | 1 - init.sh | 37 ++------ nodesource.gpg | 52 ----------- scripts/build_deb | 92 ++++++++++--------- scripts/make-chroots | 11 +++ scripts/package_helpers.sh | 60 ------------ scripts/pbuilder/build-sources | 24 ----- scripts/pbuilder/hooks/B90lintian | 18 ---- scripts/pbuilder/hooks/D70apt-update | 2 - .../pbuilder/hooks/D80patch-yunohost-admin | 19 ---- scripts/pbuilder/keyrings/nodesource.gpg | 52 ----------- scripts/rebuildd-job | 71 -------------- scripts/rebuildd/build-binaries | 43 --------- scripts/rebuildd/get-sources | 9 -- scripts/rebuildd/upload-binaries | 54 ----------- scripts/repo/include-changes | 30 ------ scripts/repo/process-include | 44 --------- ynh-build | 4 +- 25 files changed, 70 insertions(+), 699 deletions(-) delete mode 100644 chroots/.gitkeep delete mode 100755 chroots/make-chroots delete mode 100644 config/pbuilder/pbuilder.conf delete mode 100644 config/rebuildd.conf delete mode 100644 config/rebuildd.default delete mode 100644 config/sources.list delete mode 100644 nodesource.gpg create mode 100755 scripts/make-chroots delete mode 100644 scripts/package_helpers.sh delete mode 100755 scripts/pbuilder/build-sources delete mode 100644 scripts/pbuilder/hooks/B90lintian delete mode 100755 scripts/pbuilder/hooks/D70apt-update delete mode 100755 scripts/pbuilder/hooks/D80patch-yunohost-admin delete mode 100644 scripts/pbuilder/keyrings/nodesource.gpg delete mode 100755 scripts/rebuildd-job delete mode 100755 scripts/rebuildd/build-binaries delete mode 100755 scripts/rebuildd/get-sources delete mode 100755 scripts/rebuildd/upload-binaries delete mode 100755 scripts/repo/include-changes delete mode 100755 scripts/repo/process-include diff --git a/chroots/.gitkeep b/chroots/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/chroots/make-chroots b/chroots/make-chroots deleted file mode 100755 index cb6b3f1..0000000 --- a/chroots/make-chroots +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# For some reason, building chroots for buster from stretch requires libdebian-installer4 0.119 instead of 0.110 -# c.f. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904699 ... installed it by manually downloading and dpkg -i the .deb - -readonly DISTRIB=bullseye -readonly INIT_DIR=$PWD -readonly ARCHS="amd64" -#readonly ARCHS="i386 armhf armel arm64" -#readonly ARCHS="arm64" - -function main() -{ - for ARCH in $ARCHS - do - build_chroot $ARCH - done -} - -function build_chroot() -{ - local ARCH=$1 - local CHROOT=chroot-${DISTRIB}-${ARCH} - - echo "" - echo "Starting build for $ARCH" - echo "" - - cd /tmp/ - cdebootstrap --arch=${ARCH} --foreign ${DISTRIB} ./$CHROOT http://deb.debian.org/debian/ - cp /usr/bin/qemu-arm-static $CHROOT/usr/bin/ - cp /usr/bin/qemu-aarch64-static $CHROOT/usr/bin/ - cp /etc/resolv.conf $CHROOT/etc/resolv.conf - - chroot $CHROOT apt update - chroot $CHROOT apt dist-upgrade - chroot $CHROOT apt install -y build-essential debhelper cmake wget devscripts git aptitude - - # Install build depends for yunohost etc - chroot $CHROOT apt install -y debhelper devscripts dh-python python3-all python3-yaml python3-jinja2 python3-setuptools python3-psutil - chroot $CHROOT apt install -y lua5.1 liblua5.1-dev libidn11-dev libssl-dev txt2man quilt - - if [ "$ARCH" == "amd64" ]; - then - # This is for building yunohost-admin - chroot $CHROOT apt install -y npm nodejs - # Don't ask me why, but stupid nodejs wants to look for stuff inside /lib instead of /usr/lib ... - # This only happens when building those chroot ... I don't know why ... - chroot $CHROOT ln -s /usr/lib/nodejs /lib/nodejs - chroot $CHROOT npm install -g npm@latest - fi - - chroot $CHROOT apt clean - - cd $CHROOT - echo "Now creating tarball with the filesystem ..." - tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./* - - echo "" - echo "Output chroot archive should be available as $INIT_DIR/${DISTRIB}-${ARCH}.tgz" - echo "" -} - -main diff --git a/config/config b/config/config index d644314..e88e111 100644 --- a/config/config +++ b/config/config @@ -1,38 +1,13 @@ #!/bin/bash -# Identity - -DEBSIGN_KEYID=59A3E6FF -DEBFULLNAME="YunoHost Contributors" -DEBEMAIL="contrib@yunohost.org" MAIL="rebuildd@yunohost.org" -REPO_URL="forge.yunohost.org" - -# Codenames, components and architectures - -AVAILABLE_CODENAMES="buster bullseye" -AVAILABLE_COMPONENTS="stable testing unstable extra" -AVAILABLE_ARCH="amd64 i386 armel armhf arm64" - -DEFAULT_COMPONENT="unstable" -DEFAULT_ARCH="amd64" - -# Folders... HOME_VINAIGRETTE="/home/vinaigrette" GIT_REPOS="$HOME_VINAIGRETTE/gitrepos/" -REPO_DIR="/var/www/repo/debian" - -PBUILDER_HOME="$HOME_VINAIGRETTE/scripts/pbuilder/" -PBUILDER_CHROOTS="$HOME_VINAIGRETTE/chroots/" -PBUILDER_RESULTS="$PBUILDER_HOME/result" -DAILY_PACKAGES="$PBUILDER_HOME/packages/" -PBUILDER_CONF="$HOME_VINAIGRETTE/config/pbuilder/" - -# Scripts - -BUILD_SOURCES="$PBUILDER_HOME/build-sources" BUILD_DEB="$HOME_VINAIGRETTE/scripts/build_deb" -INCLUDE_CHANGES="$HOME_VINAIGRETTE/scripts/repo/include-changes" +REPO_URL="forge.yunohost.org" +REPO_DIR="/var/www/repo/debian" +REPO_CONFIG=$REPO_DIR/config/distributions +REPO_ARCHS="$(grep "Architectures" $REPO_CONFIG | head -n 1 | awk -F: '{print $2}' | sed 's/source//g')" diff --git a/config/distributions b/config/distributions index 485758a..92d90de 100644 --- a/config/distributions +++ b/config/distributions @@ -10,7 +10,6 @@ Description: YunoHost repository for Debian Buster SignWith: 59A3E6FF Tracking: all includechanges keepsources Log: logfile - --changes --via=include /home/vinaigrette/scripts/repo/process-include Origin: YunoHost Label: YunoHost for Bullseye @@ -24,4 +23,3 @@ Description: YunoHost repository for Debian Bullseye SignWith: 83BD9E70 Tracking: all includechanges keepsources Log: logfile - --changes --via=include /home/vinaigrette/scripts/repo/process-include diff --git a/config/pbuilder/pbuilder.conf b/config/pbuilder/pbuilder.conf deleted file mode 100644 index 4ea069a..0000000 --- a/config/pbuilder/pbuilder.conf +++ /dev/null @@ -1,18 +0,0 @@ -# this is your configuration file for pbuilder. -# the file in /usr/share/pbuilder/pbuilderrc is the default template. -# /etc/pbuilderrc is the one meant for overwriting defaults in -# the default template -# -# read pbuilderrc.5 document for notes on specific options. - -# default distribution -DISTRIBUTION="buster" - -# default location for the user hooks directory -HOOKDIR="/home/vinaigrette/scripts/pbuilder/hooks/" - -# main mirror site for Debian -MIRRORSITE="http://cdn.debian.net/debian" - -# extra packages which the system should install -EXTRAPACKAGES="lintian" diff --git a/config/rebuildd.conf b/config/rebuildd.conf deleted file mode 100644 index fb5b130..0000000 --- a/config/rebuildd.conf +++ /dev/null @@ -1,21 +0,0 @@ -[build] -check_every = 30 -max_threads = 1 -max_jobs = 5 -kill_timeout = 90 -source_cmd = /home/vinaigrette/scripts/rebuildd/get-sources ${d} ${p} ${v} -build_cmd = /home/vinaigrette/scripts/rebuildd/build-binaries ${d} ${p} ${v} ${a} -post_build_cmd = /home/vinaigrette/scripts/rebuildd/upload-binaries ${d} ${p} ${v} ${a} ${j} -dists = buster bullseye -work_dir = /var/cache/rebuildd/build -database_uri = sqlite:///var/lib/rebuildd/rebuildd.db -build_more_recent = 1 -more_archs = i386 armel armhf arm64 all any -no_system_arch = 0 - -[log] -file = /var/log/rebuildd/rebuildd.log -time_format = %Y-%m-%d %H:%M:%S -logs_dir = /var/log/rebuildd/build_logs -mail_failed = 0 -mail_successful = 0 diff --git a/config/rebuildd.default b/config/rebuildd.default deleted file mode 100644 index a275dcd..0000000 --- a/config/rebuildd.default +++ /dev/null @@ -1,8 +0,0 @@ -START_REBUILDD=1 -START_REBUILDD_HTTPD=0 -PBUILDER_BIN=/usr/sbin/pbuilder -PBUILDER_CACHE_PATH="/var/cache/pbuilder" -PBUILDER_MIRROR=https://ftp.debian.org/debian -ARCHS="amd64 i386 armel armhf arm64" -DISTS="buster bullseye" -ENABLE_BUILDER_MAINT=1 diff --git a/config/sources.list b/config/sources.list deleted file mode 100644 index 28c0829..0000000 --- a/config/sources.list +++ /dev/null @@ -1 +0,0 @@ -deb-src http://__REPO_URL__/debian stretch stable testing unstable extra diff --git a/init.sh b/init.sh index f4a2e9f..1186404 100755 --- a/init.sh +++ b/init.sh @@ -1,22 +1,16 @@ -apt-get install nginx pbuilder reprepro rebuildd gawk sendxmpp -y -apt-get install qemu-system-arm debootstrap cdebootstrap qemu-user-static -y +apt-get install nginx sbuild schroot reprepro gawk sendxmpp -y apt-get install python-virtualenv python3-pip -y apt-get install boxes -y -# Fix the damn pbuilder-satistydepends (aptitude causes segfault on ARM) -cd /usr/lib/pbuilder -rm pbuilder-satisfydepends -ln -s pbuilder-satisfydepends-apt pbuilder-satisfydepends - VINAIGRETTE_HOME="/home/vinaigrette" cd $VINAIGRETTE_HOME source config/config -ln -s /root/keys config/keys -gpg --import config/keys/$DEBSIGN_KEYID.key -gpg --import config/keys/$DEBSIGN_KEYID.pub +#ln -s /root/keys config/keys +#gpg --import config/keys/$DEBSIGN_KEYID.key +#gpg --import config/keys/$DEBSIGN_KEYID.pub mkdir gitrepos cd gitrepos/ @@ -25,32 +19,13 @@ git clone https://github.com/yunohost/yunohost-admin git clone https://github.com/yunohost/ssowat SSOwat git clone https://github.com/yunohost/moulinette git clone https://github.com/yunohost/metronome -git clone https://github.com/YunoHost/rspamd -git clone https://git.donarmstrong.com/unscd.git +#git clone https://github.com/YunoHost/rspamd +#git clone https://git.donarmstrong.com/unscd.git mkdir -p /var/www/repo/debian/conf/ ln -s $VINAIGRETTE_HOME/config/distributions /var/www/repo/debian/conf/distributions -rm /etc/rebuildd/rebuilddrc -ln -s $VINAIGRETTE_HOME/config/rebuildd.conf /etc/rebuildd/rebuilddrc -rm /etc/default/rebuildd -ln -s $VINAIGRETTE_HOME/config/rebuildd.default /etc/default/rebuildd - -ln -s $VINAIGRETTE_HOME/chroots /var/cache/pbuilder/chroots -ln -s /var/cache/pbuilder/result $PBUILDER_RESULTS - -rm -f /etc/pbuilderrc -ln -s $PBUILDER_CONF/pbuilder.conf /etc/pbuilderrc - cp $VINAIGRETTE_HOME/config/nginx.conf /etc/nginx/sites-enabled/repo.conf - -cat $VINAIGRETTE_HOME/config/keys/$DEBSIGN_KEYID.pub | apt-key add -cat $VINAIGRETTE_HOME/config/sources.list > /etc/apt/sources.list.d/vinaigrette.list - sed -i "s/__REPO_URL__/$REPO_URL/g" /etc/nginx/sites-enabled/repo.conf -sed -i "s/__REPO_URL__/$REPO_URL/g" /etc/apt/sources.list.d/vinaigrette.list - echo "127.0.0.1 $REPO_URL" >> /etc/hosts service nginx reload - -rebuildd init diff --git a/nodesource.gpg b/nodesource.gpg deleted file mode 100644 index 1dc1d10..0000000 --- a/nodesource.gpg +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 -Comment: GPGTools - https://gpgtools.org - -mQINBFObJLYBEADkFW8HMjsoYRJQ4nCYC/6Eh0yLWHWfCh+/9ZSIj4w/pOe2V6V+ -W6DHY3kK3a+2bxrax9EqKe7uxkSKf95gfns+I9+R+RJfRpb1qvljURr54y35IZgs -fMG22Np+TmM2RLgdFCZa18h0+RbH9i0b+ZrB9XPZmLb/h9ou7SowGqQ3wwOtT3Vy -qmif0A2GCcjFTqWW6TXaY8eZJ9BCEqW3k/0Cjw7K/mSy/utxYiUIvZNKgaG/P8U7 -89QyvxeRxAf93YFAVzMXhoKxu12IuH4VnSwAfb8gQyxKRyiGOUwk0YoBPpqRnMmD -Dl7SdmY3oQHEJzBelTMjTM8AjbB9mWoPBX5G8t4u47/FZ6PgdfmRg9hsKXhkLJc7 -C1btblOHNgD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MO7yBy/2JE15 -ZJgl7lXKLQ31VQPAHT3an5IV2C/ie12eEqZWlnCiHV/wT+zhOkSpWdrheWfBT+ac -hR4jDH80AS3F8jo3byQATJb3RoCYUCVc3u1ouhNZa5yLgYZ/iZkpk5gKjxHPudFb -DdWjbGflN9k17VCf4Z9yAb9QMqHzHwIGXrb7ryFcuROMCLLVUp07PrTrRxnO9A/4 -xxECi0l/BzNxeU1gK88hEaNjIfviPR/h6Gq6KOcNKZ8rVFdwFpjbvwHMQBWhrqfu -G3KaePvbnObKHXpfIKoAM7X2qfO+IFnLGTPyhFTcrl6vZBTMZTfZiC1XDQLuGUnd -sckuXINIU3DFWzZGr0QrqkuE/jyr7FXeUJj9B7cLo+s/TXo+RaVfi3kOc9BoxIvy -/qiNGs/TKy2/Ujqp/affmIMoMXSozKmga81JSwkADO1JMgUy6dApXz9kP4EE3g== -=CLGF ------END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/build_deb b/scripts/build_deb index 4ab32b9..837a2ae 100755 --- a/scripts/build_deb +++ b/scripts/build_deb @@ -8,11 +8,9 @@ readonly FOLDER=$3 source /home/vinaigrette/config/config source /home/vinaigrette/scripts/common.sh -export DEBSIGN_KEYID -export DEBFULLNAME -export DEBEMAIL - -readonly IMG="${PBUILDER_CHROOTS}/${DISTRIB}-amd64.tgz" +#export DEBSIGN_KEYID +#export DEBFULLNAME +#export DEBEMAIL # ##### # # Usage # @@ -26,65 +24,69 @@ Usage: $THISSCRIPT Arguments: - buster or bullseye - stable, testing, or unstable - the folder in which to build... + buster or bullseye + stable, testing, or unstable + the folder in which to build... EOF } function main() { - validate_arguments - retrieve_package_info - build_sources - add_to_reprepro + grep -q "^Codename: $DISTRIB$" $REPO_CONFIG || critical "Invalid distribution $DISTRIB" + grep -q "^Components: .*$BRANCH.*$" $REPO_CONFIG || critical "Invalid branch $BRANCH" + [[ -n "$FOLDER" ]] || critical "Need a folder in which to build" - success "Build will start soon. See 'rebuildd-job list | tail'" - sendxmpppy "➕ Added build for ${PACKAGE}/${VERSION} for ${DISTRIB}/${BRANCH} ..." -} - -# ################# # -# Check user inputs # -# ################# # - -function validate_arguments() -{ - [[ $DISTRIB =~ ^buster|bullseye$ ]] || critical "Invalid distribution $DISTRIB" - [[ $BRANCH =~ ^testing|stable|unstable$ ]] || critical "Invalid branch $BRANCH" - [[ ! -z "$FOLDER" ]] || critical "Need a folder in which to build" -} - -function retrieve_package_info() -{ readonly PKG_DIR=$(readlink -fn $FOLDER) readonly ROOT_DIR=$(readlink -fn ${PKG_DIR}/../) cd $PKG_DIR readonly PACKAGE=$(dpkg-parsechangelog | awk '/^Source: / {print $2}') readonly VERSION=$(dpkg-parsechangelog | awk '/^Version: / {print $2}') - readonly CHANGES_FILE=${ROOT_DIR}/${PACKAGE}_${VERSION}_source.changes + + 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 + then + archs="all" + else + archs="$REPO_ARCHS" + fi + + for arch in $archs + do + 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" + fi + + if reprepro --waitforlock 6 -b $REPO_DIR -C $BRANCH include $DISTRIB ${ROOT_DIR}/${PACKAGE}_${VERSION}_$arch.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 } -# ######################################## # -# Invoke pbuilder to build the sources ... # -# ######################################## # -function build_sources() +function build() { - boxed "Building source package of ${PACKAGE} ${VERSION} ..." + local arch=$1 - pbuilder execute --bindmounts ${ROOT_DIR} --basetgz ${IMG} -- ${BUILD_SOURCES} $PKG_DIR \ - || { sendxmpppy "❌ Failed to build source package for $PACKAGE"; critical "An error occured while building source package"; } - - [[ -f ${CHANGES_FILE} ]] || { sendxmpppy "❌ Failed to build source package for $PACKAGE"; critical "An error occured while building source package (no change file available)"; } + if [[ "$arch" == "all" ]] + then + local arch_opt="" + else + local arch_opt="--host=$arch" + fi + + sbuild $arch_opt -d $DISTRIB # --anything-failed-commands='%s' } -function add_to_reprepro() -{ - boxed "Adding ${PACKAGE}_${VERSION} to ${DISTRIB}/${BRANCH}..." - - $INCLUDE_CHANGES $DISTRIB $BRANCH $CHANGES_FILE || { sendxmpppy "❌ Failed to include changes for source package $PACKAGE"; critical "An error occured while including source package"; } -} [[ "$1" =~ ^-h|--help$ ]] && (usage; exit 0) || main diff --git a/scripts/make-chroots b/scripts/make-chroots new file mode 100755 index 0000000..1d7506f --- /dev/null +++ b/scripts/make-chroots @@ -0,0 +1,11 @@ +#!/bin/bash + + + +# 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 + + diff --git a/scripts/package_helpers.sh b/scripts/package_helpers.sh deleted file mode 100644 index 5d7caac..0000000 --- a/scripts/package_helpers.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# Get Files entries from a given .changes or .dsc file -get_files() -{ - file=$(readlink -fn $1) - echo $(awk '/^Files:/,EOF' $file | gawk '/^ [a-z0-9]{32} / {print $5}') -} - -# Get Distribution entry from a given .changes or .dsc file -get_distribution() -{ - file=$(readlink -fn $1) - echo $(awk '/^Distribution:/ {print $2}' $file) -} - -# Get Architecture entry from a given .changes or .dsc file -get_architecture() -{ - file=$(readlink -fn $1) - echo $(awk '/^Architecture:/ {print $2}' $file) -} - -# Extract Debian codename and YunoHost distribution if present. -# It should be something like wheezy-stable -extract_codename_distribution() -{ - if [[ $1 = *-* ]]; then - [[ $1 = "old-stable" ]] && return 0 - - i=0 - for p in `echo "$1" | tr "-" "\n"`; do - case $i in - 0) - if [[ $p =~ ^stretch$ ]]; then - CODENAME=$p - else - echo "invalid Debian codename $p" - return 1 - fi - ;; - 1) - if [[ $p =~ ^stable|testing|unstable$ ]]; then - DISTRIBUTION=$p - else - echo "invalid distribution $p" - return 2 - fi - ;; - *) - echo "unexpected string '$p' (i=$i)" - return 3 - esac - i=`expr $i + 1` - done - elif ! [[ $1 =~ ^stable|testing|unstable$ ]]; then - echo "invalid distribution '$1'" - return 4 - fi -} diff --git a/scripts/pbuilder/build-sources b/scripts/pbuilder/build-sources deleted file mode 100755 index 1701885..0000000 --- a/scripts/pbuilder/build-sources +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PKG_PATH=$1 - -apt-get -q update --allow-releaseinfo-change - -cd $PKG_PATH - -echo "--------------------------------" -echo "Installing build-dependencies..." - -LOG="/var/log/mk-build-deps.log" -mk-build-deps -i -t "apt-get --no-install-recommends -y" >> $LOG 2>&1 \ - || { echo "mk-build-deps failed, logs are in $LOG"; exit 1; } -rm -f *build-deps*_all.deb - -echo "--------------------------------" -echo "Creating source package..." - -# Creating source package without signing it -debuild --no-lintian -S -sa -uc - -# Be sure to clean directory -debclean diff --git a/scripts/pbuilder/hooks/B90lintian b/scripts/pbuilder/hooks/B90lintian deleted file mode 100644 index fb10742..0000000 --- a/scripts/pbuilder/hooks/B90lintian +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -#install_packages() { -# apt-get -y "${APTGETOPT[@]}" install "$@" -#} -# -#install_packages lintian - -echo "+++ lintian output +++" - -#su -c "lintian -I --show-overrides /tmp/buildd/*.changes" - pbuilder -# use this version if you don't want lintian to fail the build -su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" - pbuilder - -echo "+++ end of lintian output +++" - diff --git a/scripts/pbuilder/hooks/D70apt-update b/scripts/pbuilder/hooks/D70apt-update deleted file mode 100755 index 58a85e4..0000000 --- a/scripts/pbuilder/hooks/D70apt-update +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -/usr/bin/apt-get update --allow-releaseinfo-change diff --git a/scripts/pbuilder/hooks/D80patch-yunohost-admin b/scripts/pbuilder/hooks/D80patch-yunohost-admin deleted file mode 100755 index 90920d8..0000000 --- a/scripts/pbuilder/hooks/D80patch-yunohost-admin +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# -# Dirty hook to npm install, because I have no idea how this -# is supposed to be done properly -# (no network during the actual build) -# - -if ls -d /build/yunohost-admin* >dev/null 2>&1 -then - echo "========================" - echo "Starting npm install ..." - echo "========================" - mkdir /nonexistent - chown pbuilder:pbuilder /nonexistent - cd /build/yunohost-admin*/app - su pbuilder -c "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin npm --progress false ci" -fi - diff --git a/scripts/pbuilder/keyrings/nodesource.gpg b/scripts/pbuilder/keyrings/nodesource.gpg deleted file mode 100644 index 1dc1d10..0000000 --- a/scripts/pbuilder/keyrings/nodesource.gpg +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 -Comment: GPGTools - https://gpgtools.org - -mQINBFObJLYBEADkFW8HMjsoYRJQ4nCYC/6Eh0yLWHWfCh+/9ZSIj4w/pOe2V6V+ -W6DHY3kK3a+2bxrax9EqKe7uxkSKf95gfns+I9+R+RJfRpb1qvljURr54y35IZgs -fMG22Np+TmM2RLgdFCZa18h0+RbH9i0b+ZrB9XPZmLb/h9ou7SowGqQ3wwOtT3Vy -qmif0A2GCcjFTqWW6TXaY8eZJ9BCEqW3k/0Cjw7K/mSy/utxYiUIvZNKgaG/P8U7 -89QyvxeRxAf93YFAVzMXhoKxu12IuH4VnSwAfb8gQyxKRyiGOUwk0YoBPpqRnMmD -Dl7SdmY3oQHEJzBelTMjTM8AjbB9mWoPBX5G8t4u47/FZ6PgdfmRg9hsKXhkLJc7 -C1btblOHNgDx19fzASWX+xOjZiKpP6MkEEzq1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31VQPAHT3an5IV2C/ie12eEqZWlnCiHV/wT+zhOkSpWdrheWfBT+ac -hR4jDH80AS3F8jo3byQATJb3RoCYUCVc3u1ouhNZa5yLgYZ/iZkpk5gKjxHPudFb -DdWjbGflN9k17VCf4Z9yAb9QMqHzHwIGXrb7ryFcuROMCLLVUp07PrTrRxnO9A/4 -xxECi0l/BzNxeU1gK88hEaNjIfviPR/h6Gq6KOcNKZ8rVFdwFpjbvwHMQBWhrqfu -G3KaePvbnObKHXpfIKoAM7X2qfO+IFnLGTPyhFTcrl6vZBTMZTfZiC1XDQLuGUnd -sckuXINIU3DFWzZGr0QrqkuE/jyr7FXeUJj9B7cLo+s/TXo+RaVfi3kOc9BoxIvy -/qiNGs/TKy2/Ujqp/affmIMoMXSozKmga81JSwkADO1JMgUy6dApXz9kP4EE3g== -=CLGF ------END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/rebuildd-job b/scripts/rebuildd-job deleted file mode 100755 index a214b5a..0000000 --- a/scripts/rebuildd-job +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python -from rebuildd.Rebuildd import Rebuildd -from rebuildd.RebuilddConfig import RebuilddConfig -from rebuildd.Package import Package -from rebuildd.JobStatus import JobStatus -from rebuildd.Job import Job -from tabulate import tabulate -import sys, os.path -import argparse - -def main(): - - actions = { - "list": list_, - "add": add_ - } - - parser = argparse.ArgumentParser(description='A simple script to list and add rebuildd jobs, not shit like the original rebuildd-job :|.', - usage='''rebuildd-job - -The available commands are : - list - Lists the most recent jobs - add - Add a specific job (for example to requeue a job that failed ...) -''') - - parser.add_argument('action', help="Action to run") - if len(sys.argv) < 2: - parser.print_help() - exit(1) - - args = parser.parse_args(sys.argv[1:2]) - - if not args.action in actions.keys(): - print "Unrecognized action" - parser.print_help() - exit(1) - else: - Rebuildd() - actions[args.action]() - - -def list_(): - - parser = argparse.ArgumentParser(description='Lists the most recent jobs') - parser.add_argument('N', nargs="?", help="Number of jobs to list (10 by default)", default=10) - args = parser.parse_args(sys.argv[2:]) - - try: - args.N = int(args.N) - except: - raise AssertionError("Invalid value for N, not an integer ?") - - jobs = Job.selectBy()[-args.N:] - - headers = [ "id", "package", "version", "dist", "arch", "status" ] - data = [ [ job.id, job.package.name, job.package.version, job.dist, job.arch, JobStatus.whatis(job.status)] for job in jobs ] - - print tabulate(data, headers=headers) - - -def add_(): - parser = argparse.ArgumentParser(description='Lists the most recent jobs') - parser.add_argument('package') - parser.add_argument('version') - parser.add_argument('dist') - parser.add_argument('arch') - args = parser.parse_args(sys.argv[2:]) - - Rebuildd().add_job(args.package, args.version, "10", args.dist, mailto=None, arch=args.arch) - -main() diff --git a/scripts/rebuildd/build-binaries b/scripts/rebuildd/build-binaries deleted file mode 100755 index 9820ac2..0000000 --- a/scripts/rebuildd/build-binaries +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -codename=$1 -package=$2 -version=$3 -arch=$4 - -sendxmpppy "⏳ Starting build for ${package}/${version} for arch=$arch ..." - -source /home/vinaigrette/config/config -source /home/vinaigrette/scripts/package_helpers.sh - -if [[ $arch == all ]]; then arch=$DEFAULT_ARCH; fi - -if [[ $arch == $DEFAULT_ARCH ]]; then - # Build architecture independent packages too - DEBBUILDOPTS="-b" -else - # Build only binary-only limited to architecture dependent packages - DEBBUILDOPTS="-B" -fi - -# Format needed pbuilder arguments -DSC_FILE="${package}_${version}.dsc" -BASE_TGZ="${PBUILDER_CHROOTS}/${codename}-${arch}.tgz" - -echo "######################" -echo " Starting build ... " -echo "######################" - -echo "Running 'pbuilder build --basetgz $BASE_TGZ --debbuildopts $DEBBUILDOPTS $DSC_FILE" - -pbuilder build \ - --basetgz "$BASE_TGZ" \ - --architecture $arch \ - --debbuildopts "$DEBBUILDOPTS" \ - $DSC_FILE - -exit_code=$? - -[[ $exit_code == 0 ]] || sendxmpppy "❌ Failed build for ${package}/${version} for arch=$arch ?!" - -exit $exit_code diff --git a/scripts/rebuildd/get-sources b/scripts/rebuildd/get-sources deleted file mode 100755 index d88fae8..0000000 --- a/scripts/rebuildd/get-sources +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -codename=$1 -package=$2 -version=$3 - -apt-get update --allow-releaseinfo-change > /dev/null 1>&1 -apt-get -q --download-only --only-source \ - source ${package}=${version} diff --git a/scripts/rebuildd/upload-binaries b/scripts/rebuildd/upload-binaries deleted file mode 100755 index f82bfa6..0000000 --- a/scripts/rebuildd/upload-binaries +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -p - -codename=$1 -CODENAME=$1 -package=$2 -version=$3 -arch=$4 -job=$5 - -source /home/vinaigrette/config/config -source /home/vinaigrette/scripts/package_helpers.sh - -# Architecture independent packages are built on default arch -ARCH=$arch -[[ $arch == all ]] && ARCH=$DEFAULT_ARCH - -# Resulting changes file -CHANGES_FILE=$PBUILDER_RESULTS/${package}_${version}_${ARCH}.changes - -# Retrieve distribution/component -DISTRIBUTION=$(get_distribution $CHANGES_FILE) - -# Attempt to extract Debian codename from Distribution -extract_codename_distribution $DISTRIBUTION || exit 1 - -# Retrieving component from source package -get_source_component() { - reprepro -b $REPO_DIR -T dsc --list-max 1 --list-format '${$component}' \ - listfilter $CODENAME "\$Source (==${package}), \$SourceVersion (==${version})" -} -COMPONENT=$(get_source_component) -[ -n "$COMPONENT" ] || echo "Unable to retrieve source package component" - -echo "#########################" -echo " Adding binary package..." -echo "#########################" - -# Include changes to the given repo (waiting 1m max) -echo "Adding to $CODENAME/$COMPONENT..." - -reprepro --waitforlock 6 -b $REPO_DIR -C $COMPONENT include $CODENAME $CHANGES_FILE > /dev/null - -status=$? -if [ $status -eq 0 ]; then - # Clean pbuilder results - for f in $(get_files $CHANGES_FILE); do - rm -f /var/cache/pbuilder/result/$f - done - sendxmpppy "✔️ Completed build for ${package}/${version} for ${CODENAME}/${COMPONENT}/${arch}." -else - sendxmpppy "❌ Failed to include change of ${package}/${version} for ${CODENAME}/${COMPONENT}/${arch} ?!" -fi - -exit $status diff --git a/scripts/repo/include-changes b/scripts/repo/include-changes deleted file mode 100755 index a2c32f0..0000000 --- a/scripts/repo/include-changes +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -codename=$1 -distribution=$2 -changes_file=$3 - -source /home/vinaigrette/config/config -source /home/vinaigrette/scripts/package_helpers.sh - -# Fucking ugly manual patch because when building packages for buster, the Binary: field is missing... -if ! grep -q "Binary:" $changes_file -then - # We take is from the .dsc file - DSC=$(echo $changes_file | sed 's/_source.changes/.dsc/g') - echo $(grep "Binary:" $DSC) >> $changes_file -fi - -reprepro -C $distribution -V -b $REPO_DIR include $codename $changes_file -RET=$? - -# Cleaning files -if [ $RET -eq 0 ]; then - dir=$(cd `dirname $changes_file` && pwd) - for f in $(get_files ${changes_file}); do - ! [[ $f =~ \.orig\.tar\.(gz|xz)$ ]] && rm -f ${dir}/$f - done - rm -f $changes_file -fi - -exit $RET diff --git a/scripts/repo/process-include b/scripts/repo/process-include deleted file mode 100755 index ae92ad4..0000000 --- a/scripts/repo/process-include +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -action=$1 -codename=$2 -package=$3 -version=$4 -changes_file=$5 - -source /home/vinaigrette/config/config -source /home/vinaigrette/scripts/package_helpers.sh - -# Only care about packages being added -if [[ $action != accepted ]]; then - exit 1 -fi - -# Only care about source packages -arch=$(get_architecture $changes_file) -if [[ $arch != source ]]; then - exit 0 -fi - -# Retrieve the .dsc file -dsc_file=$(dirname ${changes_file})/${package}_${version}.dsc -if [ ! -f $dsc_file ]; then - echo "Unable to find the .dsc file" - exit 1 -fi - -# Retrieve architecture from the .dsc -arch=$(awk '/^Architecture: / {print $2}' ${dsc_file}) -if [[ $arch =~ -?any ]]; then - source /etc/default/rebuildd - - # Add all architectures supported by rebuildd - arch=$ARCHS -fi - -# Kick off the job -for a in $arch; do - /home/vinaigrette/scripts/rebuildd-job add $package $version $codename $a -done - -exit 0 diff --git a/ynh-build b/ynh-build index dc7882a..725b990 100755 --- a/ynh-build +++ b/ynh-build @@ -36,8 +36,8 @@ EOF function validate_arguments() { [[ $PROJECT =~ ^yunohost|yunohost-admin|moulinette|SSOwat$ ]] || critical "Invalid project $PROJECT" - [[ $BRANCH =~ ^testing|stable|unstable$ ]] || critical "Invalid branch $BRANCH" - [[ $DISTRIB =~ ^stretch|buster$ ]] || critical "Invalid distribution $DISTRIB" + grep -q "^Codename: $DISTRIB$" $REPO_CONFIG || critical "Invalid distribution $DISTRIB" + grep -q "^Components: .*$BRANCH.*$" $REPO_CONFIG || critical "Invalid branch $BRANCH" [[ ! -z "$VERSION" ]] || critical "Invalid version $VERSION" [[ "$(tty)" != "not a tty" ]] || critical "You aint in a tty (are you in a 'lxc exec' ?) The script can't run because pbuilder won't be happy :|" } From 93ef7cdf83d41840dd0055eacb873b950513c7e6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 10 Jan 2022 21:50:21 +0100 Subject: [PATCH 2/2] 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()