Added tests from audio-overlay in case we want to use them here.

master
audiodef 1 year ago
parent dd2e5ddb92
commit 9384f1892e

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Get all non-live ebuilds that are in the git tree and emerge all of them in a clean stage3
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
EBUILDS=($(git ls-files | grep -e "\.ebuild$" | egrep -v '.+9999(-r[0-9]+)?.ebuild'))
echo "Emerging the following ebuilds: ${EBUILDS[@]}"
# Emerge the ebuilds in a clean stage3
"${SCRIPT_PATH}/emerge-ebuild.sh" "${EBUILDS[@]}"

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Get all live ebuilds that are in the git tree and emerge all of them in a clean stage3
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
EBUILDS=($(git ls-files | egrep -e '.+9999(-r[0-9]+)?.ebuild$'))
echo "Emerging the following ebuilds: ${EBUILDS[@]}"
# Emerge the ebuilds in a clean stage3
"${SCRIPT_PATH}/emerge-ebuild.sh" "${EBUILDS[@]}"

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Emerge a specific ebuild in a clean stage3
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
if [ "$#" -eq 0 ]; then
echo "Usage: $0 <ebuild category>/<ebuild name>/<ebuild filename>.ebuild [<second ebuild category>/<second ebuild name>/<second ebuild filename>.ebuild]" >&2
exit 1
fi
# Create volume container named "portage" with today's gentoo tree in it
# Ensure the portage image is up to date
docker pull gentoo/portage
# Clean up in case an old volume container exists
docker rm -f portage || true
# Create the new volume container
docker create --name portage gentoo/portage
# Ensure the stage3 image is up to date
docker pull gentoo/stage3
# Emerge the ebuild in a clean stage3
docker run --rm -ti \
-e GITHUB_TOKEN \
-e CIRCLECI \
-e CIRCLE_PROJECT_USERNAME \
-e CIRCLE_PROJECT_REPONAME \
-e CIRCLE_PULL_REQUEST \
-e CIRCLE_PR_NUMBER \
-e DEBUG \
--cap-add=SYS_PTRACE \
--volumes-from portage \
-v "${HOME}/.portage-pkgdir":/var/cache/binpkgs \
-v "${PWD}":/usr/local/portage \
-w /usr/local/portage \
gentoo/stage3 \
/usr/local/portage/tests/resources/emerge-ebuild.sh "${@}"

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Determine which ebuilds are new or changed and emerge them in a clean stage3
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
IFS=" " read -ra EBUILDS <<< "$("${SCRIPT_PATH}/get-new-or-changed-ebuilds.sh")"
if [ ${#EBUILDS[@]} -eq 0 ]; then
echo "No changed ebuilds found, skipping emerge tests"
else
echo "Emerging the following ebuilds:" "${EBUILDS[@]}"
"${SCRIPT_PATH}/emerge-ebuild.sh" "${EBUILDS[@]}"
fi

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Emerge a random non-live ebuild out of all the ebuilds in the overlay in a clean stage3
# Used to do continuous tests if our ebuilds still work
# as well as make sure the binary package cache is updated on our CI service
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
# Pick a random non-live ebuild
EBUILD=$(find . -regex '.*\.ebuild$' -printf '%P\n' | egrep -v '.+9999(-r[0-9]+)?.ebuild' | shuf -n1)
${SCRIPT_PATH}/emerge-ebuild.sh "${EBUILD}"

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Emerge a random live ebuild out of all the ebuilds in the overlay in a clean stage3
# Used to do continuous tests if our ebuilds still work
# as well as make sure the binary package cache is updated on our CI service
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
# Pick a random live ebuild
EBUILD=$(find . -regextype egrep -regex '.+9999(-r[0-9]+)?.ebuild' -printf '%P\n' | shuf -n1)
${SCRIPT_PATH}/emerge-ebuild.sh "${EBUILD}"

@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Determine which packages/ebuilds are new or changed
# If there are changes to .ebuild files return the list of changed ebuilds
# If there are no changes to .ebuild files determine which package(s) is/are changed
# and return all of the .ebuild files for those package(s)
# All ebuilds need to be returned because there is no way to determine which specific ebuild is impacted
# by a change to for example files/patches or metadata changes
# If no changed .ebuild files or changed packages can be found return nothing
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
# This uses master... to only include the changes introduced in the current branch and exclude new changes in master
# because we only want to test ebuild changes introduced in the the current branch
if [[ -n "${CIRCLECI}" ]]; then
# For some reason CircleCI does some crazy stuff with git/master which breaks the normal git workflow :|
# See https://discuss.circleci.com/t/checkout-script-adds-commits-to-master-from-circle-branch/14194
# So we hard reset master here to make it usable again
git checkout master > /dev/null 2>&1
git reset --hard origin/master > /dev/null 2>&1
git checkout - > /dev/null 2>&1
DIFF_REFS="master...${CIRCLE_BRANCH}"
else
DIFF_REFS="master..."
fi
# Get ebuild files that are changed
EBUILDS=($(git diff --name-only --diff-filter=d "${DIFF_REFS}" | grep '\.ebuild$')) || true
# If no ebuild files are changed check if there are any other changes to packages
if [ ${#EBUILDS[@]} -eq 0 ]; then
# Ignore everything that's not a package by only picking up paths that are >= 3 levels deep
# This excludes everything, except for some stuff in the "tests" directory, so explicitly exclude the "tests" directory
PACKAGES=($(git diff --name-only --diff-filter=d "${DIFF_REFS}" ':!tests' | awk -F/ '{if (NF>=3) print $1"/"$2;}' | sort -u)) || true
for PACKAGE in "${PACKAGES[@]}"
do
shopt -s nullglob
EBUILDS+=(${PACKAGE}/*.ebuild)
done
fi
echo "${EBUILDS[@]}"

@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Check if a new version of any of the projects in this overlay is released
# Will create an issue requesting a version bump if a new version is found
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
docker run --rm -ti \
-e GITHUB_API_TOKEN \
-v "${PWD}/tests/resources/newversionchecker.toml":/app/newversionchecker.toml \
simonvanderveldt/newversionchecker

@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Determine which ebuilds are new or changed and run repoman on their packages
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
PACKAGES=""
# Get list of new or changed packages
IFS=" " read -ra EBUILDS <<< "$("${SCRIPT_PATH}/get-new-or-changed-ebuilds.sh")"
mapfile -t PACKAGES < <(for EBUILD in "${EBUILDS[@]}"; do dirname "${EBUILD}"; done | sort -u)
if [ ${#PACKAGES[@]} -eq 0 ]; then
echo "No changed packages found, skipping repoman check"
else
echo "Running repoman on the following packages:" "${PACKAGES[@]}"
"${SCRIPT_PATH}/repoman.sh" "${PACKAGES[@]}"
fi

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Run repoman in a clean stage3
# Pass package names to only run against these packages, otherwise runs agains the whole overlay
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
SCRIPT_PATH=$(dirname "$0")
# Create volume container named "portage" with today's gentoo tree in it
# Ensure the portage image is up to date
docker pull gentoo/portage
# Clean up in case an old volume container exists
docker rm -f portage || true
# Create the new volume container
docker create --name portage gentoo/portage
# Ensure the stage3 image is up to date
docker pull gentoo/stage3
# Run the repoman tests in a clean stage3
docker run --rm -ti \
-e GITHUB_TOKEN \
-e CIRCLECI \
-e CIRCLE_PROJECT_USERNAME \
-e CIRCLE_PROJECT_REPONAME \
-e CIRCLE_PULL_REQUEST \
-e CIRCLE_PR_NUMBER \
-e DEBUG \
--volumes-from portage \
-v "${HOME}/.portage-pkgdir":/var/cache/binpkgs \
-v "${PWD}":/usr/local/portage \
-w /usr/local/portage \
gentoo/stage3 \
/usr/local/portage/tests/resources/repoman.sh "${@}"

@ -0,0 +1,116 @@
#!/usr/bin/env bash
# Tests emering of one or multiple ebuilds, installs dependencies first
# Takes the path to an ebuild or a list of ebuild paths as argument(s)
# Sources ebuild specific config from ./packages/<category>/<PN>.conf and
# ./packages/<category>/<P>.conf if those files exist
# Depends on qatom from app-portage/portage-utils
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
if [ "$#" -eq 0 ]; then
echo "Usage: $0 <ebuild category>/<ebuild name>/<ebuild filename>.ebuild [<second ebuild category>/<second ebuild name>/<second ebuild filename>.ebuild]" >&2
exit 1
fi
# Enable binpkg-multi-instance mainly for keeping binpkgs built with different USE flags
# Disable news messages from portage as well as the IPC, network and PID sandbox to get rid of the
# "Unable to unshare: EPERM" messages without requiring the container to be run in privileged mode
# Disable rsync output
export FEATURES="binpkg-multi-instance parallel-install -news -ipc-sandbox -network-sandbox -pid-sandbox"
export PORTAGE_RSYNC_EXTRA_OPTS="-q"
# Don't store any elogs by default
export PORTAGE_ELOG_SYSTEM="echo"
# Use 4 jobs to speedup emerges
# CircleCI's large VMs have 4 CPUs and 15GB of memory
# -j4 doesn't sature the CPUs so increase it by 1
echo 'MAKEOPTS="-j5"' >> /etc/portage/make.conf
# Only enable intel so LLVM doesn't get pulled in
echo 'VIDEO_CARDS="intel"' >> /etc/portage/make.conf
# Disable LLVM support in mesa
echo "media-libs/mesa -llvm" > /etc/portage/package.use/audio-overlay
# Ensure we use dev-lang/rust-bin
echo "dev-lang/rust" > /etc/portage/package.mask/audio-overlay
# Show emerge info for troubleshooting purposes
emerge --info
# Emerge utilities/tools used by this script
emerge -q --buildpkg --usepkg app-portage/portage-utils
# Set portage's distdir to /tmp/distfiles
# This is a workaround for a bug in portage/git-r3 where git-r3 can't
# create the distfiles/git-r3 directory when no other distfiles have been
# downloaded by portage first, which happens when using binary packages
# https://bugs.gentoo.org/481434
export DISTDIR="/tmp/distfiles"
# Setup overlay
mkdir -p /etc/portage/repos.conf
cat > /etc/portage/repos.conf/localrepo.conf <<EOF
[audio-overlay]
location = /usr/local/portage
EOF
# Emerge the ebuilds in a clean stage3
EBUILD_PATHS=("${@}")
for EBUILD_PATH in "${EBUILD_PATHS[@]}"
do
echo "Emerging ${EBUILD_PATH}"
EBUILD_FILENAME=$(basename "${EBUILD_PATH}" ".ebuild")
EBUILD_CATEGORY="${EBUILD_PATH%%/*}"
EBUILD="${EBUILD_CATEGORY}/${EBUILD_FILENAME}"
# Source ebuild specific env vars
unset ACCEPT_KEYWORDS
unset USE
PKG_CATEGORY=$(qatom -F "%{CATEGORY}" ${EBUILD})
PKG_NAME=$(qatom -F "%{PN}" ${EBUILD})
PKG_FULL_NAME=$(qatom -F "%{PF}" ${EBUILD})
# Source versionless config
if [ -f "./tests/resources/packages/${PKG_CATEGORY}/${PKG_NAME}.conf" ]; then
source "./tests/resources/packages/${PKG_CATEGORY}/${PKG_NAME}.conf"
fi
# Source version specific config
if [ -f "./tests/resources/packages/${PKG_CATEGORY}/${PKG_FULL_NAME}.conf" ]; then
source "./tests/resources/packages/${PKG_CATEGORY}/${PKG_FULL_NAME}.conf"
fi
# Emerge dependencies first
echo "Emerging dependencies"
emerge --tree --quiet-build --buildpkg --usepkg --onlydeps --autounmask=y --autounmask-continue=y "=${PKG_CATEGORY}/${PKG_FULL_NAME}"
# Emerge the ebuild itself
echo "Emerging ${EBUILD}"
# Store QA elogs for the ebuild we're testing
PORTAGE_ELOG_SYSTEM="save_summary:qa echo" emerge -v "=${PKG_CATEGORY}/${PKG_FULL_NAME}"
if [[ -f /var/log/portage/elog/summary.log ]]; then
cat /var/log/portage/elog/summary.log >> /tmp/qa.log
else
echo "${EBUILD}: No QA issues found" >> /tmp/qa.log
fi
rm -f /var/log/portage/elog/summary.log
# Unmerge ebuild in case we're emerging multiple ebuilds to prevent blocking other ebuilds
if (( ${#EBUILD_PATHS[@]} > 1 )); then
emerge -c "=${PKG_CATEGORY}/${PKG_FULL_NAME}"
fi
done
# Post QA result as comment on PR when running on CI
if [[ -n "${CIRCLE_PULL_REQUEST}" ]]; then
# Install dependencies
emerge -q --buildpkg --usepkg dev-vcs/git dev-python/pip
pip install --user https://github.com/simonvanderveldt/travis-github-pr-bot/archive/master.zip
PATH="${HOME}/.local/bin:$PATH"
cat /tmp/qa.log | travis-bot --description "Portage QA results:"
else
cat /tmp/qa.log
fi

@ -0,0 +1,28 @@
github_repo = "gentoo-audio/audio-overlay"
check_interval = 24
[projects]
adlplug = "https://github.com/jpcima/adlplug"
artyfx = "https://github.com/openAVproductions/openAV-ArtyFX"
bitrot = "https://github.com/grejppi/bitrot"
cadence = "https://github.com/falkTX/Cadence"
carla = "https://github.com/falkTX/Carla"
deteriorate-lv2 = "https://github.com/blablack/deteriorate-lv2"
distrho-ports = "https://github.com/DISTRHO/DISTRHO-Ports"
drumkv1 = "https://github.com/rncbc/drumkv1"
ladish = "https://github.com/LADI/ladish"
libmonome = "https://github.com/monome/libmonome"
luppp = "https://github.com/openAVproductions/openAV-Luppp"
mididings = "https://github.com/dsacre/mididings"
nekobi = "https://github.com/DISTRHO/Nekobi"
new-session-manager = "https://github.com/linuxaudio/new-session-manager"
ntk = "https://github.com/gentoo-audio/ntk"
padthv1 = "https://github.com/rncbc/padthv1"
pure-data = "https://github.com/pure-data/pure-data"
samplv1 = "https://github.com/rncbc/samplv1"
sc3-plugins = "https://github.com/supercollider/sc3-plugins"
sequencer64 = "https://github.com/ahlstromcj/sequencer64"
serialosc = "https://github.com/monome/serialosc"
setbfree = "https://github.com/pantherb/setBfree"
sorcer = "https://github.com/openAVproductions/openAV-Sorcer"
synthv1 = "https://github.com/rncbc/synthv1"

@ -0,0 +1,8 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-plugins/adlplug lv2
media-libs/mesa -llvm
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
EOF

@ -0,0 +1,4 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
x11-libs/cairo X
dev-cpp/cairomm X
EOF

@ -0,0 +1,8 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-plugins/distrho-ports lv2 vst
media-libs/mesa -llvm
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
EOF

@ -0,0 +1,7 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-libs/mesa -llvm
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
EOF

@ -0,0 +1,8 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-plugins/opnplug lv2
media-libs/mesa -llvm
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
EOF

@ -0,0 +1,8 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-libs/mesa -llvm
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1"
EOF

@ -0,0 +1,11 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
x11-libs/cairo X
media-libs/mesa -llvm
dev-qt/qtgui -gif -udev -libinput
EOF
cat >/etc/portage/make.conf <<EOF
VIDEO_CARDS="intel"
CPU_FLAGS_X86="sse mmxext mmx"
USE="-png"
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/drumkv1 standalone lv2
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/mididings jack
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/new-session-manager gui jack
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/padthv1 standalone lv2
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/pure-data jack
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/samplv1 standalone lv2
EOF

@ -0,0 +1,5 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
x11-libs/cairo X
dev-cpp/cairomm X
media-sound/sequencer64 jack
EOF

@ -0,0 +1,3 @@
cat >/etc/portage/package.use/audio-overlay <<EOF
media-sound/synthv1 standalone lv2
EOF

@ -0,0 +1,47 @@
#!/usr/bin/env bash
# "Lint" using repoman if any ebuilds have basic issues
# In case of a PR the result is added as a comment to the PR
set -e
if [ "${DEBUG}" = True ]; then
set -x
fi
# Enable binpkg-multi-instance mainly for keeping binpkgs built with different USE flags
# Disable news messages from portage as well as the IPC, network and PID sandbox to get rid of the
# "Unable to unshare: EPERM" messages without requiring the container to be ran in priviliged mode
# Also disable rsync's output
export FEATURES="binpkg-multi-instance parallel-install -news -ipc-sandbox -network-sandbox -pid-sandbox" PORTAGE_RSYNC_EXTRA_OPTS="-q"
# Ensure we use dev-lang/rust-bin
echo "dev-lang/rust" > /etc/portage/package.mask/audio-overlay
# Install dependencies
emerge -q --buildpkg --usepkg dev-vcs/git app-portage/repoman dev-python/pip
pip install --user https://github.com/simonvanderveldt/travis-github-pr-bot/archive/master.zip
PATH="${HOME}/.local/bin:$PATH"
REPOMAN_OUTPUT=""
REPOMAN_EXITCODES=0
if [[ -n "${1}" ]]; then
IFS=' ' read -ra PACKAGES <<< "${@}"
for PACKAGE in "${PACKAGES[@]}"
do
pushd "${PACKAGE}"
REPOMAN_OUTPUT+="${PACKAGE}: $(repoman full -d -q)\n" || REPOMAN_EXITCODES+=${?}
popd
done
else
REPOMAN_OUTPUT+=$(repoman full -d -q) || REPOMAN_EXITCODES+=${?}
fi
echo -e "${REPOMAN_OUTPUT}"
# Post repoman output as comment on PR when running on CI
if [[ -n "${CIRCLE_PULL_REQUEST}" ]]; then
echo -e "${REPOMAN_OUTPUT}" | travis-bot --description "Repoman QA results:"
fi
if (( REPOMAN_EXITCODES > 0 )); then
exit 1
fi
Loading…
Cancel
Save