Nove to new layout

This commit is contained in:
Mario Fetka
2014-11-02 09:42:47 +01:00
parent 68d6318910
commit 250a08b5dd
124 changed files with 5211 additions and 1623 deletions

23
tinderbox/antimatter-scheduler Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
unset PORTAGE
unset PORTAGE_TMPDIR
set -e
if [ "${#}" != "3" ]; then
echo "Invalid arguments." >&2
exit 1
fi
CHROOT_PATH="${1}"
ARCH_NAME="${2}"
CHROOT_PREFIX="${3}"
(
${CHROOT_PREFIX} chroot "${CHROOT_PATH}" \
/sabayon/bin/antimatter-digest
) | mail -a "MIME-Version: 1.0" \
-a "Content-Type: text/html" \
-s "AntiMatter tracker of $(date +%Y-%m-%d) for ${ARCH_NAME}" \
entropy-team@lists.sabayon.org

21
tinderbox/glsa-scheduler Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
unset PORTAGE
unset PORTAGE_TMPDIR
set -e
if [ "${#}" != "3" ]; then
echo "Invalid arguments." >&2
exit 1
fi
CHROOT_PATH="${1}"
ARCH_NAME="${2}"
CHROOT_PREFIX="${3}"
(
${CHROOT_PREFIX} chroot "${CHROOT_PATH}" \
/sabayon/bin/glsa-digest 2>&1
) | mail -s "GLSA tracker of $(date +%Y-%m-%d) for ${ARCH_NAME}" \
entropy-team@lists.sabayon.org

94
tinderbox/matter-build.sh Executable file
View File

@@ -0,0 +1,94 @@
#!/bin/bash
show_help() {
echo "${0} <schedule> <pre-chroot (linux32, linux64)> <chroot dir> <chroot name>"
}
ARGS="${@}"
schedule="${1}"
if [ "${schedule}" != "weekly" ] && [ "${schedule}" != "monthly" ] && [ "${schedule}" != "daily" ]; then
echo "schedule is invalid, must be either weekly, monthly, daily"
show_help
exit 1
fi
PRE_CHROOT="${2}"
if [ "${PRE_CHROOT}" != "linux32" ] && [ "${PRE_CHROOT}" != "linux64" ]; then
echo "pre-chroot is invalid, must be either linux32, linux64"
show_help
exit 1
fi
CHROOT_DIR="${3}"
if [ -z "${CHROOT_DIR}" ] || [ ! -d "${CHROOT_DIR}" ]; then
echo "chroot dir is invalid"
show_help
exit 1
fi
CHROOT_NAME="${4:-unknown}"
shift 4
LOCK_FILE="${CHROOT_DIR}/.matter-build.lock"
LVM_LOCK_FILE="/entropy_LOCKS/vg_chroots-lv_chroots-snapshot.lock"
LOG_FILE=/var/log/particles/$(basename "${CHROOT_DIR}")-${schedule}-$(date +%Y%m%d).log
# Make sure th have these directories in place
mkdir -p /var/log/particles /entropy_LOCKS || exit 1
# Drop these settings from the environment as they could interfere
# with interactive processing
unset PORTDIR PORTAGE_TMPDIR
echo "CHROOT_DIR: ${CHROOT_DIR}"
echo "PRE_CHROOT: ${PRE_CHROOT}"
echo "LOG_FILE: ${LOG_FILE}.bz2"
echo "Acquiring locks at ${LOCK_FILE} and ${LVM_LOCK_FILE} in blocking mode, waiting until we're ready"
(
flock -s --timeout=$((3600 * 12)) 10
if [ "${?}" != "0" ]; then
echo "Tried to acquire the LVM lock in shared mode." >&2
echo "After 12 hours, I give up. This is really wrong," >&2
echo "since the backup script should not hold the lock for" >&2
echo "this long." >&2
exit 1
fi
flock -x --timeout=36000 9
rc="${?}"
if [ "${rc}" != "0" ]; then
echo "CANNOT ACQUIRE LOCK, QUITTING" >&2
else
echo "Lock acquired, let's go"
echo "Starting matter-scheduler at $(date)..."
export ETP_NO_COLOR="1"
pre_post="--pre /particles/hooks/pre.sh --post /particles/hooks/post.sh"
# Place standard outout and standard error together to make
# tee happy. Filter out stdout because it gets to mail
PARTICLES_DIR="/particles/${schedule}" \
MATTER_ARGS="--commit --blocking --gentle --disable-preserved-libs ${pre_post} ${@}" "${PRE_CHROOT}" \
/build/tinderbox/matter-scheduler "${CHROOT_DIR}" 2>&1 3>&1 | tee "${LOG_FILE}" > /dev/null
rc=${?}
echo "Completed matter-scheduler at $(date) with exit status: ${rc}"
fi
bzip2 -f -k "${LOG_FILE}"
# send mail
echo "Hello boys and girls,
this is andromeda.sabayon.org informing you that a new matter run has been
eventually executed.
Call : ${ARGS}
Exit : ${rc}
Log : ${LOG_FILE}.bz2
Do not forget to check logs before touching repositories.
Thanks for reading." | mutt -s "${schedule} matter run, $(basename ${LOG_FILE})" -a "${LOG_FILE}.bz2" -- entropy-team@lists.sabayon.org
# spawn GLSA and ignore any failures
/build/tinderbox/glsa-scheduler "${CHROOT_DIR}" "${CHROOT_NAME}" "${PRE_CHROOT}" > /dev/null
# spawn AntiMatter and ignore any failures
/build/tinderbox/antimatter-scheduler "${CHROOT_DIR}" "${CHROOT_NAME}" "${PRE_CHROOT}" > /dev/null
exit ${rc}
) 9> "${LOCK_FILE}" 10> "${LVM_LOCK_FILE}"

