Reverse dirty repo logic, better testing options, ignore doxygen.warnings.log.
authorPeter D. Barnes, Jr. <barnes26@llnl.gov>
Thu, 02 Aug 2012 11:58:35 -0700
changeset 8956 ec45979e3372
parent 8953 d626a0e47446
child 8957 181cec3fadd3
Reverse dirty repo logic, better testing options, ignore doxygen.warnings.log.
.hgignore
doc/ns3_html_theme/get_version.sh
--- a/.hgignore	Wed Aug 01 12:36:50 2012 -0700
+++ b/.hgignore	Thu Aug 02 11:58:35 2012 -0700
@@ -20,6 +20,7 @@
 \.pcap$
 \.mob$
 \.routes$
+^doc/doxygen.warnings.log$
 ^doc/manual/build
 ^doc/tutorial/build
 ^doc/tutorial-pt-br/build
@@ -29,6 +30,7 @@
 ^doc/manual/figures/.*eps
 ^doc/manual/figures/.*pdf
 ^doc/manual/figures/.*png
+^doc/ns3_html_theme/static/ns3_version.js$
 ^src/.*/doc/build
 ^bindings/python/pybindgen/
 ms_print.*
@@ -38,4 +40,3 @@
 \.tr$
 \#[^\#/]+\#$
 syntax: glob
-ns3_version.js
\ No newline at end of file
--- a/doc/ns3_html_theme/get_version.sh	Wed Aug 01 12:36:50 2012 -0700
+++ b/doc/ns3_html_theme/get_version.sh	Thu Aug 02 11:58:35 2012 -0700
@@ -18,7 +18,7 @@
 #
 # The approach to identify cases 1 & 2 is to test:
 # a.  We're on nsnam.org (actually, nsnam.ece.gatech.edu), and
-# b.  We're in the tmp build directory, /tmp/daily_nsnam/
+# b.  We're in the tmp build directory, /tmp/daily-nsnam/
 #     (This is the directory used by the update-* scripts
 #     run by cron jobs.)
 #
@@ -47,52 +47,63 @@
     echo "$me: $*"
 }
 
+function usage
+{
+    cat <<-EOF
+	Usage:  $me                   normal versioning
+	        $me [-n] [-d] [-t]    test options
+	
+	  -n  pretend we are on nsnam.org
+	  -d  pretend we are in the automated build directory
+	  -t  pretend we are at a repo tag
+	    
+EOF
+    exit 1
+}
 
 # script arguments
 say
-verbose=0
 nsnam=0
+daily=0
 tag=0
 
-while getopts ntv option ; do
+while getopts ndth option ; do
     case $option in
-	n)
-	nsnam=1
-	verbose=1
-	;;
+	(n)  nsnam=1 ;;
 
-	t)
-	tag=1
-	verbose=1
-	;;
-	
-	v)
-	verbose=1
-	;;
+	(d)  daily=1 ;;
 
-	\?)
-	say "invalid option: -$OPTION"
-	exit -1
-	;;
+	(t)  tag=1   ;;
+
+	(h | \? ) usage   ;;
     esac
 done
 
-[[ $verbose -eq 1 ]] && say verbose
-[[ $nsnam   -eq 1 ]] && say nsnam
-[[ $tag     -eq 1 ]] && say using tag
-
 # Hostname, fully qualified, e.g. nsnam.ece.gatech.edu
 HOST=`hostname`
 NSNAM="nsnam.ece.gatech.edu"
 
 # Build directory
-DAILY="^/tmp/daily_nsnam/"
+DAILY="^/tmp/daily-nsnam/"
 
 if [ $nsnam -eq 1 ]; then
     HOST=$NSNAM
+    say "-n forcing HOST = $HOST"
+fi
+
+if [ $daily -eq 1 ] ; then
     OLDPWD=$PWD
-#    PWD=/tmp/daily_nsnam/foo
-    say "forcing build for nsnam.org"
+    PWD=/tmp/daily-nsnam/foo
+    say "-d forcing PWD = $PWD"
+fi
+
+if [ $tag -eq 1 ]; then
+    version="3.14"
+    say "-t forcing tagged version = $version"
+fi
+
+if  ((nsnam + daily + tag > 0)) ; then
+    say
 fi
 
 if [[ ( $HOST == $NSNAM ) && ( $PWD =~ $DAILY ) ]] ; then
@@ -103,7 +114,7 @@
     say "building private docs"
 fi
 
-if [ $nsnam -eq 1 ]; then
+if [ $daily -eq 1 ]; then
     PWD=$OLDPWD
 fi
 
@@ -113,27 +124,27 @@
 # Distance from last tag
 # Zero distance means we're at the tag
 distance=`hg log -r tip --template '{latesttagdistance}'`
+
 if [ $distance -eq 0 ]; then
     version=`hg log -r tip --template '{latesttag}'`
     say "at tag $version"
+
+elif [ $tag -eq 1 ]; then
+    distance=0
+    version="3.14"
+
 else
-    say "beyond latest tag"
     version=`hg log -r tip --template '{node|short}'`
-    say "latest commit: $version"
     # Check for uncommitted changes
     hg summary | grep -q 'commit: (clean)'
-    if [ $? ] ; then
-	say "uncommitted changes"
+    if [ ! $? ] ; then
+	say "beyond latest tag, last commit: $version, dirty"
 	version="$version(+)"
+    else
+	say "beyond latest tag, last commit: $version, clean"
     fi
 fi
 
-if [ $tag -eq 1 ]; then
-    distance=0
-    version="3.14"
-    say "forcing version = $version"
-fi
-
 if [ $PUBLIC -eq 1 ]; then
     echo "var ns3_host = \"http://www.nsnam.org/\";"         >  $outf
     
@@ -169,9 +180,8 @@
 cd - 2>&1 >/dev/null
 
 # Show what was done
-if [ $verbose ]; then
-    say
-    say "outf = $outf:"
-    cat -n $outf
-fi
+say
+say "outf = $outf:"
+cat -n $outf
 
+