Exemplo n.º 1
0
 def __init__(self, amfNode, svcnames, app, prod, quiet=0):
     self.env = self.copyEnvVars(app.env)
     self.env = self.copyEnvVars(prod.env)
     #
     # Create an amf node instance that will help track everything
     # that's relevant for this amf-clm instance. (os + arch + os_version)
     self.amfi = AmfInstance(amfNode, prod.app.rim)
     self.amfi.product = prod
     self.compis = {}
     self.prod = prod
     self.rim = prod.rim
     #
     # Extra optional prebuild lib paths
     Rim.getAppLibs(self, amfNode)
     #
     # before harvesting variables of that node
     # inject those from all services is implements.
     #
     for svcname in svcnames:
         if prod.app.services.has_key(svcname):
             self.env = self.copyEnvVars(prod.app.services[svcname].env)
         else:
             print "Invalid service name '%s' in anf node '%s' - %s" % (
                 svcname, self.amfi.name, amfNode.toxml())
             sys.exit(1)
     #
     self.getVars(amfNode)
     #
     # User can make build more focus (and thus fater) by specifying the
     # Service and component he/she his working on
     #
     if os.environ.has_key('RIM_SERVICE'):
         thisService = os.environ['RIM_SERVICE']
     else:
         thisService = ""
     if os.environ.has_key('RIM_COMPONENT'):
         thisComp = os.environ['RIM_COMPONENT']
     else:
         thisComp = ""
     #
     for svcname in svcnames:
         if thisService == "" or thisService == svcname:
             # Extra optional prebuild lib paths
             Rim.getAppLibs(self, app.services[svcname].xmlnode)
             Rim.pushAppLibs(prod, self)
             RimCore.rimcore.dbg(quiet, "            Reading Service - %s",
                                 svcname)
             svc = app.services[svcname]
             svcComps = svc.comps
             self.env = self.copyEnvVars(svc.env)
             #
             # Find the component entry for this one.
             for comp in svcComps:
                 if thisComp == "" or thisComp == svcComps[comp].name:
                     self.compis[svcComps[comp].name] = CompInstance(
                         svcComps[comp], app, prod, svc, self, quiet)
             Rim.popAppLibs(prod, self)
     self.env = self.copyEnvVars(prod.env)
Exemplo n.º 2
0
 def __init__(self, amfNode, svcnames, app, prod, quiet=0):
     self.env=self.copyEnvVars(app.env)
     self.env=self.copyEnvVars(prod.env)
     #
     # Create an amf node instance that will help track everything
     # that's relevant for this amf-clm instance. (os + arch + os_version)
     self.amfi=AmfInstance(amfNode, prod.app.rim)
     self.amfi.product=prod
     self.compis={}
     self.prod=prod
     self.rim=prod.rim
     #
     # Extra optional prebuild lib paths
     Rim.getAppLibs(self, amfNode)
     #
     # before harvesting variables of that node 
     # inject those from all services is implements.
     #
     for svcname in svcnames:
         if prod.app.services.has_key(svcname):
             self.env=self.copyEnvVars(prod.app.services[svcname].env)
         else:
             print "Invalid service name '%s' in anf node '%s' - %s" % (svcname,self.amfi.name,amfNode.toxml())
             sys.exit(1)
     #
     self.getVars(amfNode)
     #
     # User can make build more focus (and thus fater) by specifying the 
     # Service and component he/she his working on
     #
     if os.environ.has_key('RIM_SERVICE'):
         thisService=os.environ['RIM_SERVICE']
     else:
         thisService=""
     if os.environ.has_key('RIM_COMPONENT'):
         thisComp=os.environ['RIM_COMPONENT']
     else:
         thisComp=""
     # 
     for svcname in svcnames:
         if thisService == "" or thisService==svcname:
             # Extra optional prebuild lib paths
             Rim.getAppLibs(self, app.services[svcname].xmlnode)
             Rim.pushAppLibs(prod, self)
             RimCore.rimcore.dbg(quiet, "            Reading Service - %s", svcname)
             svc=app.services[svcname]
             svcComps=svc.comps
             self.env=self.copyEnvVars(svc.env)
             #
             # Find the component entry for this one.
             for comp in svcComps:
                 if thisComp == "" or thisComp==svcComps[comp].name:
                     self.compis[svcComps[comp].name]=CompInstance(svcComps[comp], app, prod, svc, self, quiet)
             Rim.popAppLibs(prod, self)
     self.env=self.copyEnvVars(prod.env)
