gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r215980 - in /gump/branches/Gump3: metadata/vmgump.xml pygump/python/gump/config.py pygump/python/gump/engine/objectifier.py pygump/python/gump/model/__init__.py pygump/python/gump/plugins/builder.py
Date Tue, 12 Jul 2005 16:26:06 GMT
Author: leosimons
Date: Tue Jul 12 09:26:04 2005
New Revision: 215980

URL: http://svn.apache.org/viewcvs?rev=215980&view=rev
Log:
Take the 'native' command integration up to the point where we can build apr, apr-util and
apache-httpd. Update vmgump.xml to build those projects.

Modified:
    gump/branches/Gump3/metadata/vmgump.xml
    gump/branches/Gump3/pygump/python/gump/config.py
    gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
    gump/branches/Gump3/pygump/python/gump/model/__init__.py
    gump/branches/Gump3/pygump/python/gump/plugins/builder.py

Modified: gump/branches/Gump3/metadata/vmgump.xml
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/metadata/vmgump.xml?rev=215980&r1=215979&r2=215980&view=diff
==============================================================================
--- gump/branches/Gump3/metadata/vmgump.xml (original)
+++ gump/branches/Gump3/metadata/vmgump.xml Tue Jul 12 09:26:04 2005
@@ -18,6 +18,22 @@
         name="gump3-test">
 
 <repositories>
+    <repository name="apr" type="svn">
+        <title>Apache Portable Runtime</title>
+        <home-page>http://apr.apache.org/</home-page>
+        <cvsweb>http://cvs.apache.org/viewcvs.cgi/apr/?root=Apache-SVN</cvsweb>
+        <url>http://svn.apache.org/repos/asf/apr/</url>
+        <redistributable/>
+    </repository>
+
+    <repository name="apache-httpd" type="svn">
+        <title>Apache HTTP Server</title>
+        <home-page>http://httpd.apache.org/</home-page>
+        <cvsweb>http://cvs.apache.org/viewcvs.cgi/httpd/?root=Apache-SVN</cvsweb>
+        <url>http://svn.apache.org/repos/asf/httpd/</url>
+        <redistributable/>
+    </repository>
+
     <repository name="ant" type="cvs">
         <title>Ant</title>
         <home-page>http://ant.apache.org/</home-page>
@@ -61,6 +77,27 @@
 </repositories>
     
 <modules>
+    <module name="apr" path="apr/trunk">
+        <repository name="apr"/>
+
+        <url href="http://apr.apache.org/"/>
+        <description>Apache Portable Runtime</description>
+    </module>
+
+    <module name="apr-util" path="apr-util/trunk">
+        <repository name="apr"/>
+
+        <url href="http://apr.apache.org/"/>
+        <description>Apache Portable Runtime Utilities</description>
+    </module>
+
+    <module name="apache-httpd" path="httpd/trunk">
+        <repository name="apache-httpd"/>
+
+        <url href="http://httpd.apache.org/"/>
+        <description>Apache HTTP Server</description>
+    </module>
+
     <module name="ant">
         <repository name="ant"/>
         
@@ -120,6 +157,83 @@
 </modules>
 
 <projects>
