From: "Matt Turner" <mattst88@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/releng:master commit in: scripts/
Date: Wed, 21 Nov 2018 19:13:16 +0000 (UTC) [thread overview]
Message-ID: <1542827585.a4b2ec7de2e43454a969a41f1a3ad22bb9cb18aa.mattst88@gentoo> (raw)
commit: a4b2ec7de2e43454a969a41f1a3ad22bb9cb18aa
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 21 07:06:48 2018 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Nov 21 19:13:05 2018 +0000
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=a4b2ec7d
scripts/copy_buildsync: shellcheck pass
[mattst88]: Small fixes
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
scripts/copy_buildsync.sh | 46 +++++++++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/scripts/copy_buildsync.sh b/scripts/copy_buildsync.sh
index 815d21de..5e4046c4 100755
--- a/scripts/copy_buildsync.sh
+++ b/scripts/copy_buildsync.sh
@@ -56,7 +56,7 @@ Options:
-v, --verbose Run in verbose mode
-d, --debug Run in debug mode
EOF
- exit ${1:-1}
+ exit "${1:-1}"
}
# Copy artifacts for an arch to the outgoing directory.
@@ -83,7 +83,7 @@ copy_arch_to_outgoing() {
for i in "${timestamps[@]}" ; do
#echo "Doing $i"
t="${outdir}/${i}"
- mkdir -p ${t} 2>/dev/null
+ mkdir -p "${t}" 2>/dev/null
rsync \
"${RSYNC_OPTS[@]}" \
--temp-dir="${tmpdir}" \
@@ -92,8 +92,8 @@ copy_arch_to_outgoing() {
--filter "S *${i}*" \
--filter 'S **/' \
--filter 'H *' \
- ${indir}/ \
- ${t}
+ "${indir}"/ \
+ "${t}"
rc=$?
if [ $rc -eq 0 ]; then
find "${indir}" \
@@ -102,7 +102,7 @@ copy_arch_to_outgoing() {
\( -not -path '*/\.*' \) \
-print0 \
| xargs -0 --no-run-if-empty \
- "$DEBUGP" rm "$VERBOSEP" -f
+ $DEBUGP rm $VERBOSEP -f
else
echo "Not deleting ${indir}/*${i}*, rsync failed!" 1>&2
fail=1
@@ -124,7 +124,7 @@ process_arch() {
outdir="${OUTGOING_BASE}/${ARCH}"
tmpdir="${TMPDIR_BASE}/${ARCH}"
- mkdir -p ${tmpdir} 2>/dev/null
+ mkdir -p "${tmpdir}" 2>/dev/null
# Sync incoming->outgoing first.
copy_arch_to_outgoing "${ARCH}" "${indir}" "${outdir}" "${tmpdir}"
@@ -182,23 +182,31 @@ process_arch() {
# New variant preserve code
find_variants=( '(' -iname '*.iso' -o -name 'netboot-*' -o "${EXTENSIONS[@]}" ')' )
variants=$(find 20* "${find_variants[@]}" -printf '%f\n' 2>/dev/null | sed -e 's,-20[012][0-9]\{5\}.*,,g' -r | sort -u)
- echo -n '' >"${tmpdir}"/.keep.${ARCH}.txt
+ keepfile="${tmpdir}/.keep.${ARCH}.txt"
+ keepfile_tmp=$(mktemp -p "${tmpdir}" -t ".keep.${ARCH}.txt.XXXXXX")
+ echo -n '' >"${keepfile_tmp}"
+ chmod 644 "${keepfile_tmp}"
for v in $variants ; do
+ # FIXME: trace the $a variable in this!
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}" -o ! -e "${variant_path}" ]; then
+ if [ -z "${variant_path}" ] || [ ! -e "${variant_path}" ]; then
echo "$ARCH: Variant ${v} is missing" 1>&2
continue
fi
- size=$(stat --format=%s ${variant_path})
+ size=$(stat --format='%s' "${variant_path}")
f="latest-${v}.txt"
- echo -e "${header}" >"${f}"
- echo -e "${variant_path} ${size}" >>${f}
- [[ ${variant_path} =~ tar.*$ ]] && echo -e "${variant_path} ${size}" >>${OUT_STAGE3}
- [[ ${variant_path} =~ iso$ ]] && echo -e "${variant_path} ${size}" >>${OUT_ISO}
+ 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
rm -f "current-$v"
ln -sf "${variant_path%/*}" "current-$v"
- echo "${variant_path}" | sed -e 's,/.*,,g' -e 's,^,/,g' -e 's,$,$,g' >>"${tmpdir}"/.keep.${ARCH}.txt
+ echo "${variant_path}" | sed -e 's,/.*,,g' -e 's,^,/,g' -e 's,$,$,g' >>"${keepfile_tmp}"
+ mv -f "${f_tmp}" "${f}"
done
+ mv -f "${keepfile_tmp}" "${keepfile}"
# ================================================================
# Cleanup
@@ -206,17 +214,17 @@ process_arch() {
# Clean up all but latest 4 from mirror dir
cd "${outdir}"
- for i in $(find -regextype posix-basic -mindepth 1 -maxdepth 1 -type d -regex '.*20[012][0-9]\{5\}.*' \
+ for i in $(find . -regextype posix-basic -mindepth 1 -maxdepth 1 -type d -regex '.*20[012][0-9]\{5\}.*' \
| sed -e 's:^.*-\(20[^.]\+\).*$:\1:' \
| sort -ur \
- | egrep -v "/${latest_iso_date}\$|/${latest_stage3_date}\$" \
- | egrep -v -f "${tmpdir}"/.keep.${ARCH}.txt \
+ | grep -E -v -e "/${latest_iso_date}\$|/${latest_stage3_date}\$" \
+ | grep -E -v -f "${keepfile}" \
| tail -n +5); do
- $DEBUGP rm $VERBOSEP -rf $(pwd)/${i}
+ $DEBUGP rm $VERBOSEP -rf "$(pwd)"/"${i}"
done
- $DEBUGP rm $VERBOSEP -rf ${tmpdir}
+ $DEBUGP rm $VERBOSEP -rf "${tmpdir}"
else
echo "There was some failure for $ARCH during the weekly sync. Not doing cleanup for fear of dataloss." 1>&2
next reply other threads:[~2018-11-21 19:13 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 19:13 Matt Turner [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-09 0:08 [gentoo-commits] proj/releng:master commit in: scripts/ Robin H. Johnson
2023-10-09 0:05 Robin H. Johnson
2023-10-09 0:04 Robin H. Johnson
2023-10-08 23:35 Robin H. Johnson
2023-10-08 23:32 Robin H. Johnson
2023-10-08 23:20 Robin H. Johnson
2023-10-08 23:17 Robin H. Johnson
2023-10-08 23:17 Robin H. Johnson
2023-10-08 23:10 Robin H. Johnson
2023-10-08 23:09 Robin H. Johnson
2023-10-08 23:07 Robin H. Johnson
2023-10-08 23:07 Robin H. Johnson
2022-10-13 15:52 Ben Kohler
2022-03-01 10:23 Andreas K. Hüttel
2021-11-12 18:42 Robin H. Johnson
2021-11-12 18:31 Andreas K. Hüttel
2021-11-12 18:31 Andreas K. Hüttel
2021-11-12 18:19 Andreas K. Hüttel
2021-11-12 18:00 Robin H. Johnson
2021-11-12 17:45 Andreas K. Hüttel
2021-11-12 3:32 Matt Turner
2021-11-12 0:15 Robin H. Johnson
2021-11-01 20:46 Andreas K. Hüttel
2021-10-31 17:45 Andreas K. Hüttel
2021-09-02 21:51 Andreas K. Hüttel
2021-07-31 19:41 Matt Turner
2021-07-31 16:05 Andreas K. Hüttel
2021-07-31 16:00 Andreas K. Hüttel
2021-05-09 21:24 Andreas K. Hüttel
2021-01-23 14:54 Andreas K. Hüttel
2020-12-19 20:18 Anthony G. Basile
2020-08-14 19:21 Matt Turner
2018-11-21 19:13 Matt Turner
2018-11-21 19:13 Matt Turner
2016-05-27 21:01 Robin H. Johnson
2016-05-27 20:56 Robin H. Johnson
2016-05-06 18:32 Robin H. Johnson
2016-03-20 23:53 Mike Frysinger
2016-03-20 23:53 Mike Frysinger
2016-03-20 23:53 Mike Frysinger
2016-03-20 23:53 Mike Frysinger
2016-03-20 23:53 Mike Frysinger
2016-03-20 22:42 Mike Frysinger
2016-03-20 22:40 Mike Frysinger
2016-03-20 22:39 Mike Frysinger
2016-03-20 22:39 Mike Frysinger
2015-10-22 10:00 Jorge Manuel B. S. Vicetto
2015-10-20 17:30 Robin H. Johnson
2015-10-02 22:45 Jorge Manuel B. S. Vicetto
2015-02-06 20:13 Jorge Manuel B. S. Vicetto
2015-02-06 17:33 Jorge Manuel B. S. Vicetto
2014-03-27 3:09 Jorge Manuel B. S. Vicetto
2013-08-17 19:13 Raúl Porcel
2013-08-17 18:59 Raúl Porcel
2013-08-17 16:52 Raúl Porcel
2013-08-05 12:02 Raúl Porcel
2013-08-04 18:01 Raúl Porcel
2013-04-18 8:33 Jorge Manuel B. S. Vicetto
2013-01-20 7:44 Raúl Porcel
2012-11-04 13:24 Jorge Manuel B. S. Vicetto
2012-07-22 17:36 Raúl Porcel
2012-07-09 17:49 Jorge Manuel B. S. Vicetto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1542827585.a4b2ec7de2e43454a969a41f1a3ad22bb9cb18aa.mattst88@gentoo \
--to=mattst88@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox