### depotsync.sh ### ### Generate hyperlinked reference to a ### J2EE code repository. ### ### ### This script should be run on the Huxley box ### The Perforce client spec for "www.setgetweb.com.depotc" should look like this: ### ### Client: www.setgetweb.com.depotc ### ### Owner: map ### ### Host: www.setgetweb.com ### ### Root: /usr/tomcat/webapps/ROOT/ ### Options: noallwrite noclobber nocompress unlocked nomodtime normdir ### ### LineEnd: local ### ### View: ### //depot/dev/cbo-aim... //www.setgetweb.com.depotc/depot/dev/cbo-aim... ### ### ### Environment ### date olddir=`pwd` dev=/usr/tomcat/webapps/ROOT/depot/dev DEPOT=/usr/tomcat/webapps/ROOT/depot/dev/cbo-aim/primary PATH=/usr/local/bin:$PATH ### ### Sync with Perforce depot to get newest code ### ### When build changes, don't forget to modify www.setgetweb.com.depotc ### echo "Doing a Perforce sync...." #rm -rf $dev P4PASSWD= P4CLIENT=www.setgetweb.com.depotc export P4CLIENT P4PASSWD p4 sync > /tmp/filelist.tmp #p4 sync -f > /tmp/filelist.tmp ### ### Generate list of new files ### grep -E 'updating|added|refreshing' /tmp/filelist.tmp | \ grep -v "\.jar$" | \ grep -v "\.buf$" | \ grep -v "\.cmd$" | \ grep -v "\.css$" | \ grep -v "\.dat$" | \ grep -v "\.dmp$" | \ grep -v "\.doc$" | \ grep -v "\.gif$" | \ grep -v "\.html$" | \ grep -v "\.hup$" | \ grep -v "\.jar$" | \ grep -v "\.jpg$" | \ grep -v "\.js$" | \ grep -v "\.jsp$" | \ grep -v "\.jspf$" | \ grep -v "\.par$" | \ grep -v "\.pkb$" | \ grep -v "\.pkh$" | \ grep -v "\.tld$" | \ grep -v "\.vsd$" | \ grep -v "\.xls$" | \ grep -v "\.xsd$" | \ grep -v "\.xsl$" | \ grep -v "\.xslt$" | \ grep -v "\.zargo$" | \ grep -v "\.zip$" | \ cut -d"#" -f1 | \ sed "s://depot/dev:/usr/tomcat/webapps/ROOT/depot/dev:" > /tmp/filelist.$$ ### ### Collect directories that have modified files ### cat /dev/null > /tmp/xtmpdir.$$ for i in `cat /tmp/filelist.$$` do dirname $i >> /tmp/xtmpdir.$$ done sort -r /tmp/xtmpdir.$$ | uniq > /tmp/xdirname.$$ ### ### Recurse through subdirectories and ### Create HTML versions of all text files ### in filelist.$$ echo "Creating HTML files" for i in `cat /tmp/filelist.$$` do x=`ls -s $i | cut -d"/" -f1` if [ $x -gt 500 ] then # This file is too big to convert echo "$i too big to convert" continue fi if grep text `file $i` > /dev/null 2>/dev/null then echo "$i" z=`dirname $i` f=`basename $i .html` cd $z /usr/local/bin/convertb.sh $f fi done cd $DEPOT ### ### Create tree indexes ### echo "Creating tree indexes" cd $DEPOT /usr/local/bin/mktreeidx.sh ### ### Create links to packages ### cd $DEPOT echo "Creating package links" #/usr/local/bin/packagelink.sh ### ### Recurse through subdirectories. ### Generate links to .java files ### cd $DEPOT echo "Creating java.html links and generating tree indexes..." for z in `find . -type d -print` do cd $z echo $z for x in `ls *.java.html 2>/dev/null` do z=`basename $x .java.html` for i in `cat /tmp/xdirname.$$` do #echo " " #echo "link1.sh $i $x $z" /usr/local/bin/link1.sh $i $x $z done done treeidx.sh cp tree.html index.html cd $DEPOT done cd $DEPOT