64
tinderbox/matter-scheduler Executable file
View File

@@ -0,0 +1,64 @@
#!/usr/bin/python
import os
import sys
import argparse
import subprocess
if __name__ == "__main__":
DEFAULT_PARTICLES_DIR = "/particles"
PARTICLES_DIR = os.getenv("PARTICLES_DIR", DEFAULT_PARTICLES_DIR)
DEFAULT_BUILD_DIR = "/sabayon"
BUILD_DIR = os.getenv("BUILD_GIT_DIR", DEFAULT_BUILD_DIR)
DEFAULT_MATTER_ARGS = "--commit --gentle --push --sync --sync-best-effort"
MATTER_ARGS = os.getenv("MATTER_ARGS", DEFAULT_MATTER_ARGS)
CHROOT_SCRIPT = "/sabayon/bin/matter-scheduler-chroot" # this is in build.git
ENV_VARS_HELP = """\
Environment variables:
%s = path inside chroot containing Matter spec files (also called particles)
default: %s
%s = path inside chroot containing the build.git repository checkout
default: %s
%s = custom "matter" arguments
default: %s
""" % (
"PARTICLES_DIR",
DEFAULT_PARTICLES_DIR,
"BUILD_GIT_DIR",
DEFAULT_BUILD_DIR,
"MATTER_ARGS",
DEFAULT_MATTER_ARGS,)
parser = argparse.ArgumentParser(
description='Entropy Matter, execution scheduler',
epilog=ENV_VARS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("chroot", metavar="<chroot>",
help="path to chroot")
nsargs = parser.parse_args(sys.argv[1:])
chroot_dir = nsargs.chroot
if not os.path.isdir(chroot_dir):
sys.stderr.write("chroot directory is not available\n")
raise SystemExit(1)
if os.getuid() != 0:
sys.stderr.write("root access required\n")
raise SystemExit(1)
os.environ["PARTICLES_DIR"] = PARTICLES_DIR
os.environ["BUILD_GIT_DIR"] = BUILD_DIR
os.environ["MATTER_ARGS"] = MATTER_ARGS
os.chroot(chroot_dir)
os.chdir("/")
try:
rc = subprocess.call(CHROOT_SCRIPT)
except Exception as err:
sys.stderr.write(repr(err) + "\n")
rc = 1
raise SystemExit(rc)