+    <project name="apr">
+        <module name="apr"/>
+        
+        <!-- commands -->
+        <script name="buildconf"/>
+        <configure>
+            <arg name="--prefix" path="dest-GUMP"/>
+        </configure>
+        <make/>
+        <make target="install"/>
+        
+        <!-- outputs -->
+        <home nested="dest-GUMP"/>
+        <path name="bin"/>
+        <includes name="include"/>
+        <dynamic-libraries name="lib"/>
+        
+        <!-- dependencies -->
+    </project>
+
+    <project name="apr-util">
+        <module name="apr-util"/>
+        
+        <!-- commands -->
+        <script name="buildconf">
+            <arg name="--with-apr" project="apr"
+                    reference="srcdir"/>
+        </script>
+        <configure>
+            <arg name="--prefix" path="dest-GUMP"/>
+            <arg name="--with-apr" project="apr"
+                    reference="home"/>
+        </configure>
+        <make/>
+        <make target="install"/>
+        
+        <!-- outputs -->
+        <home nested="dest-GUMP"/>
+        <path name="bin"/>
+        <includes name="include"/>
+        <dynamic-libraries name="lib"/>
+        
+        <!-- dependencies -->
+        <depend project="apr" runtime="true"/>
+    </project>
+
+    <project name="apache-httpd">
+        <module name="apache-httpd"/>
+        
+        <!-- commands -->
+        <script name="buildconf">
+            <arg name="--with-apr" project="apr"
+                    reference="srcdir"/>
+            <arg name="--with-apr-util" project="apr-util"
+                    reference="srcdir"/>
+        </script>
+        <configure>
+            <arg name="--prefix" path="dest-GUMP"/>
+            <arg name="--with-apr" project="apr"
+                    reference="home"/>
+            <arg name="--with-apr-util" project="apr-util"
+                    reference="home"/>
+        </configure>
+        <make/>
+        <make target="install"/>
+        
+        <!-- outputs -->
+        <home nested="dest-GUMP"/>
+        <path name="bin"/>
+        <includes name="include"/>
+        <dynamic-libraries name="lib"/>
+        
+        <!-- dependencies -->
+        <depend project="apr" runtime="true"/>
+        <depend project="apr-util" runtime="true"/>
+    </project>
+
     <project name="jdk" path="jdk">
         <!-- installed package -->
         <!-- outputs -->

Modified: gump/branches/Gump3/pygump/python/gump/config.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/config.py?rev=215980&r1=215979&r2=215980&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/config.py (original)
+++ gump/branches/Gump3/pygump/python/gump/config.py Tue Jul 12 09:26:04 2005
@@ -166,9 +166,9 @@
     from gump.plugins.logreporter import ResultLogReporterPlugin
     post_process_plugins.append(ResultLogReporterPlugin(reportlog))
     
-    if config.debug:
-        from gump.plugins.introspection import IntrospectionPlugin
-        post_process_plugins.append(IntrospectionPlugin(reportlog))
+    #if config.debug:
+    #    from gump.plugins.introspection import IntrospectionPlugin
+    #    post_process_plugins.append(IntrospectionPlugin(reportlog))
     
     # Give us an insight to what we have cooking...
     for plugin in pre_process_plugins: log.debug("Preprocessor : %s " % `plugin`)

Modified: gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/engine/objectifier.py?rev=215980&r1=215979&r2=215980&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/engine/objectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/engine/objectifier.py Tue Jul 12 09:26:04 2005
@@ -200,25 +200,27 @@
     path = prop.getAttribute("path")
     id = prop.getAttribute("id")
     
+    # TODO: *seriously* clean this up. Sheesh. Shame on whoever wrote it (me,
+    #   Leo Simons. I take full responsibility).
     # The horrendous piece of logic below is dictated by
     #   http://gump.apache.org/metadata/builder.html#property%2Farg
     if not name:
         raise Error, "Need to specify a name for property of command %s" % command
     if project:
         if value:
-            raise Error, "Can't specify both a value an a project for property %s of command
%s" (name, command)
-        if reference and path:
-            raise Error, "Can't specify both a reference and a path for property %s of command
%s" (name, command)
-        if not reference and not path:
-            raise Error, "Must specify either a reference or a path for property %s of command
%s referencing project %s" (name, command, project)
+            raise Error, "Can't specify both a value and a project for property %s of command
%s" % (name, command)
+        if path:
+            raise Error, "Can't specify both a path and a project for property %s of command
%s" % (name, command)
+        if not reference:
+            raise Error, "Must specify either a reference or a path for property %s of command
%s referencing project %s" % (name, command, project)
         if id and not (reference == "jar" or reference == "jarpath"):
