mirror of
https://github.com/YunoHost/vinaigrette.git
synced 2024-09-03 20:06:11 +02:00
92 lines
2.3 KiB
Bash
Executable file
92 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
readonly THISSCRIPT=$0
|
|
readonly DISTRIB=$1
|
|
readonly BRANCH=$2
|
|
readonly FOLDER=$3
|
|
|
|
source /home/vinaigrette/config/config
|
|
source /home/vinaigrette/scripts/common.sh
|
|
|
|
#export DEBSIGN_KEYID
|
|
#export DEBFULLNAME
|
|
#export DEBEMAIL
|
|
|
|
# ##### #
|
|
# Usage #
|
|
# ##### #
|
|
|
|
function usage()
|
|
{
|
|
cat << EOF
|
|
|
|
Usage:
|
|
$THISSCRIPT <distrib> <branch> <folder>
|
|
|
|
Arguments:
|
|
<distrib> buster or bullseye
|
|
<branch> stable, testing, or unstable
|
|
<folder> the folder in which to build...
|
|
EOF
|
|
}
|
|
|
|
|
|
function main()
|
|
{
|
|
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"
|
|
|
|
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}')
|
|
|
|
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
|
|
}
|
|
|
|
|
|
function build()
|
|
{
|
|
local arch=$1
|
|
|
|
if [[ "$arch" == "all" ]]
|
|
then
|
|
local arch_opt=""
|
|
else
|
|
local arch_opt="--host=$arch"
|
|
fi
|
|
|
|
sbuild $arch_opt -d $DISTRIB # --anything-failed-commands='%s'
|
|
}
|
|
|
|
|
|
[[ "$1" =~ ^-h|--help$ ]] && (usage; exit 0) || main
|