From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6B6B1138350 for ; Thu, 30 Apr 2020 22:54:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7E5A7E0A6E; Thu, 30 Apr 2020 22:54:17 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41258E0A6E for ; Thu, 30 Apr 2020 22:54:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ED02F34F0BF for ; Thu, 30 Apr 2020 22:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1B15C1EB for ; Thu, 30 Apr 2020 22:54:14 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1588226699.943e1a71819f93c595bbfe5583d4a92baa25dd34.mattst88@gentoo> Subject: [gentoo-commits] proj/releng:master commit in: tools/ X-VCS-Repository: proj/releng X-VCS-Files: tools/catalyst-auto X-VCS-Directories: tools/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 943e1a71819f93c595bbfe5583d4a92baa25dd34 X-VCS-Branch: master Date: Thu, 30 Apr 2020 22:54:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 30ef507c-795e-49da-81f1-98e10967d9e3 X-Archives-Hash: 41c5b499a4dbd3baccad72955e4ab2a5 commit: 943e1a71819f93c595bbfe5583d4a92baa25dd34 Author: Matt Turner gentoo org> AuthorDate: Thu Apr 30 04:49:10 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Thu Apr 30 06:04:59 2020 +0000 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=943e1a71 catalyst-auto: Support sqfs snapshots Signed-off-by: Matt Turner gentoo.org> tools/catalyst-auto | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tools/catalyst-auto b/tools/catalyst-auto index 66ff5ecc..f8258545 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -279,7 +279,24 @@ run_catalyst_commands() { fi fi - TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ) + if catalyst --help | grep -q "git-treeish"; then + snapshot_log=$(mktemp --tmpdir="${TMP_PATH:-/tmp}") + if ! run_cmd "${snapshot_log}" catalyst -c "${CATALYST_CONFIG}" -s stable; then + send_email "Catalyst build error - snapshot" "" "${snapshot_log}" + exit 1 + fi + + read TREEISH gitdir <<<$(egrep -o 'Creating .* tree snapshot [0-9a-f]{40} from .*' "${snapshot_log}" | cut -d' ' -f5,7) + TIMESTAMP=$(git -C "${gitdir}" show --no-patch --format=%cd --date=format:%Y%m%dT%H%M%SZ "${TREEISH}") + else + TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ) + + snapshot_log=$(mktemp --tmpdir="${TMP_PATH:-/tmp}") + if ! run_cmd "${snapshot_log}" catalyst -c "${CATALYST_CONFIG}" -s "${TIMESTAMP}"; then + send_email "Catalyst build error - snapshot" "" "${snapshot_log}" + exit 1 + fi + fi TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" "catalyst-auto.${TIMESTAMP}.XXXXXX") # Nuke any previous tmpdirs to keep them from accumulating. @@ -297,6 +314,7 @@ run_catalyst_commands() { echo "Couldn't create tempdirs!" exit 1 fi + mv "${snapshot_log}" "${TMPDIR}/log/snapshot.log" if ! run_cmd "${TMPDIR}/log/pre_build.log" pre_build; then send_email "Catalyst build error - pre_build" "The pre_build function failed" "${TMPDIR}/log/pre_build.log" @@ -334,10 +352,15 @@ run_catalyst_commands() { done fi + if [[ -n ${TREEISH} ]]; then + sed -i -e "s|snapshot:.*|snapshot_treeish: ${TREEISH}|g" "${i}" + fi + # Expand vars that the spec expects us to. sed -i \ -e "s:@TIMESTAMP@:${TIMESTAMP}:g" \ -e "s:@REPO_DIR@:${REPO_DIR}:g" \ + -e "s:@TREEISH@:${TREEISH}:g" \ "${i}" done @@ -358,12 +381,6 @@ run_catalyst_commands() { popd >/dev/null fi - # Create snapshot - if ! run_cmd "${TMPDIR}/log/snapshot.log" catalyst -c "${CATALYST_CONFIG}" -s "${TIMESTAMP}"; then - send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log" - exit 1 - fi - build_failure=0 timeprefix=()