-            raise Error, "Can't specify an id %s for property %s of command %s unless reference
is 'jar', instead of '%s'" (id, name, command, reference)
+            raise Error, "Can't specify an id %s for property %s of command %s unless reference
is 'jar', instead of '%s'" % (id, name, command, reference)
         
         if not project in command.project.module.repository.workspace.projects.keys():
-            raise Error, "Can't reference non-existent project '%s' from property %s of command
%s" (project, name, command)
-    #else:
-    #    if not value:
-    #        raise Error, "Must specify either a project or a value for property %s of command
%s" (name, command)
+            raise Error, "Can't reference non-existent project '%s' from property %s of command
%s" % (project, name, command)
+    if path:
+        if value:
+            raise Error, "Can't specify both a value and a path for property %s of command
%s" % (name, command)
             
     if project:
         referenced_project = command.project.module.repository.workspace.projects[project]
@@ -226,38 +228,70 @@
         if not has_dependency_on(dependee=command.project, dependency=referenced_project):
             raise Error, "Can't refer to project %s from property %s of command %s because
that is not a declared dependency" % (referenced_project, name, command)
         
-        if path:
-            propvalue = os.path.join(get_project_directory, path)
-        else:
-            if reference == "jar" or reference == "jarpath":
-                if id:
-                    for jar in [o for o in referenced_project.outputs if isinstance(o, Jar)]:
-                        if jar.id == id:
-                            propvalue = jar
-                    
-                    if not propvalue:
-                        raise Error, "Project %s does not export jar with id %s referenced
in property %s of command %s" % (project, id, name, command)
-                else:
-                    jars = [o for o in referenced_project.outputs if isinstance(o, Jar)]
-                    if len(jars) > 1:
-                        raise Error, "Project %s exports more than one jar but property %s
of command %s does not specify an id" % (project, name, command)
-                    if len(jars) < 1:
-                        raise Error, "Project %s exports does not export a jar but property
%s of command %s tries to reference them" % (project, name, command)
-                    
-                    propvalue = jars[0]
+        if reference == "jar" or reference == "jarpath":
+            jars = [o for o in referenced_project.outputs if isinstance(o, Jar)]
+            if id:
+                for jar in jars:
+                    if jar.id == id:
+                        propvalue = jar
                 
-                if reference == "jarpath":
-                    propvalue = get_jar_path(propvalue)
-                else:
-                    propvalue = jar.name
-            elif reference == "home":
-                propvalue = get_project_home_directory(referenced_project)
-            elif reference == "srcdir":
-                propvalue = get_project_directory(referenced_project)
+                if not propvalue:
+                    raise Error, "Project %s does not export jar with id %s referenced in
property %s of command %s" % (project, id, name, command)
             else:
