depotsync1.sh

 

#
### 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...
###




depotidx()
{
###
### Create an index.html file with a 
### listing of a files underneath $DEPOT
###
###
###



### 
### Hard coded.  Bad.  Need to genericize.
### 
DEPOT=/usr/tomcat/webapps/ROOT/depot
cd $DEPOT

echo "<html> " > index.html
echo "<head> " >> index.html
echo "   <META content=text/css http-equiv=Content-Style-Type> " >> index.html
echo "   <LINK href=\"http://www.setgetweb.com/black.css\" rel=\"stylesheet\" type=\"text/css\"> " >> index.html
echo "   <title> Depot Index </title> " >> index.html
echo "</head> " >> index.html
echo "<body> " >> index.html
echo "                  " >> index.html
echo "<font class=grey2> " >> index.html
echo "                  " >> index.html
echo "<blockquote> " >> index.html
echo "<blockquote> " >> index.html
echo "                  " >> index.html
echo "<p>&nbsp;</p> " >> index.html
echo "<center> " >> index.html
echo "<h1> Depot Index </h1> " >> index.html
echo "<p>&nbsp;</p>" >> index.html
echo "<FORM METHOD=get ACTION=\"/cgi-bin/search_cbo.cgi\">" >> index.html
echo "   <INPUT TYPE=\"text\" NAME=\"terms\">" >> index.html
echo "   <INPUT TYPE=\"submit\" value=\"Search CBO\">" >> index.html
echo "</FORM>" >> index.html
echo "</center> " >> index.html
echo "                  " >> index.html
echo "                  " >> index.html
echo "<p>&nbsp;</p>" >> index.html
echo "<p><hr> " >> index.html
echo "                  " >> index.html
echo "<p>To refresh this repository:  " >> index.html
echo "<p><ol>           " >> index.html
echo "<li>Set P4CLIENT=www.setgetweb.com.depotc                  " >> index.html
echo "<li>Run  \"p4 cient\" and change release to <i>your</i> release. " >> index.html
echo "For example, change \"aim\" to \"ajax\"                  " >> index.html
echo "<li> Run <a href="depotsync.sh.html">depotsync.sh</a>                 " >> index.html
echo "</ol>                  " >> index.html
echo "                  " >> index.html
echo " <script javascript=\"JavaScript\"> " >> index.html
echo "     document.write(\"<p>Last refresh: \"+document.lastModified); " >> index.html
echo " </script> " >> index.html
echo "                  " >> index.html
echo "<p><hr> " >> index.html


a="xyz"
cd $DEPOT
for i in `find dev/cbo-aim/primary -type -f -print | grep -v \.\/index.html | grep -v html.html | grep -v \.gif`
do
    x=`dirname $i`
    y=`basename $i`
    z=`basename $i .html`
    q=`echo $x | sed "s/\// /g"`
    echo $z

    if [ "$x" = "$a" ]
    then
         echo "<br><a href=\"$x/$y\">$z</a> " >> index.html
    else
         echo "<p>&nbsp</p> " >> index.html
         echo "<p><b>$q</b> " >> index.html
         echo "<p><a href=\"$x/$y\">$z</a> " >> index.html
         a=$x
    fi

    
done

echo " <p><hr> " >> index.html
echo "  " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <a href=\"http://www.setgetweb.com/index.php\"><img border=0 src=\"http://www.setgetweb.com/home.gif\" align=left alt=\"Home\"></a> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo "  " >> index.html
echo " </blockquote> " >> index.html
echo " </blockquote> " >> index.html
echo "  " >> index.html
echo " <center> " >> index.html
echo " <br> Copyright 2002. All Rights Reserved. " >> index.html
echo " <script javascript=\"JavaScript\"> " >> index.html
echo "     document.write(\"<br>Last updated: \"+document.lastModified); " >> index.html
echo " </script> " >> index.html
echo "  " >> index.html
echo "  " >> index.html
echo " </center> " >> index.html
echo "  " >> index.html
echo "    </body> " >> index.html
echo " </html> " >> index.html

}






################### BEGIN MAIN #######################

###
### Lights for navigating the labyrinth.
###
date
olddir=`pwd`
DEPOT=/usr/tomcat/webapps/ROOT/depot


###
### In this version, depot code needs to sit under a document root.
###
###
dev=/usr/tomcat/webapps/ROOT/depot/dev




###
### Sync with Perforce depot to get newest code
###
### When build changes, don't forget to modify www.setgetweb.com.depotc 
###

#rm -rf $dev
#P4CLIENT=www.setgetweb.com.depotc
#export P4CLIENT
### p4 sync  > /tmp/filelist.tmp

#p4 sync -f > /tmp/filelist.tmp



#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.out


###
### Recurse through subdirectories and
### Create HTML versions of all text files
###

#echo "                  "
#echo "Creating HTML files"
#for i in `cat /tmp/filelist.out` 
#do
#   z=`dirname $i`
#   f=`basename $i .html`
#   echo $f
#   cd $z
#   convertb.sh $f
#done

### 
### Derive index.html file
### 

#depotidx


###
### Recurse through subdirectories. 
### Generate links to .java and .tbl files
###
###

echo "                  "
DEPOT=/usr/tomcat/webapps/ROOT/depot/dev
cd $DEPOT

for i in `find . -type d -print`
do
     echo $i
     cd $i
     for x in `ls *.java.html 2>/dev/null`
     do
        z=`basename $x .java.html`
        echo " "
        echo "link.sh $DEPOT $x $z"
        link.sh $DEPOT $x $z
        echo " "
     done
     cd $DEPOT
done


#echo "Generating links..."
#for i in `cat /tmp/filelist.out | grep \.java | grep -v " "`
#do
#   f=`dirname $i`
#   cd $f
#   q=`basename $i `
#   z=`basename $q .java`
#   echo " "
#   echo " "
#   echo "link.sh $f ${q}.html $z"
#   link.sh $f ${q}.html $z
#   cd $DEPOT
#done


#for i in `find . -name \*.tbl -print | grep -v " "`
#do
#   f=`dirname $i`
#   cd $f
#   q=`basename $i `
#   z=`basename $i .tbl`
#   link.sh $DEPOT ${q}.html FROM $z
#   link.sh $DEPOT ${q}.html INSERT INTO $z
#   link.sh $DEPOT ${q}.html UPDATE $z
#   cd $DEPOT
#
#done


date