gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump/python/gump/core gumprun.py
Date Wed, 19 May 2004 21:14:19 GMT
ajack       2004/05/19 14:14:19

  Modified:    python/gump/build Tag: MultiRunner maven.py ant.py script.py
                        builder.py
               python/gump/test/resources/complete1 Tag: MultiRunner
                        module1.xml
               python/gump/test/resources/full1 Tag: MultiRunner
                        module1.xml
               python/gump/core Tag: MultiRunner gumprun.py
  Log:
  Test/Fix...
  
  1) Don't sort module order, allow it to match project order...
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.6   +1 -1      gump/python/gump/build/Attic/maven.py
  
  Index: maven.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/maven.py,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- maven.py	19 May 2004 20:48:34 -0000	1.1.2.5
  +++ maven.py	19 May 2004 21:14:19 -0000	1.1.2.6
  @@ -56,7 +56,7 @@
           
           workspace=self.run.getWorkspace()
                   
  -        log.debug(' ------ Maven-ing: [' + `project.getPosition()` + '] ' + project.getName())
  +        log.debug(' ------ Maven-ing: #[' + `project.getPosition()` + '] ' + project.getName())
           
           self.performPreBuild(project, stats)
             
  
  
  
  1.1.2.4   +1 -1      gump/python/gump/build/Attic/ant.py
  
  Index: ant.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/ant.py,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ant.py	19 May 2004 20:14:15 -0000	1.1.2.3
  +++ ant.py	19 May 2004 21:14:19 -0000	1.1.2.4
  @@ -57,7 +57,7 @@
           
           workspace=self.run.getWorkspace()
                    
  -        log.info(' Ant-ing: #[' + `project.getPosition()` + '] : ' + project.getName())
  +        log.info(' ------ Ant-ing: #[' + `project.getPosition()` + '] : ' + project.getName())
       
           #
           # Get the appropriate build command...
  
  
  
  1.1.2.4   +28 -52    gump/python/gump/build/Attic/script.py
  
  Index: script.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/script.py,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- script.py	19 May 2004 16:01:59 -0000	1.1.2.3
  +++ script.py	19 May 2004 21:14:19 -0000	1.1.2.4
  @@ -54,65 +54,41 @@
           
           workspace=self.run.getWorkspace()
                    
  -        log.info(' Project: #[' + `project.getPosition()` + '] : ' + project.getName())
  +        log.info(' ------ Script-ing: #[' + `project.getPosition()` + '] : ' + project.getName())
                   
  -        # Do this even if not ok
  -        self.performPreBuild(project, stats)
  -
  -        wasBuilt=0
  -        if project.okToPerformWork():        
  -            log.debug(' ------ Building: [' + `projectNo` + '] ' + project.getName())
  -
  -            # Turn on --verbose or --debug if failing ...
  -            if stats:
  -                if (not STATE_SUCCESS == stats.currentState) and \
  -                        not project.isVerboseOrDebug():
  -                    if stats.sequenceInState > INSIGNIFICANT_DURATION:
  -                        project.addInfo('Enable "debug" output, due to a sequence of %s
previous errors.' % stats.sequenceInState)
  -                        project.setDebug(1)
  -                    else:
  -                        project.addInfo('Enable "verbose" output, due to %s previous error(s).'
% stats.sequenceInState)    
  -                        project.setVerbose(1)
  -
  -            #
  -            # Get the appropriate build command...
  -            #
  -            cmd=project.getBuildCommand(self.run.getEnvironment().getJavaCommand())
  +        #
  +        # Get the appropriate build command...
  +        #
  +        cmd=self.getScriptCommand(project)
   
  -            if cmd:
  -                # Execute the command ....
  -                cmdResult=execute(cmd,workspace.tmpdir)
  +        if cmd:
  +            # Execute the command ....
  +            cmdResult=execute(cmd,workspace.tmpdir)
       
  -                # Update Context    
  -                work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
  -                project.performedWork(work)
  -                wasBuilt=1
  +            # Update Context    
  +            work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
  +            project.performedWork(work)
                       
  -                # Update Context w/ Results  
  -                if not cmdResult.state==CMD_STATE_SUCCESS:
  -                    reason=REASON_BUILD_FAILED
  -                    if cmdResult.state==CMD_STATE_TIMED_OUT:
  -                        reason=REASON_BUILD_TIMEDOUT
  -                    project.changeState(STATE_FAILED,reason)
  -                        
  -                    if not project.isDebug():
  -                        # Display...
  -                        project.addInfo('Enable "debug" output, due to build failure.')
  -                        project.setDebug(1)
  +            # Update Context w/ Results  
  +            if not cmdResult.state==CMD_STATE_SUCCESS:
  +                reason=REASON_BUILD_FAILED
  +                if cmdResult.state==CMD_STATE_TIMED_OUT:
  +                    reason=REASON_BUILD_TIMEDOUT
  +                project.changeState(STATE_FAILED,reason)
                           
  -                else:                         
  -                    # For now, things are going good...
  -                    project.changeState(STATE_SUCCESS)
  +            else:                         
  +                # For now, things are going good...
  +                project.changeState(STATE_SUCCESS)
      
  -    def getScriptCommand(self):
  +    def getScriptCommand(self,project):
           """ Return the command object for a <script entry """
  -        script=self.script
  -        scriptxml=self.xml.script 
  +        script=project.script
  +        scriptxml=project.xml.script 
              
           #
           # Where to run this:
           #
  -        basedir = script.getBaseDirectory() or self.getBaseDirectory()
  +        basedir = script.getBaseDirectory() or project.getBaseDirectory()
   
           # Add .sh  or .bat as appropriate to platform
           scriptfullname=scriptxml.name
  @@ -128,9 +104,9 @@
           scriptfile=os.path.abspath(os.path.join(basedir, scriptfullname))
           
           # Not sure this is relevent...
  -        (classpath,bootclasspath)=self.getClasspaths()
  +        (classpath,bootclasspath)=project.getClasspaths()
   
  -        cmd=Cmd(scriptfile,'buildscript_'+self.getModule().getName()+'_'+self.getName(),\
  +        cmd=Cmd(scriptfile,'buildscript_'+project.getModule().getName()+'_'+project.getName(),\
               basedir,{'CLASSPATH':classpath})    
               
           # Set this as a system property. Setting it here helps JDK1.4+
  @@ -151,9 +127,9 @@
           # Allow script-level debugging...
           #
           # Per GUMP-48 scripts do not want this.        
  -        #if self.getWorkspace().isDebug() or self.isDebug() or debug:
  +        #if project.getWorkspace().isDebug() or project.isDebug() or debug:
           #    cmd.addParameter('-debug')  
  -        #if self.getWorkspace().isVerbose()  or self.isVerbose() or verbose:
  +        #if project.getWorkspace().isVerbose()  or project.isVerbose() or verbose:
           #    cmd.addParameter('-verbose')  
           
           return cmd
  
  
  
  1.1.2.6   +2 -2      gump/python/gump/build/Attic/builder.py
  
  Index: builder.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/builder.py,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- builder.py	19 May 2004 20:14:15 -0000	1.1.2.5
  +++ builder.py	19 May 2004 21:14:19 -0000	1.1.2.6
  @@ -57,7 +57,7 @@
           
           self.ant=AntBuilder(run)
           self.maven=MavenBuilder(run)
  -        self.script=MavenBuilder(run)
  +        self.script=ScriptBuilder(run)
   
           # Place repository in jardir (to be renamed to repodir)
           self.repository=self.run.getOutputsRepository()
  @@ -168,7 +168,7 @@
                   self.script.buildProject(project, stats)
               elif project.hasAnt():
                   self.ant.buildProject(project, stats)
  -            if project.hasMaven():
  +            elif project.hasMaven():
                   self.maven.buildProject(project, stats)
               
               # A build attempt was made...
  
  
  
  No                   revision
  No                   revision
  1.1.2.3   +1 -1      gump/python/gump/test/resources/complete1/Attic/module1.xml
  
  Index: module1.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/complete1/Attic/module1.xml,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- module1.xml	17 May 2004 21:41:21 -0000	1.1.2.2
  +++ module1.xml	19 May 2004 21:14:19 -0000	1.1.2.3
  @@ -14,7 +14,7 @@
     <project name="project1">
       <package>org.apache.project1</package>
   
  -    <ant target="gump"/>
  +    <script name="gumpscript"/>
   
       <option project="random"/>
   
  
  
  
  No                   revision
  No                   revision
  1.6.2.1   +1 -1      gump/python/gump/test/resources/full1/module1.xml
  
  Index: module1.xml
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resources/full1/module1.xml,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- module1.xml	12 Feb 2004 13:41:52 -0000	1.6
  +++ module1.xml	19 May 2004 21:14:19 -0000	1.6.2.1
  @@ -13,7 +13,7 @@
     <project name="project1">
       <package>org.apache.project1</package>
   
  -    <ant target="gump"/>
  +    <script name="gumpscript"/>
   
       <option project="random"/>
   
  
  
  
  No                   revision
  No                   revision
  1.5.2.6   +18 -13    gump/python/gump/core/gumprun.py
  
  Index: gumprun.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/core/gumprun.py,v
  retrieving revision 1.5.2.5
  retrieving revision 1.5.2.6
  diff -u -r1.5.2.5 -r1.5.2.6
  --- gumprun.py	19 May 2004 20:14:16 -0000	1.5.2.5
  +++ gumprun.py	19 May 2004 21:14:19 -0000	1.5.2.6
  @@ -181,18 +181,23 @@
                   self.getProjectsForProjectExpression(expr))
     
       def getModulesForProjectList(self,projects):
  -        modules=[]
  +        sequence=[]
           for project in projects:
               
  -            # Some projects are outside of modules
  +            # Some projects are outside of sequence
               if project.inModule():
                   # Get the module this project is in
                   module = project.getModule()
  -                if not module in modules: 
  -                    modules.append(module)
  +                if not module in sequence: 
  +                    sequence.append(module)
  +                    module.setPosition(len(sequence))
   
  -        modules.sort()
  -        return modules
  +        # Hmm, see if we don't sort ...
  +        # would be nice to get in same order as
  +        # projects need 
  +        # sequence.sort()
  +        
  +        return sequence
     
       def getRepositoriesForModuleList(self,modules):
           repositories=[]
  @@ -248,22 +253,22 @@
       def getBuildSequenceForProjects(self,projects):
           """Determine the build sequence for a given list of projects."""
           todo=[]
  -        result=[]
  +        sequence=[]
           for project in projects:
               log.debug('Evaluate Seq for ['+project.getName()+']')                
               self.addToTodoList(project,todo)
  -            log.debug('TODOS ['+`len(todo)`+']')
               
           while todo:
               # one by one, remove the first ready project and append 
  -            # it to the result
  +            # it to the sequence
               foundSome=0
               for todoProject in todo:
                   if self.isReady(todoProject,todo):
                       todo.remove(todoProject)
  -                    if not todoProject in result:
  -                        result.append(todoProject)
  -                        #log.debug('Next Project ['+todoProject.getName()+'] is #' + str(len(result)))
    
  +                    if not todoProject in sequence:
  +                        sequence.append(todoProject)
  +                        todoProject.setPosition(len(sequence))
  +                        log.debug('#' + `todoProject.getPosition()` + ' -> ' + todoProject.getName())
    
                       #else:
                       #    log.debug('Duplicate Result ['+todoProject.getName()+']')    
                       foundSome=1
  @@ -278,7 +283,7 @@
                       else:
                           loop=", ".join([project.getName() for todoProject in todo])
                           raise RuntimeError, "Circular Dependency Loop: " + str(loop)  
           
  -        return result
  +        return sequence
   
                   
       #
  
  
  

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


Mime
View raw message