-                raise Error, "Command %s has a property %s with an unknown reference type
of %s" % (command, name, reference)
-    else:
+                if len(jars) > 1:
+                    raise Error, "Project %s exports more than one jar but property %s of
command %s does not specify an id" % (project, name, command)
+                if len(jars) < 1:
+                    raise Error, "Project %s exports does not export a jar but property %s
of command %s tries to reference them" % (project, name, command)
+                
+                propvalue = jars[0]
+            
+            if reference == "jarpath":
+                propvalue = get_jar_path(propvalue)
+            else:
+                propvalue = jar.name
+        elif reference == "home":
+            propvalue = get_project_home_directory(referenced_project)
+        elif reference == "srcdir":
+            propvalue = get_project_directory(referenced_project)
+        elif reference == "path":
+            outputs = [o for o in referenced_project.outputs if isinstance(o, BinariesPath)]
+            if id:
+                for o in outputs:
+                    if o.id == id:
+                        propvalue = join(get_project_home_directory(referenced_project),
o.name)
+            else:
+                if len(jars) > 1:
+                    raise Error, "Project %s exports more than one path containing binaries
but property %s of command %s does not specify an id" % (project, name, command)
+                if len(jars) < 1:
+                    raise Error, "Project %s exports does not export a path containing binaries
but property %s of command %s tries to reference them" % (project, name, command)
+        elif reference == "includes":
+            outputs = [o for o in referenced_project.outputs if isinstance(o, IncludesPath)]
+            if id:
+                for o in outputs:
+                    if o.id == id:
+                        propvalue = join(get_project_home_directory(referenced_project),
o.name)
+            else:
+                if len(jars) > 1:
+                    raise Error, "Project %s exports more than one path containing header
files but property %s of command %s does not specify an id" % (project, name, command)
+                if len(jars) < 1:
+                    raise Error, "Project %s exports does not export a path containing header
files but property %s of command %s tries to reference them" % (project, name, command)
+        elif reference == "dynamic-libraries":
+            outputs = [o for o in referenced_project.outputs if isinstance(o, DynamicLibrariesPath)]
+            if id:
+                for o in outputs:
+                    if o.id == id:
+                        propvalue = join(get_project_home_directory(referenced_project),
o.name)
+            else:
+                if len(jars) > 1:
+                    raise Error, "Project %s exports more than one path containing dynamic
libraries but property %s of command %s does not specify an id" % (project, name, command)
+                if len(jars) < 1:
+                    raise Error, "Project %s exports does not export a path containing dynamic
libraries but property %s of command %s tries to reference them" % (project, name, command)
+        else:
+            raise Error, "Command %s has a property %s with an unknown reference type of
%s" % (command, name, reference)
+    elif value:
         propvalue = value
+    elif path:
+        propvalue = os.path.join(get_project_directory(command.project), path)
 
     return (name, propvalue)
 
@@ -344,10 +378,9 @@
 def _create_specific_script_commands(project, project_definition, element_name, class_name,
log=None):
     scripts = project_definition.getElementsByTagName(element_name)
     for cmd in scripts:
-        name = cmd.getAttribute("name")
         shell = cmd.getAttribute("shell")
         basedir = cmd.getAttribute("basedir")
-        command = class_name(project, name, shell=shell, basedir=basedir)
+        command = class_name(project, shell=shell, basedir=basedir)
         _create_args(command, cmd, log=log)
         _create_env_vars(command, cmd, log=log)
         
@@ -357,14 +390,13 @@
 def _create_make_commands(project, project_definition, log=None):
     scripts = project_definition.getElementsByTagName("make")
     for cmd in scripts:
-        name = cmd.getAttribute("name")
         shell = cmd.getAttribute("shell")
         basedir = cmd.getAttribute("basedir")
         makefile = cmd.getAttribute("makefile")
-        targets = cmd.getAttribute("makefile")
+        targets = cmd.getAttribute("target")
         if targets:
             targets = targets.split(",")
-        command = Make(project, name, makefile=makefile, targets=targets, shell=shell, basedir=basedir)
+        command = Make(project, makefile=makefile, targets=targets, shell=shell, basedir=basedir)
         _create_args(command, cmd, log=log)
         _create_env_vars(command, cmd, log=log)
         
@@ -387,8 +419,9 @@
 def _create_outputs(project, project_definition):    
     _create_work_outputs(project, project_definition)
     _create_jar_outputs(project, project_definition)
-    _create_binary_path_outputs(project, project_definition)
-    _create_includes_path_outputs(project, project_definition)
+    _create_path_outputs(project, project_definition, "path", BinariesPath)
+    _create_path_outputs(project, project_definition, "include", IncludesPath)
+    _create_path_outputs(project, project_definition, "dynamic-libraries", DynamicLibrariesPath)
     #TODO more outputs
 
 
@@ -408,20 +441,12 @@
         project.add_output(Jar(project, name, id, add_to_bootclass_path))
 
 
