You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2003/11/04 18:34:13 UTC

cvs commit: jakarta-gump/python/gump update.py build.py document.py

ajack       2003/11/04 09:34:13

  Modified:    python/gump update.py build.py document.py
  Log:
  1) Moved sync to update (from build) since is more appropriate
  2) Attempted to cope w/ 'alias' projects in build list
  [needed since we need those in build list in order to document correctly.]
  
  Revision  Changes    Path
  1.19      +51 -15    jakarta-gump/python/gump/update.py
  
  Index: update.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/update.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- update.py	19 Oct 2003 17:46:36 -0000	1.18
  +++ update.py	4 Nov 2003 17:34:13 -0000	1.19
  @@ -94,13 +94,6 @@
   def mangle(passwd):
     return 'A' + ''.join(map(chr,[shifts[ord(c)] for c in str(passwd or '')]))
   
  -def update(workspace, expr='*', context=GumpContext()):
  -        
  -  log.debug('--- Updating work directories from (CVS) Repositories ')
  -
  -  modules = getModulesForProjectList(getBuildSequenceForProjects(getProjectsForProjectExpression(expr)))
  -      
  -  return updateModules(workspace,modules,context)
   
   def readLogins():
     # read the list of cvs repositories that the user is already logged into
  @@ -159,7 +152,19 @@
                   + ' @ ' + root + ' method: ' + str(repository.root.method) )            
       except Exception, detail:
           log.error('Failed to loginToRepositoryOnDemand. Details: ' + str(detail))
  -                     
  +                   
  +def update(workspace, expr='*', context=GumpContext()):
  +        
  +  log.debug('--- Updating work directories from (CVS) Repositories ')
  +
  +  modules = getModulesForProjectList(getBuildSequenceForProjects(getProjectsForProjectExpression(expr)))
  +      
  +  # Update CVS dirs from repositories
  +  updateModules(workspace,modules,context)
  +  
  +  # Sync the CVS sub-dirs with work dirs
  +  syncWorkDirs(workspace,modules,context)
  +    
   def updateModules(workspace, modules, context=GumpContext()):
    
     os.chdir(workspace.cvsdir)
  @@ -265,6 +270,38 @@
             
             mctxt.propagateErrorState(STATUS_FAILED,REASON_UPDATE_FAILED)  
           
  +
  +def syncWorkDirs( workspace, modules, context ):
  +  """copy the raw module (project) materials from source to work dir (hopefully using rsync, cp is fallback)"""
  +
  +  log.debug('--- Synchronizing work directories with sources')  
  +
  +  for module in modules:
  +    
  +    # If no CVS, nothing to sync   
  +    if not module.cvs: continue
  +    
  +    (mctxt) = context.getModuleContextForModule(module)
  +      
  +    if mctxt.okToPerformWork() \
  +        and Module.list.has_key(module.name) \
  +        and not switch.failtesting:
  +            
  +        module=Module.list[module.name];
  +        sourcedir = os.path.abspath(os.path.join(workspace.cvsdir,module.name)) # todo allow override
  +        destdir = os.path.abspath(workspace.basedir)
  +        
  +        work=syncDirectories(context,workspace,WORK_TYPE_SYNC,dir.work,sourcedir,destdir,module.name)
  +        
  +        mctxt.performedWork(work)
  +
  +        # Update Context w/ Results  
  +        if not work.result.status==CMD_STATUS_SUCCESS:
  +            mctxt.propagateErrorState(STATUS_FAILED,REASON_SYNC_FAILED)
  +        else:
  +            mctxt.status=STATUS_SUCCESS
  +        
  +        
   if __name__=='__main__':
   
     # init logging
  @@ -282,10 +319,9 @@
     
     context=GumpContext()
     
  -  logins=readLogins()
  -  
  -  dump(logins)
  +  # logins=readLogins()  
  +  # dump(logins)
             
  -  # update(workspace, ps, context)
  +  update(workspace, ps, context)
     
     # dump(context)
  
  
  
  1.33      +5 -45     jakarta-gump/python/gump/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- build.py	4 Nov 2003 16:15:03 -0000	1.32
  +++ build.py	4 Nov 2003 17:34:13 -0000	1.33
  @@ -120,54 +120,18 @@
   
     return buildProjectSequence(workspace,sequence,context,nosync)
     
  -def buildProjectSequence(workspace,sequence,context,nosync=None):
  +def buildProjectSequence(workspace,sequence,context):
       
     log.debug('Total Project Sequence (i.e. build order):');
     for p in sequence:
       log.debug('  Sequence : ' + p.name)
   
  -  # synchronize @ module level
  -  if not nosync:  syncWorkDir( workspace, sequence, context )
  -
     # build
     buildProjects( workspace, sequence, context )
     
     return context.status
   
   
  -def syncWorkDir( workspace, sequence, context ):
  -  """copy the raw module (project) materials from source to work dir (hopefully using rsync, cp is fallback)"""
  -
  -  log.debug('--- Synchronizing work directories with sources')
  -
  -  modules=getModulesForProjectList(sequence)
  -  
  -  log.debug('Total Module Sequence:');
  -  for m in modules:
  -    log.debug('  Modules : ' + m.name)    
  -
  -  for module in modules:
  -      
  -    (mctxt) = context.getModuleContextForModule(module)
  -      
  -    if mctxt.okToPerformWork() \
  -        and Module.list.has_key(module.name) \
  -        and not switch.failtesting:
  -            
  -        module=Module.list[module.name];
  -        sourcedir = os.path.abspath(os.path.join(workspace.cvsdir,module.name)) # todo allow override
  -        destdir = os.path.abspath(workspace.basedir)
  -        
  -        work=syncDirectories(context,workspace,WORK_TYPE_SYNC,dir.work,sourcedir,destdir,module.name)
  -        
  -        mctxt.performedWork(work)
  -
  -        # Update Context w/ Results  
  -        if not work.result.status==CMD_STATUS_SUCCESS:
  -            mctxt.propagateErrorState(STATUS_FAILED,REASON_SYNC_FAILED)
  -        else:
  -            mctxt.status=STATUS_SUCCESS
  -
   def buildProjects( workspace, sequence, context ):
     """actually perform the build of the specified project and its deps"""
   
  @@ -316,10 +280,6 @@
     ws=args[0]
     ps=args[1]
     
  -  # Allow a nosync option
  -  nosync=None
  -  if len(args) > 2: nosync=args[2]
  -  
     # A context to work into...
     context=GumpContext()
     
  @@ -329,7 +289,7 @@
     #
     # Perform build tasks
     #
  -  result = build(workspace, ps, context, nosync)
  +  result = build(workspace, ps, context)
   
     # bye!
     sys.exit(result)
  
  
  
  1.106     +2 -2      jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.105
  retrieving revision 1.106
  diff -u -r1.105 -r1.106
  --- document.py	4 Nov 2003 16:15:03 -0000	1.105
  +++ document.py	4 Nov 2003 17:34:13 -0000	1.106
  @@ -143,7 +143,7 @@
       
       if context.gumpset.isFull():
           documentStatistics(workspace,context,db,moduleList,projectList)
  -        documentXRef(workspace,context)
  +        documentXRef(workspace,context,moduleList,projectList)
   
       executeForrest(workspace,context)
   
  @@ -1335,7 +1335,7 @@
       url += getContextUrl(context,0)
       return url
           
  -def getContextDirUrl(context,depth=1):
  +def getContextDirRelativeUrl(context,depth=1):
       if isinstance(context,GumpContext):
           url=getWorkspaceDirRelativeUrl(depth)
       elif isinstance(context,ModuleContext):