You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by br...@apache.org on 2004/04/28 05:37:51 UTC

svn commit: rev 10341 - xml/forrest/trunk/scratchpad/forrestbot2/core

Author: brondsem
Date: Tue Apr 27 20:37:51 2004
New Revision: 10341

Added:
   xml/forrest/trunk/scratchpad/forrestbot2/core/cvs_add.sh   (contents, props changed)
Modified:
   xml/forrest/trunk/scratchpad/forrestbot2/core/deploy.xml
Log:
deploy.cvs (for *nix only)

Added: xml/forrest/trunk/scratchpad/forrestbot2/core/cvs_add.sh
==============================================================================
--- (empty file)
+++ xml/forrest/trunk/scratchpad/forrestbot2/core/cvs_add.sh	Tue Apr 27 20:37:51 2004
@@ -0,0 +1,63 @@
+#!/bin/bash
+#  Copyright 2004 The Apache Software Foundation
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+function log() {
+  echo "%% $@"
+}
+
+function addfiles()
+{
+  log "addfiles '$@'"
+  local TXTFILES
+  local BINFILES
+  local DIRS
+  for i in $@; do
+    #echo "Processing $i.."
+    if [ -d "$i" ]; then
+      log "Directory: $i"
+      DIRS="$DIRS $i"
+      continue
+    fi
+    local MIME=`file -bi $i 2>/dev/null`
+    unset istext
+    log $MIME | grep text > /dev/null && istext="yes"
+    if [ "$istext" = "yes" ]; then
+      log "Adding as TEXT ($MIME): $i"
+      TXTFILES="$TXTFILES $i"
+    else
+      log "Adding as BINARY ($MIME): $i"
+      BINFILES="$BINFILES $i"
+    fi
+  done
+  [ ! -z "$TXTFILES" ] && cvs add $TXTFILES
+  [ ! -z "$BINFILES" ] && cvs add -kb $BINFILES
+  if [ ! -z "$DIRS" ]; then
+    log "Processing dirs $DIRS"
+    for d in $DIRS; do
+      log "Processing dir $d"
+      unset newfiles ; newfiles=`find $d -type f -not -path "*CVS*"`
+      unset newdirs ; newdirs=`find $d -type d -not -name "CVS" | tr '\n' ' '`
+      log "  dirs: '$newdirs'"
+      log "  files: '$files'"
+      cvs add $newdirs
+      addfiles $newfiles
+    done
+  fi
+  unset TXTFILES BINFILES DIRS
+}
+
+NEW_FILES=`cvs up | grep '^\?' | cut -d\  -f 2`
+log "Adding new files to CVS: $NEW_FILES"
+[ ! -z "$NEW_FILES" ] && addfiles $NEW_FILES

Modified: xml/forrest/trunk/scratchpad/forrestbot2/core/deploy.xml
==============================================================================
--- xml/forrest/trunk/scratchpad/forrestbot2/core/deploy.xml	(original)
+++ xml/forrest/trunk/scratchpad/forrestbot2/core/deploy.xml	Tue Apr 27 20:37:51 2004
@@ -41,10 +41,16 @@
   <property name="deploy.cvs.root" value="/home/cvs"/>
   <property name="deploy.cvs.host" value="cvs.apache.org"/>
   <property name="deploy.cvs.module" value="${ant.project.name}"/>
+  <property name="deploy.cvs.commit-message" value="Automatic publish from forrestbot"/>
   
   <property name="deploy.cvsmodule-dir" value="work/cvsmodules-deploy/${ant.project.name}"/>
   
   <target name="deploy.cvs">
+    <condition property="isUnix">
+        <os family="unix"/>
+    </condition>
+    <fail unless="isUnix" message="deploy.cvs only supported for unix-like operating systems."/>
+    
     <property name="deploy.cvs.fullroot" value=":ext:${deploy.cvs.user}@${deploy.cvs.host}:${deploy.cvs.root}"/>
     <!-- log in -->
     <cvspass cvsroot="${deploy.cvs.fullroot}" password="${deploy.cvs.password}"/>
@@ -60,12 +66,12 @@
       <fileset dir="${build.site-dir}"/>
     </copy>
     <!-- add new files to CVS -->
+    <exec executable="${bot.home}/core/cvs_add.sh" dir="${deploy.cvsmodule-dir}/${deploy.cvs.module}" failonerror="true"/>
     <!-- check in to CVS -->
-    <cvs command="commit" cvsRoot="${deploy.cvs.fullroot}"
-      dest="${deploy.cvsmodule-dir}/${deploy.cvs.module}"
-      failonerror="true"
-      noexec="true"
-      />
+    <exec executable="cvs" dir="${deploy.cvsmodule-dir}/${deploy.cvs.module}" failonerror="true">
+      <arg value="commit"/>
+      <arg value="-m '${deploy.cvs.commit-message}'"/>
+    </exec>
   </target>
 
 </project>