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 C22CD138335 for ; Wed, 21 Nov 2018 19:13:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CC56BE0885; Wed, 21 Nov 2018 19:13:20 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 A63C6E0885 for ; Wed, 21 Nov 2018 19:13:20 +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 D0520335C63 for ; Wed, 21 Nov 2018 19:13:17 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id EBF5846A for ; Wed, 21 Nov 2018 19:13:15 +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: <1542827582.9fa4c8f32c637c88bf5c0b7b3259781aba1f68a6.mattst88@gentoo> Subject: [gentoo-commits] proj/releng:master commit in: scripts/ X-VCS-Repository: proj/releng X-VCS-Files: scripts/copy_buildsync.sh X-VCS-Directories: scripts/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 9fa4c8f32c637c88bf5c0b7b3259781aba1f68a6 X-VCS-Branch: master Date: Wed, 21 Nov 2018 19:13:15 +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: 609c2458-0554-4513-a74e-2ef2cffb897f X-Archives-Hash: 921da9691088f45be207e14c9fd698f4 commit: 9fa4c8f32c637c88bf5c0b7b3259781aba1f68a6 Author: Robin H. Johnson gentoo org> AuthorDate: Wed Nov 21 06:55:35 2018 +0000 Commit: Matt Turner gentoo org> CommitDate: Wed Nov 21 19:13:02 2018 +0000 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=9fa4c8f3 scripts/copy_buildsync: cleanup excludes of tempfile Signed-off-by: Matt Turner gentoo.org> Signed-off-by: Robin H. Johnson gentoo.org> scripts/copy_buildsync.sh | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh index 6c6085ff..815d21de 100755 --- a/scripts/copy_buildsync.sh +++ b/scripts/copy_buildsync.sh @@ -62,7 +62,7 @@ EOF # Copy artifacts for an arch to the outgoing directory. copy_arch_to_outgoing() { local ARCH=$1 indir=$2 outdir=$3 tmpdir=$4 - local i t rc + local i t rc timestamps if [[ ! -d ${indir} ]]; then # Nothing to do for this arch. @@ -70,21 +70,48 @@ copy_arch_to_outgoing() { fi # Copying - for i in $(find ${indir} -not -path '*/\.*' -type f | egrep -- '-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?' | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' | sort -ur); do + timestamps=( $( + find "${indir}" \ + -regextype posix-egrep \ + -type f \ + -regex '.*-20[0123][0-9]{5}(([0-9]{6})|(T[0-9]{6}Z))?.*' \ + \( -not -path '*/\.*' \) \ + | sed -e 's:^.*-\(20[^.]\+\).*$:\1:' \ + | sort -ur + ) ) + + for i in "${timestamps[@]}" ; do #echo "Doing $i" t="${outdir}/${i}" mkdir -p ${t} 2>/dev/null - rsync "${RSYNC_OPTS[@]}" --temp-dir=${tmpdir} --partial-dir=${tmpdir} ${indir}/ --filter '- **/.*' --filter "S *${i}*" --filter 'S **/' --filter 'H *' ${t} + rsync \ + "${RSYNC_OPTS[@]}" \ + --temp-dir="${tmpdir}" \ + --partial-dir="${tmpdir}" \ + --filter '- **/.*' \ + --filter "S *${i}*" \ + --filter 'S **/' \ + --filter 'H *' \ + ${indir}/ \ + ${t} rc=$? if [ $rc -eq 0 ]; then - find ${indir} -not -path '*/\.*' -type f -name "*${i}*" -print0 | xargs -0 --no-run-if-empty $DEBUGP rm $VERBOSEP -f + find "${indir}" \ + -type f \ + -name "*${i}*" \ + \( -not -path '*/\.*' \) \ + -print0 \ + | xargs -0 --no-run-if-empty \ + "$DEBUGP" rm "$VERBOSEP" -f else echo "Not deleting ${indir}/*${i}*, rsync failed!" 1>&2 fail=1 fi done find "${outdir}" \ - -depth -mindepth 1 -type d \ + -depth \ + -mindepth 1 \ + -type d \ -exec rmdir --ignore-fail-on-non-empty {} + }