gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: rev 37357 - in gump/trunk: python/gump/model python/gump/notify python/gump/repository python/gump/run python/gump/stats/dbm python/gump/test python/gump/update python/gump/utils src/documentation/content/xdocs/metadata test
Date Thu, 02 Sep 2004 05:07:31 GMT
Author: ajack
Date: Wed Sep  1 22:07:30 2004
New Revision: 37357

Modified:
   gump/trunk/python/gump/model/module.py
   gump/trunk/python/gump/model/repository.py
   gump/trunk/python/gump/notify/notifier.py
   gump/trunk/python/gump/repository/artifact.py
   gump/trunk/python/gump/run/gumpenv.py
   gump/trunk/python/gump/stats/dbm/statsdb.py
   gump/trunk/python/gump/test/artifacts.py
   gump/trunk/python/gump/update/updater.py
   gump/trunk/python/gump/utils/smtp.py
   gump/trunk/python/gump/utils/sync.py
   gump/trunk/python/gump/utils/timing.py
   gump/trunk/src/documentation/content/xdocs/metadata/module.xml
   gump/trunk/src/documentation/content/xdocs/metadata/repository.xml
   gump/trunk/test/gumptest.sh
Log:
Applied Peter Janes (peterj@liberate.com) Perforce addition, and other 
fixes.


Modified: gump/trunk/python/gump/model/module.py
==============================================================================
--- gump/trunk/python/gump/model/module.py	(original)
+++ gump/trunk/python/gump/model/module.py	Wed Sep  1 22:07:30 2004
@@ -129,6 +129,62 @@
     def getViewUrl(self):
         return self.getRootUrl()
          
+class ModuleP4(ModelObject):
+    def __init__(self,dom,repository):
+        ModelObject.__init__(self,dom)
+
+        # Reference to the shared repository
+        self.repository=repository
+        self.hostname='perforce:1666'
+        if repository.hasDomChild('root'):
+            root=repository.getDomChild('root')
+            self.method=getDomChildValue(root,'method')
+            self.user=getDomChildValue(root,'user')
+            self.password=getDomChildValue(root,'password')
+            self.path=getDomChildValue(root,'path')
+            self.hostname=getDomChildValue(root,'hostname')
+            self.clientspec=getDomChildValue(root,'clientspec')
+
+        self.tag=self.getDomAttributeValue('tag')
+
+        # Extract settings
+        self.dir=self.getDomAttributeValue('dir')
+
+    def getPort(self):
+        return str(self.hostname)
+
+    def getUser(self):
+        return str(self.user)
+
+    def getPassword(self):
+        return str(self.password)
+
+    def getClientspec(self):
+        return str(self.clientspec)
+    
+    def hasTag(self):
+        if self.tag: return True
+        return False
+        
+    def getTag(self):
+        return str(self.tag)
+        
+    def getRootUrl(self):
+        url=self.repository.getUrl()
+        if self.hasDir():
+            url+=self.getDir()
+        return url
+
+    def hasDir(self):
+        if self.dir: return True
+        return False
+
+    def getDir(self):
+        return self.dir
+
+    def getViewUrl(self):
+        return self.getRootUrl()
+        
 class ModuleArtifacts(ModelObject):
     def __init__(self,dom,repository):
         ModelObject.__init__(self,dom)
@@ -176,6 +232,7 @@
     	self.cvs=None
     	self.svn=None
     	self.artifacts=None
+    	self.p4=None
     	
         self.packaged		=	False 
         self.redistributable=   False
