Merge pull request #5 from YunoHost/simplify-the-madness

WIP: simplify the madness
This commit is contained in:
Alexandre Aubin 2022-01-10 22:07:50 +01:00 committed by GitHub
commit f5915fbcf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 87 additions and 701 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
chroots/*
.chroots
config/keys/*
gitrepos/*

View file

View file

@ -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

View file

@ -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/conf/distributions
REPO_ARCHS="$(grep "Architectures" $REPO_CONFIG | head -n 1 | awk -F: '{print $2}' | sed 's/source//g')"

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -1 +0,0 @@
deb-src http://__REPO_URL__/debian stretch stable testing unstable extra

37
init.sh
View file

@ -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

View file

@ -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+xOjZiKpP6MkEEzq1bilUFul6RDtxkTWsTa5TGixgCB/
G2fK8I9JL/yQhDc6OGY9mjPOxMb5PgUlT8ox3v8wt25erWj9z30QoEBwfSg4tzLc
Jq6N/iepQemNfo6Is+TG+JzI6vhXjlsBm/Xmz0ZiFPPObAH/vGCY5I6886vXQ7ft
qWHYHT8jz/R4tigMGC+tvZ/kcmYBsLCCI5uSEP6JJRQQhHrCvOX0UaytItfsQfLm
EYRd2F72o1yGh3yvWWfDIBXRmaBuIGXGpajC0JyBGSOWb9UxMNZY/2LJEwARAQAB
tB9Ob2RlU291cmNlIDxncGdAbm9kZXNvdXJjZS5jb20+iQI4BBMBAgAiBQJTmyS2
AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRAWVaCraFdigHTmD/9OKhUy
j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6dApXz9kP4EE3g==
=CLGF
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -4,16 +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
readonly IMG="${PBUILDER_CHROOTS}/${DISTRIB}-amd64.tgz"
# ##### #
# Usage #
# ##### #
@ -26,65 +21,90 @@ Usage:
$THISSCRIPT <distrib> <branch> <folder>
Arguments:
<distrib> buster or bullseye
<branch> stable, testing, or unstable
<folder> the folder in which to build...
<distrib> buster or bullseye
<branch> stable, testing, or unstable
<folder> the folder in which to build...
<archs> list of archs to build (or empty for autodetect). For example: amd63,armhf
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} ..."
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
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 [[ $arch == "all" ]]
then
changearch="amd64"
else
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
}
# ######################################## #
# 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"; }
local opts=""
[[ -f ${CHANGES_FILE} ]] || { sendxmpppy "❌ Failed to build source package for $PACKAGE"; critical "An error occured while building source package (no change file available)"; }
opts+=" -d $DISTRIB"
opts+=" --no-run-lintian"
opts+=" --no-run-piuparts"
opts+=" --no-run-autopkgtest"
if [[ "$arch" != "all" ]]
then
opts+=" --host=$arch"
fi
if [[ -n "$DEBUG" ]]
then
opts+="--anything-failed-commands='%s'"
fi
sbuild $opts
}
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

8
scripts/make-chroots Executable file
View file

@ -0,0 +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/
sbuild-createchroot --include=$PREINSTALL $DIST /home/vinaigrette/.chroots/$DIST-all

View file

@ -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
}

View file

@ -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

View file

@ -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 +++"

View file

@ -1,2 +0,0 @@
#!/bin/sh
/usr/bin/apt-get update --allow-releaseinfo-change

View file

@ -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

View file

@ -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+RbH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CRAWVaCraFdigIPQEACcYh8rR19wMZZ/hgYv5so6Y1HcJNARuzmffQKozS/rxqec
0xM3wceL1AIMuGhlXFeGd0wRv/RVzeZjnTGwhN1DnCDy1I66hUTgehONsfVanuP1
PZKoL38EAxsMzdYgkYH6T9a4wJH/IPt+uuFTFFy3o8TKMvKaJk98+Jsp2X/QuNxh
qpcIGaVbtQ1bn7m+k5Qe/fz+bFuUeXPivafLLlGc6KbdgMvSW9EVMO7yBy/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-----

View file

@ -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 <command> <args>
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()

View file

@ -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

View file

@ -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}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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()

View file

@ -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 :|"
}