aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorErwin Lansing <erwin@FreeBSD.org>2006-06-19 15:44:16 +0000
committerErwin Lansing <erwin@FreeBSD.org>2006-06-19 15:44:16 +0000
commitc090c55e39888b281b84f237ded930d5cb49a5ec (patch)
tree49977d13d475507669a9f08adb22ff0a6c9b287e /Tools
parentfb2a8d1906c188ad2a48e4c4e24d506c646cb294 (diff)
downloadports-c090c55e39888b281b84f237ded930d5cb49a5ec.tar.gz
ports-c090c55e39888b281b84f237ded930d5cb49a5ec.zip
MFP4:
When copying INDEX to the server, copy it first to a staging area and first then to the real location. The copying can take long enough for users to get a truncated file when downloading during the upload.
Notes
Notes: svn path=/head/; revision=165776
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/tindex30
1 files changed, 24 insertions, 6 deletions
diff --git a/Tools/scripts/tindex b/Tools/scripts/tindex
index 3167171f33d2..6be0147be43a 100755
--- a/Tools/scripts/tindex
+++ b/Tools/scripts/tindex
@@ -19,7 +19,9 @@ REPORT_ADDRESS=root@localhost
ERROR_ADDRESS=root@localhost
# Where to scp the resulting indexes after build
-SCP_DEST=root@localhost:/usr/local/www/ports
+SCP_DEST_HOST=root@localhost
+SCP_DEST_TMP=/tmp
+SCP_DEST_DIR=/usr/local/www/ports
# Location of ports tree and source trees
export BASEDIR=/local0/tmp/kris/tindex
@@ -109,6 +111,15 @@ checkfixed() {
fi
}
+createtmpdir() {
+ TMPDIR=`ssh ${SCP_DEST_HOST} "mktemp -qd /tmp/tindex.XXXXXX"`
+ if [ $? -ne 0 ]; then
+ echo "$0: Can't create temp file, exiting..."
+ exit 1
+ fi
+}
+
+
# Sanitize the environment so that the indexes aren't customized by the
# local machine settinge
export __MAKE_CONF=/dev/null
@@ -154,9 +165,10 @@ if [ -s index.err ]; then
fi
checkfixed ${BRANCH}
+createtmpdir
bzip2 -kf ${PORTSDIR}/INDEX
-scp ${SSHKEY} ${PORTSDIR}/INDEX ${PORTSDIR}/INDEX.bz2 ${SCP_DEST} || mail -s "Cannot copy INDEX" ${ERROR_ADDRESS} < /dev/null
-
+scp -q ${SSHKEY} ${PORTSDIR}/INDEX ${PORTSDIR}/INDEX.bz2 ${SCP_DEST_HOST}:${TMPDIR} || mail -s "Cannot copy INDEX to temp dir" ${ERROR_ADDRESS}
+ssh ${SCP_DEST_HOST} "/bin/mv ${TMPDIR}/INDEX ${SCP_DEST_DIR}; /bin/mv ${TMPDIR}/INDEX.bz2 ${SCP_DEST_DIR}; rmdir ${TMPDIR}" || mail -s "Cannot move INDEX to final dir" ${ERROR_ADDRESS}
BRANCH=5.x
export OSVERSION=${OSVERSION5}
echo "Building INDEX for ${BRANCH} with OSVERSION=${OSVERSION}"
@@ -167,8 +179,10 @@ if [ -s index.err ]; then
fi
checkfixed ${BRANCH}
+createtmpdir
bzip2 -kf ${PORTSDIR}/INDEX-5
-scp ${SSHKEY} ${PORTSDIR}/INDEX-5 ${PORTSDIR}/INDEX-5.bz2 ${SCP_DEST} || mail -s "Cannot copy INDEX-5" ${ERROR_ADDRESS} < /dev/null
+scp -q ${SSHKEY} ${PORTSDIR}/INDEX-5 ${PORTSDIR}/INDEX-5.bz2 ${SCP_DEST_HOST}:${TMPDIR} || mail -s "Cannot copy INDEX-5 to temp dir" ${ERROR_ADDRESS}
+ssh ${SCP_DEST_HOST} "/bin/mv ${TMPDIR}/INDEX-5 ${SCP_DEST_DIR}; /bin/mv ${TMPDIR}/INDEX-5.bz2 ${SCP_DEST_DIR}; rmdir ${TMPDIR}" || mail -s "Cannot move INDEX-5 to final dir" ${ERROR_ADDRESS}
BRANCH=6.x
export OSVERSION=${OSVERSION6}
@@ -180,8 +194,10 @@ if [ -s index.err ]; then
fi
checkfixed ${BRANCH}
+createtmpdir
bzip2 -kf ${PORTSDIR}/INDEX-6
-scp ${SSHKEY} ${PORTSDIR}/INDEX-6 ${PORTSDIR}/INDEX-6.bz2 ${SCP_DEST} || mail -s "Cannot copy INDEX-6" ${ERROR_ADDRESS} < /dev/null
+scp -q ${SSHKEY} ${PORTSDIR}/INDEX-6 ${PORTSDIR}/INDEX-6.bz2 ${SCP_DEST_HOST}:${TMPDIR} || mail -s "Cannot copy INDEX-6 to temp dir" ${ERROR_ADDRESS}
+ssh ${SCP_DEST_HOST} "/bin/mv ${TMPDIR}/INDEX-6 ${SCP_DEST_DIR}; /bin/mv ${TMPDIR}/INDEX-6.bz2 ${SCP_DEST_DIR}; rmdir ${TMPDIR}" || mail -s "Cannot move INDEX-6 to final dir" ${ERROR_ADDRESS}
BRANCH=7.x
export OSVERSION=${OSVERSION7}
@@ -193,8 +209,10 @@ if [ -s index.err ]; then
fi
checkfixed ${BRANCH}
+createtmpdir
bzip2 -kf ${PORTSDIR}/INDEX-7
-scp ${SSHKEY} ${PORTSDIR}/INDEX-7 ${PORTSDIR}/INDEX-7.bz2 ${SCP_DEST} || mail -s "Cannot copy INDEX-7" ${ERROR_ADDRESS} < /dev/null
+scp -q ${SSHKEY} ${PORTSDIR}/INDEX-7 ${PORTSDIR}/INDEX-7.bz2 ${SCP_DEST_HOST}:${TMPDIR} || mail -s "Cannot copy INDEX-7 to temp dir" ${ERROR_ADDRESS}
+ssh ${SCP_DEST_HOST} "/bin/mv ${TMPDIR}/INDEX-7 ${SCP_DEST_DIR}; /bin/mv ${TMPDIR}/INDEX-7.bz2 ${SCP_DEST_DIR}; rmdir ${TMPDIR}" || mail -s "Cannot move INDEX-7 to final dir" ${ERROR_ADDRESS}
# All indexes built successfully, clear the hook
rm -f ${PORTSDIR}/hook