@@ -381,6 +438,21 @@
                         self.addError('No such repository ['+ str(repoName) +'] in workspace
on [' \
                                 + self.getName() + ']')                 
                                                 
+            elif self.hasDomChild('p4'):
+                p4dom=self.getDomChild('p4')
+                repoName=getDomAttributeValue(p4dom,'repository')
+                if repoName:
+                    if workspace.hasRepository(repoName):
+                        # It references this repository
+                        repo=workspace.getRepository(repoName)
+                        self.repository=repo
+                        repo.addModule(self)
+                        self.p4=ModuleP4(p4dom,repo)
+                    else:
+                        self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
+                        self.addError('No such repository ['+ str(repoName) + '] in workspace
on [' \
+                                + self.getName() + ']')
+
             elif self.hasDomChild('artifacts'):
                 adom=self.getDomChild('artifacts')
                 repoName=getDomAttributeValue(adom,'repository')
@@ -640,6 +712,10 @@
         if self.svn: return True
         return False
         
+    def hasP4(self):
+        if self.p4: return True
+        return False
+        
     def hasArtifacts(self):
         if self.artifacts: return True
         return False
@@ -669,6 +745,8 @@
             return self.cvs.getViewUrl()
         elif self.hasSvn():
             return self.svn.getViewUrl()            
+        elif self.hasP4():
+            return self.p4.getViewUrl()            
 
 class ModuleStatistics(Statistics):
     """ 
@@ -698,4 +776,4 @@
         # Track code updates/changes
         # 
         if module.isModified():
-            self.lastModified=default.datetime
\ No newline at end of file
+            self.lastModified=default.datetime

Modified: gump/trunk/python/gump/model/repository.py
==============================================================================
--- gump/trunk/python/gump/model/repository.py	(original)
+++ gump/trunk/python/gump/model/repository.py	Wed Sep  1 22:07:30 2004
@@ -42,7 +42,7 @@
         if 'cvs'==type:
             self.type='CVS'    
             self.web=self.getDomChildValue('cvsweb') or \
-                        self.getDomChildValue('web')                            
+                        self.getDomChildValue('web')
             if self.hasDomChild('root'):
                 root=self.getDomChild('root')
                 self.method=getDomChildValue(root,'method')  
@@ -66,6 +66,14 @@
             else:
                 raise RuntimeError, 'No URL on Jars repository: ' + self.getName()      
         
             self.web=self.getDomChildValue('web')
+        elif 'p4'==type:
+            self.type='Perforce'
+            if self.hasDomChild('root'):
+                root=self.getDomChild('root')
+                self.p4port=getDomChildValue(root,'hostname')
+            else:
+                raise RuntimeError, 'No Perforce server on P4 repository: ' + self.getName()
+            self.web=self.getDomChildValue('web')
         else:
             raise RuntimeError, 'Invalid Repository Type:' + str(xml.type)         
             
@@ -149,4 +157,4 @@
     def getKeyBase(self):
         return 'repository:'+ self.name        
         
-    
\ No newline at end of file
+    

Modified: gump/trunk/python/gump/notify/notifier.py
==============================================================================
--- gump/trunk/python/gump/notify/notifier.py	(original)
+++ gump/trunk/python/gump/notify/notifier.py	Wed Sep  1 22:07:30 2004
@@ -351,7 +351,7 @@
             log.info('Send Notify To: ' + str(toaddr) + 
                 ' From: ' + str(fromaddr) + ' Subject: ' + str(subject))
            
-            # Form the user visable part ...
+            # Form the user visible part ...
             email=EmailMessage( toaddrs, 
                                 fromaddr, 
                                 subject, 

Modified: gump/trunk/python/gump/repository/artifact.py
==============================================================================
--- gump/trunk/python/gump/repository/artifact.py	(original)
+++ gump/trunk/python/gump/repository/artifact.py	Wed Sep  1 22:07:30 2004
@@ -62,7 +62,7 @@
         if not os.path.exists(rdir): os.makedirs(rdir)
         return rdir  
     
-    def _getGroupDir(self,group,rdir=None):
+    def getGroupDir(self,group,rdir=None):
         """    
         	Repository format is:
     
@@ -94,7 +94,7 @@
         if recent:
             
             # Locate (and make if needed) group.
-            gdir=self._getGroupDir(group)   
+            gdir=self.getGroupDir(group)   
         
             for file in os.listdir(gdir):
                 match=ArtifactRepository.ARTIFACT_RE.match(file)
@@ -103,7 +103,7 @@
                     
     def publish(self,group,artifact,id=None):
         """
-        Publish an artifact ot the artifact repository.
+        Publish an artifact at the artifact repository.
         """
         
         # Locate (and make if needed) group.
@@ -140,7 +140,7 @@
         """
         
         # Locate (and make if needed) group.
-        gdir=self._getGroupDir(group)   
+        gdir=self.getGroupDir(group)   
         
         # See what we have
         dates={}
@@ -172,4 +172,4 @@
          """
          (dates,mostRecent)=self.extractGroup(group)
          if dates: return dates[mostRecent]
-         
\ No newline at end of file
+         

Modified: gump/trunk/python/gump/run/gumpenv.py
==============================================================================
--- gump/trunk/python/gump/run/gumpenv.py	(original)
+++ gump/trunk/python/gump/run/gumpenv.py	Wed Sep  1 22:07:30 2004
@@ -75,6 +75,7 @@
     	self.noUpdate=False    
     	self.noSvn=False    	
     	self.noCvs=False   
+    	self.noP4=False   
         self.noJava=False
         self.noJavac=False
         
@@ -168,6 +169,10 @@
         if not self.noSvn and not self._checkExecutable('svn','--version',False):
             self.noSvn=True
             self.addWarning('"svn" command not found, no SVN repository updates')
+          
+        if not self.noP4 and not self._checkExecutable('p4','-V',False):
+            self.noP4=True
+            self.addWarning('"p4" command not found, no Perforce repository updates')
           
         if not self.noUpdate and \
             not self._checkExecutable(getDepotUpdateCmd(),'-version',False,False,'check_depot_update'):


Modified: gump/trunk/python/gump/stats/dbm/statsdb.py
==============================================================================
--- gump/trunk/python/gump/stats/dbm/statsdb.py	(original)
+++ gump/trunk/python/gump/stats/dbm/statsdb.py	Wed Sep  1 22:07:30 2004
@@ -208,12 +208,12 @@
         dateF=self._get(key)
         
         if dateF:
-            print 'dateF ' + dateF
+            #print 'dateF ' + dateF
             if not ' ' in dateF:
                 # Historical float perhaps?
                 date=datetime.datetime.utcfromtimestamp(int(dateF))
             else:
-                date=datetime.datetime.utcfromtimestamp(time.mktime(time.strptime('%Y-%m-%d
%H:%M:%S')))
+                date=datetime.datetime.utcfromtimestamp(time.mktime(time.strptime(dateF,'%Y-%m-%d
%H:%M:%S')))
         else:
             date=None
             
@@ -242,4 +242,4 @@
         """
         if hasattr(self.db, 'sync'):
             self.db.sync()
-          
\ No newline at end of file
+          

Modified: gump/trunk/python/gump/test/artifacts.py
==============================================================================
--- gump/trunk/python/gump/test/artifacts.py	(original)
+++ gump/trunk/python/gump/test/artifacts.py	Wed Sep  1 22:07:30 2004
@@ -77,7 +77,7 @@
         # Create a repository & populate it
         self.repo=gump.repository.artifact.ArtifactRepository(self.testRepo)   
         
-        gdir=self.repo._getGroupDir('test')
+        gdir=self.repo.getGroupDir('test')
         
         file(os.path.join(gdir,'id1-gump-20030221.jar'),'w').close()
         file(os.path.join(gdir,'id1-gump-20040221.jar'),'w').close()
@@ -98,4 +98,4 @@
         self.assertNotNone('Extracted something', dated)
         self.assertEqual('Extracted correct groups', len(dated.keys()), 3)
         self.assertEqual('Detected correct latest', latest, '20050221')
-        
\ No newline at end of file
+        

Modified: gump/trunk/python/gump/update/updater.py
==============================================================================
--- gump/trunk/python/gump/update/updater.py	(original)
+++ gump/trunk/python/gump/update/updater.py	Wed Sep  1 22:07:30 2004
@@ -29,6 +29,7 @@
 
 from gump.update.cvs import CvsUpdater
 from gump.update.svn import SvnUpdater
+from gump.update.p4 import P4Updater
 from gump.update.artifact import ArtifactUpdater
 
 from gump.utils import dump, display, getIndent, logResourceUtilization, \
@@ -57,6 +58,7 @@
         
         self.cvs=CvsUpdater(run)
         self.svn=SvnUpdater(run)
+        self.p4=P4Updater(run)
         self.artifact=ArtifactUpdater(run)
 
     """
@@ -99,7 +101,7 @@
     
         workspace = self.run.getWorkspace()
         
-        log.debug("Workspace CVS|SVN|artifacts Directory: " + workspace.getSourceControlStagingDirectory())
+        log.debug("Workspace CVS|SVN|P4|artifacts Directory: " + workspace.getSourceControlStagingDirectory())
 
         # Update all the modules that have CVS repositories
         for module in list: 
@@ -125,6 +127,8 @@
                 ok=self.cvs.updateModule(module)
             elif module.hasSvn():
                 ok=self.svn.updateModule(module)
+            if module.hasP4():
+                ok=self.p4.updateModule(module)
             elif module.hasArtifacts():
                 ok=self.artifact.updateModule(module)        
             else:
@@ -195,7 +199,9 @@
             ok=self.cvs.preview(module)
         elif module.hasSvn():
             ok=self.svn.preview(module)
+        elif module.hasP4():
+            ok=self.p4.preview(module)
         elif module.hasArtifacts():
             ok=self.artifact.preview(module)        
         else:
-            print 'No updater for module: ' + module.getName()            
\ No newline at end of file
+            print 'No updater for module: ' + module.getName()            

Modified: gump/trunk/python/gump/utils/smtp.py
==============================================================================
--- gump/trunk/python/gump/utils/smtp.py	(original)
+++ gump/trunk/python/gump/utils/smtp.py	Wed Sep  1 22:07:30 2004
@@ -60,7 +60,7 @@
         """E-mail"""
         # Add the From: and To: headers at the start!
         data = ("Date: %s\r\nFrom: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s%s"
-           	% (	time.strftime('%d %b %y %H:%M:%S', time.gmtime()),
+           	% (	time.strftime('%a, %d %b %y %H:%M:%S %Z', time.localtime()),
                         #self.fromaddr.encode(),
                         self.fromaddr, 
            		string.join(self.toaddrs, ", "),
@@ -68,7 +68,6 @@
                         self.subject,
            		self.text,
            		default.signature))
-           		
         return data;
      
 #
@@ -141,14 +140,14 @@
     #set verbosity to show all messages of severity >= default.logLevel
     log.setLevel(default.logLevel)
    
-    email=EmailMessage('Adam Jack <ajack@trysybase.com>',\
-                    'Adam Jack <ajack@trysybase.com>',\
+    email=EmailMessage(['Adam Jack <ajack@trysybase.com>'],\
+                    'Adam Jack <ajack@trysybase.com>', \
                     'Hi','There')
   
-    mail([default.email],default.email,email,default.mailserver)
+    #mail([default.email],default.email,email,default.mailserver)
   
-    mail([ 'ajack@trysybase.com' ],default.email,email,default.mailserver)
+    mail(['ajack@trysybase.com'],default.email,email,default.mailserver)
   
-    print sanitizeAddress('Adam Jack <ajack@trysybase.com>')
+    print sanitizeAddress('Adam Jack <ajack@trysybase.com>') 
   
   

Modified: gump/trunk/python/gump/utils/sync.py
==============================================================================
--- gump/trunk/python/gump/utils/sync.py	(original)
+++ gump/trunk/python/gump/utils/sync.py	Wed Sep  1 22:07:30 2004
@@ -210,14 +210,17 @@
             fulldestfile = os.path.join(destdir, afile)
             if not afile in acceptablefiles:
                 tobedeleted = os.path.join(destdir, afile)
-                destinationStat = os.stat(tobedeleted)
-                if S_ISDIR(destinationStat[ST_MODE]):
-                    if self.isDebug(): log.debug('Attempting to remove directory [%s]' %
(`tobedeleted`))
-                    self.displayAction(False,' -D ', tobedeleted)    
-                    shutil.rmtree(tobedeleted)
-                else:    
-                    if self.isDebug(): log.debug('Attempting to remove file [%s]' % (`tobedeleted`))
  
-                    self.displayAction(False,' -F ', tobedeleted)    
+                try:
+                    destinationStat = os.stat(tobedeleted)
+                    if S_ISDIR(destinationStat[ST_MODE]):
+                        if self.isDebug(): log.debug('Attempting to remove directory [%s]'
% (`tobedeleted`))
+                        self.displayAction(False,' -D ', tobedeleted)    
+                        shutil.rmtree(tobedeleted)
+                    else:    
+                        if self.isDebug(): log.debug('Attempting to remove file [%s]' % (`tobedeleted`))
  
+                        self.displayAction(False,' -F ', tobedeleted)    
+                        os.remove(tobedeleted)
+                except (IOError, os.error), why:
                     os.remove(tobedeleted)
                     
     def removenonmatching(self, sourcedir, destdir, acceptablefiles, existingfiles):
@@ -316,4 +319,4 @@
     """
     def __init__(self, sourcedir, targetdir, output=None, debug=0):
         PathWalker.__init__(self, sourcedir, targetdir, SYNC_ACTION, output, debug)
-        
\ No newline at end of file
+        

Modified: gump/trunk/python/gump/utils/timing.py
==============================================================================
--- gump/trunk/python/gump/utils/timing.py	(original)
+++ gump/trunk/python/gump/utils/timing.py	Wed Sep  1 22:07:30 2004
@@ -193,7 +193,7 @@
                 toDateTime(self.timestamp) 
                 
     def __cmp__(self,other):
-        return int(self.timestamp - other.timestamp) 
+        return (self.timestamp < other.timestamp)
         
 class TimeStampRange:       
     def __init__(self,name,start=None,end=None,external=False):
@@ -384,4 +384,4 @@
         
     def getEnd(self):
         return self.times.getEnd()
-    
\ No newline at end of file
+    

Modified: gump/trunk/src/documentation/content/xdocs/metadata/module.xml
==============================================================================
--- gump/trunk/src/documentation/content/xdocs/metadata/module.xml	(original)
+++ gump/trunk/src/documentation/content/xdocs/metadata/module.xml	Wed Sep  1 22:07:30 2004
@@ -162,6 +162,30 @@
 </source>    
     </section>
 
+    <section><title>p4</title>
+
+      <p>References a <link href="http://www.perforce.com/">Perforce</link>

+      repository in which this project resides.</p>
+
+      <table>
+        <tr>
+          <th>Attribute</th>
+          <th>Description</th>
+          <th>Required?</th>
+        </tr>
+        <tr>
+          <td>repository</td>
+          <td>The name of the repository in which this module resides.</td>
+          <td>Yes</td>
+        </tr>
+      </table>
+
+      <p>For example:</p>
+          <source>
+  &lt;p4 repository="my-p4-repository"/&gt;
+</source>    
+    </section>
+
     <section><title>project</title>
       <p>A definition of a <link href="project.html">project</link> which
is
       physically contained in this module.</p>

Modified: gump/trunk/src/documentation/content/xdocs/metadata/repository.xml
==============================================================================
--- gump/trunk/src/documentation/content/xdocs/metadata/repository.xml	(original)
+++ gump/trunk/src/documentation/content/xdocs/metadata/repository.xml	Wed Sep  1 22:07:30
2004
@@ -43,7 +43,7 @@
       <tr>
         <td>type</td>
         <td>Type of repository.</td>
-        <td><strong>cvs</strong>,<strong>svn</strong>,<strong>jars</strong>
currently supported.</td>
+        <td><strong>cvs</strong>,<strong>svn</strong>,<strong>jars</strong>,<strong>p4</strong>
currently supported.</td>
       </tr>
       <tr>
         <td>compress</td>
@@ -77,7 +77,7 @@
       </tr>
       <tr>
         <td>web</td>
-        <td>Web interface to the repository. (More approprice for multiple types).</td>
+        <td>Web interface to the repository. (More appropriate for multiple types).</td>
         <td>No</td>
       </tr>
       <tr>
@@ -95,7 +95,7 @@
 			<p>This specifies all of the elements which are combined to form
       a CVSROOT.  They are split out into separate entities so that each
       can be individually overridden in a workspace definition.  When an
-      entity is listed a required below, it means that when all of the
+      entity is listed as required below, it means that when all of the
       definitions are combined the entity must have a value - a workspace
       or profile, for example, only needs to contain the values which it
       overrides.</p>
@@ -134,6 +134,47 @@
       </table>
     </section>
 	</section>
-  </section>
+	<section>
+		<title>Perforce Usage</title>
+		<section><title>root</title>
+			<note>This is for type='p4' only.</note>
+			<p>This specifies all of the elements which are combined to communicate
+      with a Perforce server.  They are split out into separate entities
+      so that each can be individually overridden in a workspace definition.
+      When an entity is listed as required below, it means that when all of
+      the definitions are combined the entity must have a value - a workspace
+      or profile, for example, only needs to contain the values which it
+      overrides.</p>
+
+      <table>
+        <tr>
+          <th>Entity</th>
+          <th>Description</th>
+          <th>Required?</th>
+        </tr>
+        <tr>
+          <td>clientspec</td>
+          <td>A Perforce clientspec is a set of mappings from server paths to local
paths.  The Perforce server keeps track of what files are "current" in a particular clientspec;
as a result, a clientspec cannot be shared across Gump instances.  It is recommended to set
the <samp>allwrite</samp> option in the clientspec.</td>
+          <td>Yes</td>
+        </tr>
+        <tr>
+          <td>user</td>
+          <td>Defaults to user running Gump</td>
+          <td>No</td>
+        </tr>
+        <tr>
+          <td>password</td>
+          <td/>
+          <td>No</td>
+        </tr>
+        <tr>
+          <td>hostname</td>
+          <td>Defaults to perforce:1666</td>
+          <td>No</td>
+        </tr>
+      </table>
+    </section>
+	</section>
+	</section>
 </body>
 </document>

Modified: gump/trunk/test/gumptest.sh
==============================================================================
--- gump/trunk/test/gumptest.sh	(original)
+++ gump/trunk/test/gumptest.sh	Wed Sep  1 22:07:30 2004
@@ -44,10 +44,10 @@
 $GUMP_PYTHON gump/test/pyunit.py
 
 echo "Run the environment check"
-$GUMP_PYTHON gump\env.py
+$GUMP_PYTHON ../bin/env.py
 
 echo "Run the workspace check"
-$GUMP_PYTHON gump\check.py -w ../test-workspace.xml all --debug
+$GUMP_PYTHON ../bin/check.py -w ../metadata/test-workspace.xml all --debug
 
 echo "Run the workspace preview"
-$GUMP_PYTHON gump\preview.py -w ../test-workspace.xml all --debug
\ No newline at end of file
+$GUMP_PYTHON ../bin/preview.py -w ../metadata/test-workspace.xml all --debug

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message