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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 81185158089 for ; Sun, 8 Oct 2023 23:07:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AA17A2BC027; Sun, 8 Oct 2023 23:07:55 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 85AE62BC027 for ; Sun, 8 Oct 2023 23:07:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 47386335C5D for ; Sun, 8 Oct 2023 23:07:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E6F484A2 for ; Sun, 8 Oct 2023 23:07:52 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1696806373.6c75b00db7184b652ff12086a036d5081617d470.robbat2@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: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 6c75b00db7184b652ff12086a036d5081617d470 X-VCS-Branch: master Date: Sun, 8 Oct 2023 23:07:52 +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: 7f119594-5914-4e36-8a55-43453081dc09 X-Archives-Hash: e3b2cd771932bd3bc7b4d273b14c02a5 commit: 6c75b00db7184b652ff12086a036d5081617d470 Author: Robin H. Johnson gentoo org> AuthorDate: Sun Oct 8 23:06:13 2023 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Sun Oct 8 23:06:13 2023 +0000 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=6c75b00d copy_buildsync: fix tempfile for OUT_ISO & OUT_STAGE, plus comments Signed-off-by: Robin H. Johnson gentoo.org> scripts/copy_buildsync.sh | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh index ac56f7f7..851ccb57 100755 --- a/scripts/copy_buildsync.sh +++ b/scripts/copy_buildsync.sh @@ -154,14 +154,21 @@ process_arch() { [ -z "${latest_iso_date}" ] && latest_iso_date="NONE-FOUND" [ -z "${latest_stage3_date}" ] && latest_stage3_date="NONE-FOUND" + + OUT_ISO_tmp="" + OUT_STAGE3_tmp="" if [ -n "${iso_list}" ]; then - echo -e "${header}" >"${OUT_ISO}" + OUT_ISO_tmp=$(mktemp -p . -t ".${OUT_ISO}.XXXXXX") + chmod 644 "${OUT_ISO_tmp}" + echo -e "${header}" >"${OUT_ISO_tmp}" # Some arches produce more than one type of iso. # So let's not advertise a current one via a symlink in general. rm -f current-iso fi if [ -n "${stage3_list}" ]; then - echo -e "${header}" >"${OUT_STAGE3}" + OUT_STAGE3_tmp=$(mktemp -p . -t ".${OUT_STAGE3}.XXXXXX") + chmod 644 "${OUT_STAGE3_tmp}" + echo -e "${header}" >"${OUT_STAGE3_tmp}" # Ditto for stage3 rm -f current-stage3 fi @@ -177,25 +184,37 @@ process_arch() { for v in $variants ; do # FIXME: trace the $a variable in this! + # example output 20230907T160230Z/install-alpha-minimal-20230907T160230Z.iso variant_path=$(find 20* -iname "${v}-20*" "${find_variants[@]}" -print 2>/dev/null | sed -e "s,.*/$a/autobuilds/,,g" | sort -k1,1 -t/ | tail -n1 ) if [ -z "${variant_path}" ] || [ ! -e "${variant_path}" ]; then echo "$ARCH: Variant ${v} is missing" 1>&2 continue fi + variant_date="${variant_path%/*}" + variant_base="${variant_path#*/}" size=$(stat --format='%s' "${variant_path}") f="latest-${v}.txt" f_tmp=$(mktemp -p . -t ".${f}.XXXXXX") chmod 644 "${f_tmp}" echo -e "${header}" >"${f_tmp}" echo -e "${variant_path} ${size}" >>"${f_tmp}" - [[ ${variant_path} =~ tar.*$ ]] && echo -e "${variant_path} ${size}" >>"${OUT_STAGE3}" # FIXME: tempfile - [[ ${variant_path} =~ iso$ ]] && echo -e "${variant_path} ${size}" >>"${OUT_ISO}" # FIXME: tempfile + [[ ${variant_path} =~ tar.*$ ]] && echo -e "${variant_path} ${size}" >>"${OUT_STAGE3_tmp}" + [[ ${variant_path} =~ iso$ ]] && echo -e "${variant_path} ${size}" >>"${OUT_ISO_tmp}" rm -f "current-$v" ln -sf "${variant_path%/*}" "current-$v" + + # Update keepfile echo "${variant_path}" | sed -e 's,/.*,,g' -e 's,^,/,g' -e 's,$,$,g' >>"${keepfile_tmp}" + + # Place latest-*txt into place in the base arch dir. mv -f "${f_tmp}" "${f}" + done + # Atomic move these files if created. + [[ -n "${OUT_ISO_tmp}" ]] && [[ -f "${OUT_ISO_tmp}" ]] && mv "${OUT_ISO_tmp}" "${OUT_ISO}" + [[ -n "${OUT_STAGE3_tmp}" ]] && [[ -f "${OUT_STAGE3_tmp}" ]] && mv "${OUT_STAGE3_tmp}" "${OUT_STAGE3}" + # Refresh keepfile mv -f "${keepfile_tmp}" "${keepfile}"