-def _create_binary_path_outputs(project, project_definition):
-    paths = project_definition.getElementsByTagName("path")
+def _create_path_outputs(project, project_definition, element_name, class_name):
+    paths = project_definition.getElementsByTagName(element_name)
     for path in paths:
         name = path.getAttribute("name")
         id = path.getAttribute("id")
-        project.add_output(BinariesPath(project, name, id=id))
-
-
-def _create_includes_path_outputs(project, project_definition):
-    paths = project_definition.getElementsByTagName("includes")
-    for path in paths:
-        name = path.getAttribute("name")
-        id = path.getAttribute("id")
-        project.add_output(IncludesPath(project, name, id=id))
+        project.add_output(class_name(project, name, id=id))
 
 
 def _create_dependencies(project_definition, projectlist):
@@ -602,6 +627,8 @@
                 if p.nodeType == dom.Node.ELEMENT_NODE]
         failures = []
         
+        # TODO rewrite this function. Its way ugly.
+        
         for project_definition in project_definitions:
             name = project_definition.getAttribute("name")
             if not name:
@@ -636,7 +663,6 @@
                 cause = ExceptionInfo(type, value, traceback)
                 self.log.error(cause)
                 name = project_definition.getAttribute("name")
-                #self.log.exception("Failed to set up dependencies for project %s" % name)
                 project = workspace.projects[name]
                 mark_failure(project, cause)
                 
@@ -645,5 +671,16 @@
                 if not p in failures]:
             name = project_definition.getAttribute("name")
             project = workspace.projects[name]
-            _create_commands(project, project_definition, log=log)
+            try:
+                _create_commands(project, project_definition, log=log)
+            except:
+                failures.append(project_definition)
 
+                from gump.model.util import mark_failure
+                from gump.engine.algorithm import ExceptionInfo
+                (type, value, traceback) = sys.exc_info()
+                cause = ExceptionInfo(type, value, traceback)
+                self.log.error(cause)
+                name = project_definition.getAttribute("name")
+                project = workspace.projects[name]
+                mark_failure(project, cause)

Modified: gump/branches/Gump3/pygump/python/gump/model/__init__.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/__init__.py?rev=215980&r1=215979&r2=215980&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/__init__.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/__init__.py Tue Jul 12 09:26:04 2005
@@ -586,10 +586,8 @@
     Has the following properties:
         - all the properties a Script has
     """
-    def __init__(self, project, name, executable, basedir=None, shell=None, args=None):
-        assert isinstance(executable, basestring)
+    def __init__(self, project, name, basedir=None, shell=None, args=None):
         Script.__init__(self, project, name, args=args, basedir=basedir, shell=shell)
-        self.args = [executable] + args
 
     def __str__(self):
         typerep = str(self.__class__).split('.').pop()
@@ -598,34 +596,35 @@
 
 
 class Configure(SpecificScript):
-    def __init__(self, project, name, basedir=None, shell=None, args=None):
-        SpecificScript.__init__(self, project, name, "./configure", args=args, basedir=basedir,
shell=shell)
+    def __init__(self, project, basedir=None, shell=None, args=None):
+        SpecificScript.__init__(self, project, "./configure", args=args, basedir=basedir,
shell=shell)
 
 
 class Make(SpecificScript):
-    def __init__(self, project, name, makefile=None, targets=None, basedir=None, shell=None,
args=None):
+    def __init__(self, project, makefile=None, targets=None, basedir=None, shell=None, args=None):
         if not makefile:
             usemakefile = "Makefile"
         else:
             assert isinstance(makefile, basestring)
             usemakefile = makefile
 
-        Script.__init__(self, project, name, "make", args=args, basedir=basedir, shell=shell)
-        self.args = ["make", "-f", usemakefile]
-        self.args.extend(args)
+        SpecificScript.__init__(self, project, "make", args=args, basedir=basedir, shell=shell)
+        self.args = ["-f", usemakefile]
+        if args:
+            self.args.extend(args)
         if targets:
             assert isinstance(targets, list)
         self.args.extend(targets)
 
 
 class Autoconf(SpecificScript):
-    def __init__(self, project, name, basedir=None, shell=None, args=None):
-        SpecificScript.__init__(self, project, name, "autoconf", args=args, basedir=basedir,
shell=shell)
+    def __init__(self, project, basedir=None, shell=None, args=None):
+        SpecificScript.__init__(self, project, "autoconf", args=args, basedir=basedir, shell=shell)
 
 
 class Automake(SpecificScript):
-    def __init__(self, project, name, basedir=None, shell=None, args=None):
-        SpecificScript.__init__(self, project, name, "automake", args=args, basedir=basedir,
shell=shell)
+    def __init__(self, project, basedir=None, shell=None, args=None):
+        SpecificScript.__init__(self, project, "automake", args=args, basedir=basedir, shell=shell)
 
 
 class Ant(Command):
@@ -732,35 +731,24 @@
         self.name = name
     
     def __str__(self):
-        return "<Path:%s,id=%s>" % (self.name, self.id)
-
-class BinariesPath(Path):
-    """Model a directory containing scripts and/or binaries that can be run
-       by other projects..
+        typerep = str(self.__class__).split('.').pop()
+        return "<%s:%s,name=%s,id=%s>" % \
+               (typerep, self.name, self.id)
 