Exemplo n.º 3
0
 def buildIt(self):
     os.system("mkdir -p %s" % self.repos)
     #
     # Add the top level custom root for the APP 
     self.app.rim.roots.append(self.rim.getVar("customRoot")+"/"+self.app.name);
     
     #
     # push our parents custom libs
     Rim.pushAppLibs(self.app, self)
     
     # go through all nodes
     for nkey in self.nodes:
         self.addVars(self,self.nodes[nkey])
         customRoot=self.rim.getVar("customRoot")+"/"+self.app.name+"/"+nkey;
         self.app.rim.roots.insert(0,customRoot);
         self.nodes[nkey].buildIt()
         self.app.rim.roots.pop(0);
     
     # pop libs
     Rim.popAppLibs(self.app, self)
     # pop the App root
     self.app.rim.roots.pop(0);
Exemplo n.º 4
0
    def buildIt(self):
        os.system("mkdir -p %s" % self.repos)
        #
        # Add the top level custom root for the APP
        self.app.rim.roots.append(
            self.rim.getVar("customRoot") + "/" + self.app.name)

        #
        # push our parents custom libs
        Rim.pushAppLibs(self.app, self)

        # go through all nodes
        for nkey in self.nodes:
            self.addVars(self, self.nodes[nkey])
            customRoot = self.rim.getVar(
                "customRoot") + "/" + self.app.name + "/" + nkey
            self.app.rim.roots.insert(0, customRoot)
            self.nodes[nkey].buildIt()
            self.app.rim.roots.pop(0)

        # pop libs
        Rim.popAppLibs(self.app, self)
        # pop the App root
        self.app.rim.roots.pop(0)
Exemplo n.º 5
0
 def __init__(self,
              prodname=os.getenv("RIM_PRODUCT"),
              branchname=os.getenv("RIM_BRANCH")):
     env = Environment.Environment()
     env.vars = {}
     self.rim = Rim.Rim(env, Rim.Rim.Shared)
     appFile = "%s/App.xml" % os.path.dirname(__file__)
     appNode = xml.dom.minidom.parse(appFile).getElementsByTagName(
         'application')[0]
     self.conf = RimApp.RimApp(appNode, self.rim, quiet=1)
     self.conf.branches = self.conf.rim.branches
     self.product = self.conf.products[prodname]
     self.branch = self.conf.branches[branchname]
     self.branchName = branchname
     # verify that product and branch are compatible
     self.allComps(self.compScsIsInBranch)
Exemplo n.º 6
0
from Rim import *

