# Signed-off-by: Nic Boet # # update copyright header # # improve send_mail() because it acts more like the logger # * output failure events to stdout if verbose set, useful for those without a mailer # * do not email if recipient var is undef; allows flexibility for non-releng use cases # # do not source catalyst.conf as it's not bash syntax # * non-bash formatted lines are executed; results in several "command not found" errors # * instead, parse the file for the specific var # # make it more apparent that bash time is not used # # snapshot_cache was removed Apr 2020 # * catalyst commit 6493f3bc534f97468c514a12035b10e3107c4ecf # * --preclean would fail as catalyst.conf is invalid # --- ../releng/tools/catalyst-auto 2022-03-12 09:24:33.823162592 -0600 +++ tools/catalyst-auto 2022-03-12 22:36:43.362350405 -0600 @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 1999-2014 Gentoo Foundation +# Copyright 2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 CATALYST_CONFIG=/etc/catalyst/catalyst.conf @@ -53,8 +53,14 @@ } send_email() { + if [[ ${verbose} -ge 1 ]]; then + echo "$1 $2 build log at $3" + fi + [[ ${nonetwork} == 0 ]] || return + [[ ! -z ${EMAIL_TO} ]] || return + local subject="${EMAIL_SUBJECT_PREPEND} $1" local message=$2 local logfile=$3 @@ -113,8 +119,8 @@ catalyst_var() { # Extract a setting from the catalyst.conf. - local var=$1 - (. "${CATALYST_CONFIG}"; echo "${!var}") + local var=$(grep --color=never -Po "^${1}\s*=\s*\K.*" "${CATALYST_CONFIG}" || true) + [[ -z ${var} ]] || echo "${var}" } trigger_post_build() { @@ -323,14 +282,9 @@ if [[ ${preclean} == 1 ]]; then rm -rf "${TMP_PATH:-/tmp}/catalyst-auto".* - snapshot_cache=$(catalyst_var snapshot_cache) - if [[ -z ${snapshot_cache} ]]; then - echo "error: snapshot_cache not set in config file" - exit 1 - fi pushd "${BUILD_SRCDIR_BASE}" >/dev/null || exit 1 rm -rf --one-file-system \ - kerncache packages snapshots tmp "${snapshot_cache}"/* + kerncache packages snapshots tmp popd >/dev/null fi @@ -421,8 +375,13 @@ build_failure=0 - timeprefix=() - which time >/dev/null && timeprefix=( "time" ) + # bash built-in time function is not used + if ! which time >/dev/null ; then + timeprefix=() + echo "sys-process/time is optional for build resource utilization" + else + timeprefix=( "time" ) + fi JOB_PIDS=() JOB_RETS=()