-    Has the following properties:
 
-        - all the properties a Directory has
-    """
+class BinariesPath(Path):
     def __init__(self, project, name, id=None):
         Path.__init__(self, project, name, id)
-    
-    def __str__(self):
-        return "<BinariesPath:%s,id=%s>" % (self.name, self.id)
+
 
 class IncludesPath(Path):
-    """Model a directory containing header files that can be linked against by
-       other projects.
+    def __init__(self, project, name, id=None):
+        Path.__init__(self, project, name, id)
 
-    Has the following properties:
 
-        - all the properties a Directory has
-    """
+class DynamicLibrariesPath(Path):
     def __init__(self, project, name, id=None):
         Path.__init__(self, project, name, id)
-    
-    def __str__(self):
-        return "<IncludesPath:%s,id=%s>" % (self.name, self.id)
 
 
 #TODO: more outputs

Modified: gump/branches/Gump3/pygump/python/gump/plugins/builder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/builder.py?rev=215980&r1=215979&r2=215980&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/builder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/builder.py Tue Jul 12 09:26:04 2005
@@ -25,7 +25,7 @@
 from tempfile import mkdtemp
 import shutil
 
-from gump.model import Script, Error, Project, Ant, Dependency
+from gump.model import Script, SpecificScript, Error, Project, Ant, Dependency
 from gump.model.util import get_project_directory, calculate_path
 from gump.plugins import AbstractPlugin
 from gump.util.executor import Popen, PIPE, STDOUT
@@ -136,6 +136,10 @@
         BuilderPlugin.__init__(self, log, Script, self._do_script)
         
     def _do_script(self, project, script):
+        if isinstance(script, SpecificScript):
+            self._do_specific_script(project, script)
+            return
+        
         # environment
         if script.path:
             script.env['PATH'] = script.path
@@ -166,3 +170,22 @@
         myargs.extend(script.args)
         # run it
         self._do_run_command(script, myargs, projectpath, shell=True)
+
+    def _do_specific_script(self, project, script):
+        # environment
+        if script.path:
+            script.env['PATH'] = script.path
+        self.log.debug("        PATH is '%s%s%s'" % \
+                (ansicolor.Blue, script.env['PATH'], ansicolor.Black))
+        
+        # working directory
+        projectpath = get_project_directory(project)
+        if script.basedir:
+            projectpath = os.path.join(projectpath, script.basedir)
+        
+        # command line
+        myargs = []
+        myargs.append(script.name)
+        myargs.extend(script.args)
+        # run it
+        self._do_run_command(script, myargs, projectpath, shell=False)



Mime
View raw message