diff --git a/tools/sfsnapshot b/tools/sfsnapshot
index a383760e852ea83808d4aa8f5732010066b52c5a..3b71219a765f757b1904ab290953ff9fd1d90183 100755 (executable)
--- a/tools/sfsnapshot
+++ b/tools/sfsnapshot
function die { echo $1; exit 1; }
-# This makes the distribution. Expects $1 as CVS tag, otherwise uses HEAD
+# This makes the distribution. Expects $1 as branches/name, otherwise uses trunk
function make_dist {
if [[ -n $1 ]] ; then
- cvs_rel=$1
- v="$1-"
+ svn_url_suffix=$1
+ name=${1##*/}
else
- cvs_rel="HEAD"
- v="HEAD-"
+ svn_url_suffix="trunk"
+ name="trunk"
fi
+ v="$name-"
# Get compile server to do the work
# Variables will be expanded locally before being run on $CF
ssh $CF <<EOF
set -x
- PATH=$PATH
- [[ ! -d $COMPILE_DIR/$cvs_rel ]] && mkdir -p $COMPILE_DIR/$cvs_rel
- cd $COMPILE_DIR/$cvs_rel
+ PATH=$PATH:/usr/local/bin
+ [[ ! -d $COMPILE_DIR/$name ]] && mkdir -p $COMPILE_DIR/$name
+ cd $COMPILE_DIR/$name
# Cannot use cvs export due to conflicts on second run - think this is better for cvs server
- cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nagiosplug co -r $cvs_rel nagiosplug
+ svn export https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/$svn_url_suffix $PROJECT
cd $PROJECT
- # TODO: Maybe this should only be run when necessary?
tools/setup
./configure
# May fail if file not generated - do not trap
mv *.gz $IN
+ rm -rf $COMPILE_DIR
# End ssh
EOF
}
IN=${HOME}/tmp_snapshot
# Where to place the generated files
-OUT_SERVER="shell.sf.net"
+OUT_SERVER="tonvoon@web.sourceforge.net"
OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
# Make sure prereqs are satisfied on server!
-CF="x86-solaris1"
+CF="localhost"
DS=`date -u +%Y%m%d%H%M`
# Setup home directory area
make_dist $i
done
-# Check for *.gz files locally (expect NFS between cf shell server and $CF)
-set -x
-files=$(ls $IN/*.gz 2>/dev/null)
-[[ -z $files ]] && die "No files created"
-ssh $OUT_SERVER "rm -f $OUT/*.gz"
-scp $files $OUT_SERVER:$OUT
-
# Create MD5 sum
-ssh $OUT_SERVER << EOF
-cd $OUT
+cd $IN
cat <<-END_README > README
-This is the daily CVS snapshot of nagiosplug, consisting of the CVS HEAD
-and any other branches
+This is the daily SVN snapshot of nagiosplug, consisting of the SVN trunk
+and any other branches.
+
+The nagios-plugins-HEAD.tar.gz link will always go to the latest trunk snapshot
+(name kept for existing tinderbox scripts to link correctly).
+
The MD5SUM is:
END_README
md5sum *.gz | tee -a README > MD5SUM
+
+
+# Check for *.gz files locally (expect NFS between cf shell server and $CF)
+set -x
+cd $IN
+files=$(ls *.gz 2>/dev/null)
+[[ -z $files ]] && die "No files created"
+head_file=$(cd $IN && ls -rt *-trunk-*.gz | head -1 2>/dev/null)
+cat <<-EOF > /tmp/batchfile.$$
+cd $OUT
+rm *.gz
+put *.gz
+ln $head_file nagios-plugins-HEAD.tar.gz
+put MD5SUM
+put README readme
EOF
-rm -f $files
+# Do the actual transfer
+# Have to put README down as readme because SF's apache server appears to block README files
+sftp -b /tmp/batchfile.$$ $OUT_SERVER
+
+rm -f $files /tmp/batchfile.$$
# Work out success or failure
expected=$(($# + 1))