menu = 0
while int(menu) != 3:
    menu = input('\n' + 'Выберите требуемую операцию:' + '\n' +
                 '1. Перевести в арабские цифры' + '\n' +
                 '2. Выполнить арифметические операции' + '\n' +
                 '3. Выйти из программы' + '\n')

    if int(menu) == 1:
        rim1 = Rim(input('Введите первое число римскими цифрами: ').upper())
        rim2 = Rim(input('Введите втоое число римскими цифрами: ').upper())
        print('Первое число арабскими: ', rim1)
        print('Второе число арабскими: ', rim2)

    elif int(menu) == 2:
        calc = input('Введите арифметическое выражение с двумя римскими числами: ').upper()
        calc = calc.replace(' ', '')

        if calc.find('+') != -1:
            print(Rim(calc[:calc.find('+')]) + Rim(calc[calc.find('+') + 1:]))
        elif calc.find('-') != -1:
            print(Rim(calc[:calc.find('-')]) - Rim(calc[calc.find('-') + 1:]))
        elif calc.find('*') != -1:
            print(Rim(calc[:calc.find('*')]) * Rim(calc[calc.find('*') + 1:]))
        elif calc.find('/') != -1:
            print(Rim(calc[:calc.find('/')]) / Rim(calc[calc.find('/') + 1:]))
        elif calc.find('//') != -1:
            print(Rim(calc[:calc.find('//')]) // Rim(calc[calc.find('//') + 1:]))
        elif calc.find('%') != -1:
            print(Rim(calc[:calc.find('%')]) % Rim(calc[calc.find('%') + 1:]))
Exemplo n.º 7
0
Import('env')
import Rim
rim = Rim.Rim(env)

src = """
    init.c
    utmp.c
""".split()

rim.addCflags(
    "-ansi -O2 -fomit-frame-pointer -W -Wall -D_GNU_SOURCE -DINIT_MAIN")

rim.Program("init", src)
Exemplo n.º 8
0
 def __init__(self, comp, app, prod, svc, node, quiet=0):
     RimCore.rimcore.dbg(quiet, "                Reading Component - %s",comp.name)
     #
     # ready to build whatever it takes for a component.
     # We have the os/release/cpu combo so we can setup the tools.
     #
     # Build time variables for the associated application, service, product, 
     # and, finally, amf node variables are added to this context
     #
     self.env=self.copyEnvVars(node.env) 
     self.rim=node.rim
     self.env.compi=self
     self.addVars(app, self)
     self.addVars(comp, self)
     self.addVars(svc, self)
     self.addVars(prod, self)
     self.addVars(node, self)
     self.addVars(node.amfi, self)
     self.name=comp.name
     self.node=node
     self.app=app
     self.svc=svc
     self.prod=prod
     self.os=node.amfi.os.name
     self.distro=node.amfi.distro.name
     self.version=node.amfi.version
     self.cpu=node.amfi.arch.name
     self.env.amfi=node.amfi
     self.env.compi=self
     self.addVar("CPU", self.cpu)
     self.addVar("OSRELEASE",self.distro)
     self.addVar("COMPONENT", self.name)
     self.addVar("NODE", self.node.amfi.name)
     self.addVar("PRODUCT", self.prod.name)
     self.addVar("APPLICATION", self.app.name)
     self.objdir="%s_%s_%s" % (self.distro,self.version,self.cpu)
     self.rim.env['VDIR']=self.translate("%s" % self.objdir)
     self.env['OBJPREFIX']=self.translate("%s/" % self.objdir)
     self.env['VDIR']=self.translate("%s" % self.objdir)
     self.addVar("OBJDIR", self.objdir)
     self.rootRelDir="%s/%s/%s/%s" % (self.os,self.distro,self.version,self.cpu)
     self.rootPath="%s/%s" % (self.rim.rootsroot,self.rootRelDir)
     self.addVar("ROOT", self.rootPath)
     #
     # have rim also include the path to various libraries
     #
     target=self.rim.getOsArchTargetName(self.distro, self.version, self.cpu)
     Rim.addAppLibPaths(self, target, self.appLibPath)
     #
     # Ask rim for the tools PATH (path to compilers etc..) for this component
     toolsPath=node.prod.app.rim.getOsArchToolsPath(self.os, self.distro, self.version, self.cpu)
     
     # all tools scripts are under a specific directory relative
     # to $RIMROOT/scripts
     tpath="%s/crossTools/%s/%s/%s/%s" % (os.path.dirname(__file__), self.rim.hostTarget(), self.os,self.distro,self.cpu)
     f, filename, desc = imp.find_module('tools', [tpath])
     tools = imp.load_module('tools', f, filename, desc)
     
     tools.generate(self.env, toolsPath)
     try:
         self.env.MergeFlags({'LIBPATH' : [ self.rootPath+"/lib" ]})
         self.env.MergeFlags({'LIBPATH' : [ self.rootPath+"/usr/lib" ]})
         self.env.MergeFlags({'CPPPATH' : [ self.rootPath+"/usr/include" ]})
         if self.getVar("SPEC_ROOT") != "":
             self.rim.subdirs(self.translate("${SPEC_ROOT}/build"), self.env)
     except:
         None
     #
     # Record name of sconscript file at the root
     self.croot=comp.croot
     #
     # compute a full path stack for file searches
     #
     self.roots=[]
     #
     # Push a series of search paths used to search for spec elements and 
     # and implesite library depenedencies.
     #
     # Sequence would be something like:
     # /work/rim/custom/Linux/Ubuntu/lts10.4/x86_64
     # /work/rim/custom/Linux/Ubuntu/lts10.4
     # /work/rim/custom/Linux/Ubuntu/x86_64
     # /work/rim/custom/Linux/Ubuntu
     # /work/rim/custom/Linux/x86_64
     # /work/rim/custom/Linux
     # /opt/rimroots/Linux/Ubuntu/lts10.4/x86_64
     # /opt/rimroots/Linux/Ubuntu/lts10.4
     # /opt/rimroots/Linux/Ubuntu/x86_64
     # /opt/rimroots/Linux/Ubuntu
     # /opt/rimroots/Linux/x86_64
     # /opt/rimroots/Linux
     #
     self.pushTopOfRoot(self.rim.rootsroot)
     customRoot=self.rim.getVar("customRoot")
     self.pushTopOfRoot(customRoot)
     self.pushTopOfRoot(customRoot+'/common')
     self.pushTopOfRoot(customRoot+'/'+app.name)
     self.pushTopOfRoot(customRoot+'/'+prod.name)
     self.pushTopOfRoot(customRoot+'/'+node.amfi.name)
     self.pushTopOfRoot(customRoot+'/'+self.name)
Exemplo n.º 9
0
 def __init__(self, appNode, rim, quiet=0):
     self.appNode=appNode
     self.rim=rim
     rim.app=self
     self.env=self.copyEnvVars(rim.env)
     self.getVars(appNode)
     self.name=appNode.getAttribute('name')
     self.version=appNode.getAttribute('version')
     rim.pkgPrefix=appNode.getAttribute('pkgPrefix')
     if rim.pkgPrefix == "":
         rim.pkgPrefix=self.name
     self.tagSubStr=""
     #
     # Extra optional prebuild lib paths
     Rim.getAppLibs(self, appNode)
     #
     # build the component list
     #
     compRoot=appNode.getElementsByTagName('components')
     compNodes=compRoot[0].getElementsByTagName('component')
     for compNode in compNodes:
         comp=Component(compNode, self)
         if comp.root.scs in rim.branch.scs:
             comp.croot="%s/%s%s/%s" % (
                 rim.workspace, 
                 rim.scs[comp.root.scs].prefix, 
                 rim.branch.scs[comp.root.scs],
                 comp.root.prefix
             )
         else:
             comp.croot=""
         self.components[comp.name]=comp
     
     #
     # Add RIMROOT - for legacy references (need to clean these out)
     #
     self.rimroot=self.components['RimBase'].croot
     self.addVar("RIMROOT", "%s" % self.rimroot)
     self.rim.addVar("customRoot", "%s/custom" % self.rimroot)
     self.rim.addVar("RIMROOT", self.rimroot)
     #
     # Extract the service list
     #
     svcNodes=appNode.getElementsByTagName('services')[0].getElementsByTagName('service')
     for svcNode in svcNodes:
         self.services[svcNode.getAttribute('name')]=Service(svcNode, self);
         
     #
     # Extract the private keys
     #
     keyNodes=appNode.getElementsByTagName('key')
     self.keys={}
     for keyNode in keyNodes:
         self.keys[keyNode.getAttribute('name')]=keyNode.firstChild.wholeText
         
     #
     # Extract list of Products for this application
     # (or the one selected by the environment)
     #
     if os.environ.has_key('RIM_PRODUCT'):
         thisProd=os.environ['RIM_PRODUCT']
     else:
         thisProd=0
     prodNodes=appNode.getElementsByTagName('product')
     for prodNode in prodNodes:
         #
         # check for a match with user's environment
         # User could have no such environment which means all applications
         # shoudl be build.
         pname=prodNode.getAttribute('name')
         if not thisProd or thisProd==pname:
             RimCore.rimcore.dbg(quiet,"    Product - %s",pname)
             self.products[pname]=Product(prodNode, self, quiet)
Exemplo n.º 10
0
    def __init__(self, prodNode, app, quiet=0):
        self.env=self.copyEnvVars(app.env)
        self.getVars(prodNode)
        self.nodes={}
        self.name=prodNode.getAttribute('name')
        self.revscs=prodNode.getAttribute('revScs')
        if self.revscs:
            import scsOps
            self.revision, self.view=app.rim.getScsRevAndView(self.revscs)
        else:
            self.revision="Unknown"
            self.view="Unknown"
        self.app=app
        self.desc=prodNode.getAttribute('desc')
        self.rim=app.rim
        self.rim.prod=self
        self.modules={}
        self.modEntries={}
        branch=os.getenv("RIM_BRANCH")
        workspace=os.getenv("RIM_WORKSPACE")
        self.repos="%s/%s/%s" % (workspace, branch, self.name)
        self.artifacts="%s/artifacts" % self.repos
        self.rim.env.app=app
        self.stracker=RimSpec.specTracker(self)

        # check is the user wants to build that node
        if os.environ.has_key('RIM_NODE') and os.environ['RIM_NODE'] != "":
            thisNode=os.environ['RIM_NODE']
        else:
            thisNode=0
        #
        # Extra optional prebuild lib paths
        Rim.getAppLibs(self, prodNode)
        
        amfNodes=prodNode.getElementsByTagName('amfNode')
        #
        # check for RIM_SET_ENV and warn user about missing node type
        #
        if thisNode == 0 and os.environ.has_key("RIM_SET_ENV"):
            print "Warning : To set the proper RIM environment you must"
            print "          specify the NODE for which you want to set the"
            print "          context for product '%s' and application '%s'" % (self.name, app.name)
            print "Available Nodes are: "
            for amfNode in amfNodes:
                nname=amfNode.getAttribute('name')
                print "     %s" % (nname)
            print "Please execute export RIM_NODE=<One of the Node Names listed Above>"
            sys.exit(1);

        for amfNode in amfNodes:
            nname=amfNode.getAttribute('name')
            # have to add the vars defined in the services this node participate in
            nodeServices=amfNode.getElementsByTagName('service')
            svcnames=[]
            for service in nodeServices:
                svcnames.append(service.getAttribute('name'))
            #
            # always add the basic rim service
            svcnames.append("Rim")
            for svcname in svcnames:
                self.addVars(app.services[svcname], self)
            if not thisNode or thisNode==nname:
                RimCore.rimcore.dbg(quiet, "        Node - %s",nname)
                self.nodes[nname]=Node(amfNode, svcnames, app, self, quiet)
Exemplo n.º 11
0
 def buildIt(self):
     sname=self.croot+'/rim.py'
     Rim.pushAppLibs(self.prod, self)
     Rim.pushAppLibs(self.app, self)
     Rim.pushAppLibs(self.svc, self)
     cRim=Rim.Rim(self.env, Rim.Rim.Shared)
     cRim.addVars(self, cRim);
     rpath=self.rootPath
     tname=self.node.amfi.distro.versions[self.version][self.cpu].tools
     #
     # have rim also include the path to various libraries
     #
     cRim.env['PREBUILTTARGET']=cRim.toolsets[tname].target
     cRim.addIncDirs( rpath+"/usr/include")
     cRim.addLibDirs( rpath+"/usr/lib")
     cRim.addLibDirs( rpath+"/lib")
     cRim.addLdFlags( "-Wl,-rpath-link=%s/lib" % rpath)
     cRim.addLdFlags( "-Wl,-rpath-link=%s/usr/lib" % rpath)
     myPath="/".join(os.path.realpath(__file__).split('/')[0:-2])
     cRim.env['ENV']['LD_LIBRARY_PATH']="%s/tools/lib" % myPath
     if self.cpu == 'x86_64':
         archDir="x86_64-linux-gnu"
         cRim.addIncDirs( rpath+"/usr/include/%s"%archDir)
         cRim.addLibDirs( rpath+"/usr/lib/%s"%archDir)
         cRim.addLibDirs( rpath+"/lib/%s"%archDir)
         cRim.addLdFlags( "-Wl,-rpath-link=%s/lib/%s" % (rpath,archDir))
         cRim.addLdFlags( "-Wl,-rpath-link=%s/usr/lib/%s" % (rpath,archDir))
     cRim.setApplicationName(self.app.name)
     cRim.setApplicationVersion(self.app.version)
     cRim.setProductName(self.prod.name)
     cRim.setComponentName(self.name)
     cRim.setOsBaseName(self.os)
     cRim.setOsReleaseName(self.distro)
     cRim.setCpuName(self.cpu)
     #
     # include a build of basic rim support lib
     #
     if os.access(sname, os.R_OK):
         cRim.subdirs(self.croot)
     else:
         RimCore.rimcore.dbg(1, "No rim.py file found in component root '%s'", self.croot);
     #
     # check for the presense of a spec file in the root/rim directory
     # We first look for a file with the component's name, then rim.spec
     #
     reqs=self.node.prod.stracker.processSpec(self.croot+'/rim', self.name, self, show=0)
     
     #
     # make sure we pick up all of the base OS modules for this component instance as well
     #
     for specfile in glob.glob(self.node.amfi.specroot+'/*.spec'):
         sname=os.path.basename(specfile)
         reqs+=self.node.prod.stracker.processSpec(self.node.amfi.specroot, sname[0:len(sname)-5], self, reqs)
     #    
     Rim.popAppLibs(self.svc, self)
     Rim.popAppLibs(self.app, self)
     Rim.popAppLibs(self.prod, self)
Exemplo n.º 12
0
#!/usr/bin/env python
import os
import sys
import xml.dom.minidom
import Rim
import RimApp
from SCons import Environment

env = Environment.Environment()
env.vars = {}
rim = Rim.Rim(env, Rim.Rim.Shared)

# read in the entire configuration for that app and site
mypath = "/".join(os.path.abspath(__file__).split("/")[0:-1])
appFile = "%s/App.xml" % mypath
appNode = xml.dom.minidom.parse(appFile).getElementsByTagName('application')[0]
conf = RimApp.RimApp(appNode, rim, quiet=1)


def showProducts():
    print "Available products are:"
    for proc in conf.products:
        print "    %s" % prod


def showBranches():
    print "Available branches are:"
    for ranch in conf.branches:
        print "    %s" % branch

Exemplo n.º 13
0
    def __init__(self, appNode, rim, quiet=0):
        self.appNode = appNode
        self.rim = rim
        rim.app = self
        self.env = self.copyEnvVars(rim.env)
        self.getVars(appNode)
        self.name = appNode.getAttribute('name')
        self.version = appNode.getAttribute('version')
        rim.pkgPrefix = appNode.getAttribute('pkgPrefix')
        if rim.pkgPrefix == "":
            rim.pkgPrefix = self.name
        self.tagSubStr = ""
        #
        # Extra optional prebuild lib paths
        Rim.getAppLibs(self, appNode)
        #
        # build the component list
        #
        compRoot = appNode.getElementsByTagName('components')
        compNodes = compRoot[0].getElementsByTagName('component')
        for compNode in compNodes:
            comp = Component(compNode, self)
            if comp.root.scs in rim.branch.scs:
                comp.croot = "%s/%s%s/%s" % (
                    rim.workspace, rim.scs[comp.root.scs].prefix,
                    rim.branch.scs[comp.root.scs], comp.root.prefix)
            else:
                comp.croot = ""
            self.components[comp.name] = comp

        #
        # Add RIMROOT - for legacy references (need to clean these out)
        #
        self.rimroot = self.components['RimBase'].croot
        self.addVar("RIMROOT", "%s" % self.rimroot)
        self.rim.addVar("customRoot", "%s/custom" % self.rimroot)
        self.rim.addVar("RIMROOT", self.rimroot)
        #
        # Extract the service list
        #
        svcNodes = appNode.getElementsByTagName(
            'services')[0].getElementsByTagName('service')
        for svcNode in svcNodes:
            self.services[svcNode.getAttribute('name')] = Service(
                svcNode, self)

        #
        # Extract the private keys
        #
        keyNodes = appNode.getElementsByTagName('key')
        self.keys = {}
        for keyNode in keyNodes:
            self.keys[keyNode.getAttribute(
                'name')] = keyNode.firstChild.wholeText

        #
        # Extract list of Products for this application
        # (or the one selected by the environment)
        #
        if os.environ.has_key('RIM_PRODUCT'):
            thisProd = os.environ['RIM_PRODUCT']
        else:
            thisProd = 0
        prodNodes = appNode.getElementsByTagName('product')
        for prodNode in prodNodes:
            #
            # check for a match with user's environment
            # User could have no such environment which means all applications
            # shoudl be build.
            pname = prodNode.getAttribute('name')
            if not thisProd or thisProd == pname:
                RimCore.rimcore.dbg(quiet, "    Product - %s", pname)
                self.products[pname] = Product(prodNode, self, quiet)
Exemplo n.º 14
0
    def __init__(self, prodNode, app, quiet=0):
        self.env = self.copyEnvVars(app.env)
        self.getVars(prodNode)
        self.nodes = {}
        self.name = prodNode.getAttribute('name')
        self.revscs = prodNode.getAttribute('revScs')
        if self.revscs:
            import scsOps
            self.revision, self.view = app.rim.getScsRevAndView(self.revscs)
        else:
            self.revision = "Unknown"
            self.view = "Unknown"
        self.app = app
        self.desc = prodNode.getAttribute('desc')
        self.rim = app.rim
        self.rim.prod = self
        self.modules = {}
        self.modEntries = {}
        branch = os.getenv("RIM_BRANCH")
        workspace = os.getenv("RIM_WORKSPACE")
        self.repos = "%s/%s/%s" % (workspace, branch, self.name)
        self.artifacts = "%s/artifacts" % self.repos
        self.rim.env.app = app
        self.stracker = RimSpec.specTracker(self)

        # check is the user wants to build that node
        if os.environ.has_key('RIM_NODE') and os.environ['RIM_NODE'] != "":
            thisNode = os.environ['RIM_NODE']
        else:
            thisNode = 0
        #
        # Extra optional prebuild lib paths
        Rim.getAppLibs(self, prodNode)

        amfNodes = prodNode.getElementsByTagName('amfNode')
        #
        # check for RIM_SET_ENV and warn user about missing node type
        #
        if thisNode == 0 and os.environ.has_key("RIM_SET_ENV"):
            print "Warning : To set the proper RIM environment you must"
            print "          specify the NODE for which you want to set the"
            print "          context for product '%s' and application '%s'" % (
                self.name, app.name)
            print "Available Nodes are: "
            for amfNode in amfNodes:
                nname = amfNode.getAttribute('name')
                print "     %s" % (nname)
            print "Please execute export RIM_NODE=<One of the Node Names listed Above>"
            sys.exit(1)

        for amfNode in amfNodes:
            nname = amfNode.getAttribute('name')
            # have to add the vars defined in the services this node participate in
            nodeServices = amfNode.getElementsByTagName('service')
            svcnames = []
            for service in nodeServices:
                svcnames.append(service.getAttribute('name'))
            #
            # always add the basic rim service
            svcnames.append("Rim")
            for svcname in svcnames:
                self.addVars(app.services[svcname], self)
            if not thisNode or thisNode == nname:
                RimCore.rimcore.dbg(quiet, "        Node - %s", nname)
                self.nodes[nname] = Node(amfNode, svcnames, app, self, quiet)
Exemplo n.º 15
0
    def buildIt(self):
        sname = self.croot + '/rim.py'
        Rim.pushAppLibs(self.prod, self)
        Rim.pushAppLibs(self.app, self)
        Rim.pushAppLibs(self.svc, self)
        cRim = Rim.Rim(self.env, Rim.Rim.Shared)
        cRim.addVars(self, cRim)
        rpath = self.rootPath
        tname = self.node.amfi.distro.versions[self.version][self.cpu].tools
        #
        # have rim also include the path to various libraries
        #
        cRim.env['PREBUILTTARGET'] = cRim.toolsets[tname].target
        cRim.addIncDirs(rpath + "/usr/include")
        cRim.addLibDirs(rpath + "/usr/lib")
        cRim.addLibDirs(rpath + "/lib")
        cRim.addLdFlags("-Wl,-rpath-link=%s/lib" % rpath)
        cRim.addLdFlags("-Wl,-rpath-link=%s/usr/lib" % rpath)
        myPath = "/".join(os.path.realpath(__file__).split('/')[0:-2])
        cRim.env['ENV']['LD_LIBRARY_PATH'] = "%s/tools/lib" % myPath
        if self.cpu == 'x86_64':
            archDir = "x86_64-linux-gnu"
            cRim.addIncDirs(rpath + "/usr/include/%s" % archDir)
            cRim.addLibDirs(rpath + "/usr/lib/%s" % archDir)
            cRim.addLibDirs(rpath + "/lib/%s" % archDir)
            cRim.addLdFlags("-Wl,-rpath-link=%s/lib/%s" % (rpath, archDir))
            cRim.addLdFlags("-Wl,-rpath-link=%s/usr/lib/%s" % (rpath, archDir))
        cRim.setApplicationName(self.app.name)
        cRim.setApplicationVersion(self.app.version)
        cRim.setProductName(self.prod.name)
        cRim.setComponentName(self.name)
        cRim.setOsBaseName(self.os)
        cRim.setOsReleaseName(self.distro)
        cRim.setCpuName(self.cpu)
        #
        # include a build of basic rim support lib
        #
        if os.access(sname, os.R_OK):
            cRim.subdirs(self.croot)
        else:
            RimCore.rimcore.dbg(1,
                                "No rim.py file found in component root '%s'",
                                self.croot)
        #
        # check for the presense of a spec file in the root/rim directory
        # We first look for a file with the component's name, then rim.spec
        #
        reqs = self.node.prod.stracker.processSpec(self.croot + '/rim',
                                                   self.name,
                                                   self,
                                                   show=0)

        #
        # make sure we pick up all of the base OS modules for this component instance as well
        #
        for specfile in glob.glob(self.node.amfi.specroot + '/*.spec'):
            sname = os.path.basename(specfile)
            reqs += self.node.prod.stracker.processSpec(
                self.node.amfi.specroot, sname[0:len(sname) - 5], self, reqs)
        #
        Rim.popAppLibs(self.svc, self)
        Rim.popAppLibs(self.app, self)
        Rim.popAppLibs(self.prod, self)
Exemplo n.º 16
0
    def __init__(self, comp, app, prod, svc, node, quiet=0):
        RimCore.rimcore.dbg(quiet, "                Reading Component - %s",
                            comp.name)
        #
        # ready to build whatever it takes for a component.
        # We have the os/release/cpu combo so we can setup the tools.
        #
        # Build time variables for the associated application, service, product,
        # and, finally, amf node variables are added to this context
        #
        self.env = self.copyEnvVars(node.env)
        self.rim = node.rim
        self.env.compi = self
        self.addVars(app, self)
        self.addVars(comp, self)
        self.addVars(svc, self)
        self.addVars(prod, self)
        self.addVars(node, self)
        self.addVars(node.amfi, self)
        self.name = comp.name
        self.node = node
        self.app = app
        self.svc = svc
        self.prod = prod
        self.os = node.amfi.os.name
        self.distro = node.amfi.distro.name
        self.version = node.amfi.version
        self.cpu = node.amfi.arch.name
        self.env.amfi = node.amfi
        self.env.compi = self
        self.addVar("CPU", self.cpu)
        self.addVar("OSRELEASE", self.distro)
        self.addVar("COMPONENT", self.name)
        self.addVar("NODE", self.node.amfi.name)
        self.addVar("PRODUCT", self.prod.name)
        self.addVar("APPLICATION", self.app.name)
        self.objdir = "%s_%s_%s" % (self.distro, self.version, self.cpu)
        self.rim.env['VDIR'] = self.translate("%s" % self.objdir)
        self.env['OBJPREFIX'] = self.translate("%s/" % self.objdir)
        self.env['VDIR'] = self.translate("%s" % self.objdir)
        self.addVar("OBJDIR", self.objdir)
        self.rootRelDir = "%s/%s/%s/%s" % (self.os, self.distro, self.version,
                                           self.cpu)
        self.rootPath = "%s/%s" % (self.rim.rootsroot, self.rootRelDir)
        self.addVar("ROOT", self.rootPath)
        #
        # have rim also include the path to various libraries
        #
        target = self.rim.getOsArchTargetName(self.distro, self.version,
                                              self.cpu)
        Rim.addAppLibPaths(self, target, self.appLibPath)
        #
        # Ask rim for the tools PATH (path to compilers etc..) for this component
        toolsPath = node.prod.app.rim.getOsArchToolsPath(
            self.os, self.distro, self.version, self.cpu)

        # all tools scripts are under a specific directory relative
        # to $RIMROOT/scripts
        tpath = "%s/crossTools/%s/%s/%s/%s" % (os.path.dirname(__file__),
                                               self.rim.hostTarget(), self.os,
                                               self.distro, self.cpu)
        f, filename, desc = imp.find_module('tools', [tpath])
        tools = imp.load_module('tools', f, filename, desc)

        tools.generate(self.env, toolsPath)
        try:
            self.env.MergeFlags({'LIBPATH': [self.rootPath + "/lib"]})
            self.env.MergeFlags({'LIBPATH': [self.rootPath + "/usr/lib"]})
            self.env.MergeFlags({'CPPPATH': [self.rootPath + "/usr/include"]})
            if self.getVar("SPEC_ROOT") != "":
                self.rim.subdirs(self.translate("${SPEC_ROOT}/build"),
                                 self.env)
        except:
            None
        #
        # Record name of sconscript file at the root
        self.croot = comp.croot
        #
        # compute a full path stack for file searches
        #
        self.roots = []
        #
        # Push a series of search paths used to search for spec elements and
        # and implesite library depenedencies.
        #
        # Sequence would be something like:
        # /work/rim/custom/Linux/Ubuntu/lts10.4/x86_64
        # /work/rim/custom/Linux/Ubuntu/lts10.4
        # /work/rim/custom/Linux/Ubuntu/x86_64
        # /work/rim/custom/Linux/Ubuntu
        # /work/rim/custom/Linux/x86_64
        # /work/rim/custom/Linux
        # /opt/rimroots/Linux/Ubuntu/lts10.4/x86_64
        # /opt/rimroots/Linux/Ubuntu/lts10.4
        # /opt/rimroots/Linux/Ubuntu/x86_64
        # /opt/rimroots/Linux/Ubuntu
        # /opt/rimroots/Linux/x86_64
        # /opt/rimroots/Linux
        #
        self.pushTopOfRoot(self.rim.rootsroot)
        customRoot = self.rim.getVar("customRoot")
        self.pushTopOfRoot(customRoot)
        self.pushTopOfRoot(customRoot + '/common')
        self.pushTopOfRoot(customRoot + '/' + app.name)
        self.pushTopOfRoot(customRoot + '/' + prod.name)
        self.pushTopOfRoot(customRoot + '/' + node.amfi.name)
        self.pushTopOfRoot(customRoot + '/' + self.name)