<pre style='margin:0'>
Lawrence Velázquez (larryv) pushed a commit to branch mprsyncup-polish
in repository macports-infrastructure.
</pre>
<p><a href="https://github.com/macports/macports-infrastructure/commit/7be2a6eebe52591e70236ad5f9185502e96a1b48">https://github.com/macports/macports-infrastructure/commit/7be2a6eebe52591e70236ad5f9185502e96a1b48</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 7be2a6eebe52591e70236ad5f9185502e96a1b48
</span>Author: Lawrence Velázquez <larryv@macports.org>
AuthorDate: Wed Nov 16 17:15:15 2016 -0500
<span style='display:block; white-space:pre;color:#404040;'> mprsyncup: Quote most parameter expansions
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This avoids accidental whitespace splitting and filename generation.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Add comments to point out exceptions.
</span>---
jobs/mprsyncup | 86 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 45 insertions(+), 41 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/jobs/mprsyncup b/jobs/mprsyncup
</span><span style='display:block; white-space:pre;color:#808080;'>index bdff2d6..ebe8f04 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/jobs/mprsyncup
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/jobs/mprsyncup
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -30,7 +30,9 @@
</span> set -e
set -x
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Commands we need:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Commands we need. For options to be substituted correctly, these must
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# not be substituted within double quotes. Thus, there must not be any
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# globbing characters, and the command itself must not contain spaces.
</span> SVN="/opt/local/bin/svn --non-interactive"
RSYNC="/opt/local/bin/rsync -q"
RM="/bin/rm"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -54,7 +56,8 @@ PORTINDEX=${PREFIX}/bin/portindex
</span>
PATH=${PREFIX}/bin:/bin:/usr/bin:/usr/sbin:/opt/local/bin
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# platforms we generate indexes for
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Platforms we generate indexes for. This is intentionally split on
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# whitespace later.
</span> PLATFORMS="8_powerpc 8_i386 9_powerpc 9_i386 10_i386 11_i386 12_i386 13_i386 14_i386 15_i386 16_i386"
# Sources information:
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -92,66 +95,66 @@ sign() {
</span> # Update trunk/base
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -f ${TBASE}/.svn/lock ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} cleanup ${TBASE}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -f "${TBASE}/.svn/lock" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} cleanup "${TBASE}"
</span> fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -d ${TBASE}/.svn ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q update ${TBASE}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -d "${TBASE}/.svn" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q update "${TBASE}"
</span> else
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q checkout ${BASEURL} ${TBASE}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q checkout "${BASEURL}" "${TBASE}"
</span> fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-${MKDIR} -p ${RSYNCROOT}/trunk/base
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-${RSYNC} -aIC --delete ${TBASE}/ ${RSYNCROOT}/trunk/base
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${MKDIR} -p "${RSYNCROOT}/trunk/base"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${RSYNC} -aIC --delete "${TBASE}/" "${RSYNCROOT}/trunk/base"
</span>
#
# Update release/base
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>-read RELEASE_URL < ${TBASE}/${RELEASE_URL_FILE}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ! -n ${RELEASE_URL} ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+read RELEASE_URL < "${TBASE}/${RELEASE_URL_FILE}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ ! -n "${RELEASE_URL}" ]; then
</span> echo "no RELEASE_URL specified in svn trunk, bailing out!"
exit 1
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -f ${RBASE}/.svn/lock ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} cleanup ${RBASE}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -f "${RBASE}/.svn/lock" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} cleanup "${RBASE}"
</span> fi
RBASE_CHANGED=1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -d ${RBASE}/.svn ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- RBASE_OLD_REV="$(${SVN} info ${RBASE} | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q switch ${RELEASE_URL} ${RBASE}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- RBASE_NEW_REV="$(${SVN} info ${RBASE} | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -d "${RBASE}/.svn" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RBASE_OLD_REV="$(${SVN} info "${RBASE}" | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q switch "${RELEASE_URL}" "${RBASE}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ RBASE_NEW_REV="$(${SVN} info "${RBASE}" | ${SED} -n 's/^Last Changed Rev: //p')"
</span> [ "${RBASE_OLD_REV}" = "${RBASE_NEW_REV}" ] && RBASE_CHANGED=0
else
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q checkout ${RELEASE_URL} ${RBASE}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q checkout "${RELEASE_URL}" "${RBASE}"
</span> fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-${MKDIR} -p ${RSYNCROOT}/release/base
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-${RSYNC} -aIC --delete ${RBASE}/ ${RSYNCROOT}/release/base
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${MKDIR} -p "${RSYNCROOT}/release/base"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${RSYNC} -aIC --delete "${RBASE}/" "${RSYNCROOT}/release/base"
</span>
#
# Update release/ports
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -f ${PORTS}/.svn/lock ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} cleanup ${PORTS}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -f "${PORTS}/.svn/lock" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} cleanup "${PORTS}"
</span> fi
PORTS_CHANGED=1
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ -d ${PORTS}/.svn ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- PORTS_OLD_REV="$(${SVN} info ${PORTS} | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q update ${PORTS}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- PORTS_NEW_REV="$(${SVN} info ${PORTS} | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ -d "${PORTS}/.svn" ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PORTS_OLD_REV="$(${SVN} info "${PORTS}" | ${SED} -n 's/^Last Changed Rev: //p')"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q update "${PORTS}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ PORTS_NEW_REV="$(${SVN} info "${PORTS}" | ${SED} -n 's/^Last Changed Rev: //p')"
</span> [ "${PORTS_OLD_REV}" = "${PORTS_NEW_REV}" ] && PORTS_CHANGED=0
else
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ${SVN} -q checkout ${PORTSURL} ${PORTS}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${SVN} -q checkout "${PORTSURL}" "${PORTS}"
</span> fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${RBASE_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${RBASE_CHANGED}" -eq 1 ]; then
</span> PORTS_CHANGED=1
# build MP in a private location for indexing
<span style='display:block; white-space:pre;background:#ffe0e0;'>- pushd ${RBASE} >> /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pushd "${RBASE}" >> /dev/null
</span> ./configure \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- --prefix=${PREFIX} \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ --prefix="${PREFIX}" \
</span> --with-install-group="$(id -gn)" \
--with-install-user="$(id -un)"
make clean
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -165,13 +168,14 @@ if [ ${RBASE_CHANGED} -eq 1 ]; then
</span> popd
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${PORTS_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${PORTS_CHANGED}" -eq 1 ]; then
</span> # generate platform-specific indexes
<span style='display:block; white-space:pre;background:#ffe0e0;'>- pushd ${PORTS} >> /dev/null
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pushd "${PORTS}" >> /dev/null
</span> PIDS=()
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Intentionally split PLATFORMS on whitespace.
</span> for PLATFORM in $PLATFORMS; do
INDEX="PortIndex_darwin_${PLATFORM}"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ${PORTINDEX} -p macosx_${PLATFORM} -o ${INDEX} | ${SED} "s/^/Updating ${INDEX}:"$'\t'"/" | expand -t 40,48,56,64,72,80 &
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${PORTINDEX} -p "macosx_${PLATFORM}" -o "${INDEX}" | ${SED} "s/^/Updating ${INDEX}:"$'\t'"/" | expand -t 40,48,56,64,72,80 &
</span> PIDS+=($!)
done
for PID in ${PIDS[*]}; do
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -180,14 +184,14 @@ if [ ${PORTS_CHANGED} -eq 1 ]; then
</span> popd
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-${MKDIR} -p ${RSYNCROOT}/release/ports
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-${RSYNC} -aIC --delete ${PORTS}/ ${RSYNCROOT}/release/ports
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${MKDIR} -p "${RSYNCROOT}/release/ports"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+${RSYNC} -aIC --delete "${PORTS}/" "${RSYNCROOT}/release/ports"
</span>
#
# Update trunk/dports
#
<span style='display:block; white-space:pre;background:#ffe0e0;'>-cd ${RSYNCROOT}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+cd "${RSYNCROOT}"
</span> if [ ! -L trunk/dports ]; then
cd trunk
${RM} -rf dports && ${LN} -s ../release/ports dports
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -198,11 +202,11 @@ fi
</span> #
# Generate and sign tarballs of base and ports and the PortIndex files.
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${RBASE_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${RBASE_CHANGED}" -eq 1 ]; then
</span> ${TAR} -C "${RSYNCROOT}"/release/ -cf "${ROOT}"/base.tar base
sign "${ROOT}"/base.tar
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${PORTS_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${PORTS_CHANGED}" -eq 1 ]; then
</span> ${TAR} -C "${RSYNCROOT}"/release/ -czf "${ROOT}"/ports.tar.gz ports
${TAR} --exclude 'PortIndex*' -C "${RSYNCROOT}"/release/ -cf "${ROOT}"/ports.tar ports
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -222,15 +226,15 @@ fi
</span> # Replace files on rsync server as quickly as possible.
# This is not atomic but doing it atomically is difficult.
${MKDIR} -p "${RSYNCROOT}"/release/tarballs "${RSYNCROOT}"/distfiles
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${RBASE_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${RBASE_CHANGED}" -eq 1 ]; then
</span> ${MV} "${ROOT}"/base.tar* "${RSYNCROOT}"/release/tarballs
fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>-if [ ${PORTS_CHANGED} -eq 1 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if [ "${PORTS_CHANGED}" -eq 1 ]; then
</span> ${MV} "${ROOT}"/ports.tar.gz "${RSYNCROOT}"/release
hardlink "${RSYNCROOT}"/release/ports.tar.gz "${RSYNCROOT}"/distfiles/ports.tar.gz
${MV} "${ROOT}"/ports.tar* "${RSYNCROOT}"/release/tarballs
for INDEX_DIR in "${RSYNCROOT}"/release/ports/PortIndex_*; do
<span style='display:block; white-space:pre;background:#ffe0e0;'>- INDEX_LINK_DIR="${RSYNCROOT}"/release/tarballs/${INDEX_DIR##*/}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ INDEX_LINK_DIR="${RSYNCROOT}/release/tarballs/${INDEX_DIR##*/}"
</span> ${MKDIR} -p "${INDEX_LINK_DIR}"
hardlink "${INDEX_DIR}"/PortIndex "${INDEX_LINK_DIR}"/PortIndex
hardlink "${INDEX_DIR}"/PortIndex.quick "${INDEX_LINK_DIR}"/PortIndex.quick
</pre><pre style='margin:0'>
</pre>