From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EC55359CA5 for ; Tue, 22 Mar 2016 01:49:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B9A5721C014; Tue, 22 Mar 2016 01:48:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 10E7321C014 for ; Tue, 22 Mar 2016 01:48:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7944333FE7D for ; Tue, 22 Mar 2016 01:48:57 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 380AD85A for ; Tue, 22 Mar 2016 01:48:54 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1458538054.880a1aa775fd7cc6890074b1baab43ef4b29c31c.vapier@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: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 880a1aa775fd7cc6890074b1baab43ef4b29c31c X-VCS-Branch: master Date: Tue, 22 Mar 2016 01:48:54 +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-Archives-Salt: ab284b32-ecdb-496a-9b29-3f402ca1d7ef X-Archives-Hash: 68cd077c31fc6eb898905d8447434e41 commit: 880a1aa775fd7cc6890074b1baab43ef4b29c31c Author: Mike Frysinger gentoo org> AuthorDate: Mon Mar 21 05:27:34 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Mon Mar 21 05:27:34 2016 +0000 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=880a1aa7 catalyst-auto: add a preclean option to trim temp files This makes it easier to cronjob things w/out needing manual cleanup from time to time by people. tools/catalyst-auto | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/catalyst-auto b/tools/catalyst-auto index 70755d5..a018dc9 100755 --- a/tools/catalyst-auto +++ b/tools/catalyst-auto @@ -24,6 +24,7 @@ config_files=() verbose=0 keep_tmpdir=0 testing=0 +preclean=0 # Set pipefail so that run_cmd returns the right value in $? set -o pipefail @@ -41,6 +42,7 @@ Usage: Options: -c|--config Specifies the config file to use (required) + -C|--preclean Clean up loose artifacts from previous runs -v|--verbose Send output of commands to console as well as log -k|--keep-tmpdir Don't remove temp dir when build finishes -t|--test Stop after mangling specs and copying files @@ -119,6 +121,9 @@ do -t|--test) testing=1 ;; + -C|--preclean) + preclean=1 + ;; -*) usage "ERROR: You have specified an invalid option: ${a}" exit 1 @@ -149,6 +154,12 @@ BUILD_SRCDIR_BASE=$(catalyst_var storedir) TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" catalyst-auto.XXXXXX) DATESTAMP=$(date +%Y%m%d) +# Nuke any previous tmpdirs to keep them from accumulating. +if [[ ${preclean} -eq 1 ]]; then + rm -rf "${TMPDIR%.??????}".* + mkdir "${TMPDIR}" +fi + if [ ${verbose} = 1 ]; then echo "TMPDIR = ${TMPDIR}" echo "DATESTAMP = ${DATESTAMP}" @@ -225,6 +236,18 @@ if [ "${testing}" -eq 1 ]; then exit fi +if [[ ${preclean} -eq 1 ]]; then + 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}"/* + popd >/dev/null +fi + # Create snapshot if ! run_cmd "catalyst -c ${CATALYST_CONFIG} -s ${DATESTAMP}" "${TMPDIR}/log/snapshot.log"; then send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log"