Ejemplo n.º 1
0
    def _setDepsRequs(cls, swirlFile):
        """given a SwirlFile object it add to it all the dependency and all 
        the provides to it """

        #find deps
        for line in getOutputAsList(['bash', cls._RPM_FIND_DEPS], swirlFile.path)[0]:
            if len(line) > 0:
                newDep = Dependency( line )
                newDep.setPluginName( cls.pluginName )
                swirlFile.addDependency( newDep )
                #i need to take the parenthesis out of the game
                tempList = re.split('\(|\)',line)
                if len(tempList) > 3:
                    #set the 32/64 bits 
                    #probably unecessary
                    if tempList[3].find("64bit") >= 0 :
                        newDep.set64bits()
                    elif tempList[3].find("32bit") >= 0 :
                        #this should never happen
                        newDep.set32bits()
                else:
                    #no parenthesis aka 32 bit 
                    newDep.set32bits()
                p = cls.getPathToLibrary( newDep )
                if p:
                    newDep.pathList.append( p )
        
        #find provides
        for line in getOutputAsList(['bash', cls._RPM_FIND_PROV], swirlFile.path)[0]:
            if len(line) > 0 :
                newProv = Provide(line)
                newProv.setPluginName( cls.pluginName )
                swirlFile.addProvide(newProv)
Ejemplo n.º 2
0
 def getDependeciesFromPath(cls, fileName):
     """given a file name it returns a Provide object with all the goodies in it
     """
     returnValue = []
     for line in getOutputAsList(['bash', cls._RPM_FIND_PROV], fileName)[0]:
         if len(line) == 0:
             continue
         newDep = Dependency( line )
         newDep.setPluginName( cls.pluginName )
         newDep.pathList.append( fileName )
         #i need to take the parenthesis out of the game
         tempList = re.split( '\(|\)', line )
         if len( tempList ) > 3:
             #set the 32/64 bits
             #probably unecessary
             if tempList[3].find( "64bit" ) >= 0 :
                 newDep.set64bits()
             elif tempList[3].find( "32bit" ) >= 0 :
                 #this should never happen
                 newDep.set32bits()
         else:
             #no parenthesis aka 32 bit
             newDep.set32bits()
         returnValue.append( newDep )
     return returnValue
Ejemplo n.º 3
0
    def _setDepsRequs(cls, swirlFile, swirl):
        """
        given a SwirlFile object add all the dependency and all the provides
        to it

        :type swirlFile: :class:`FingerPrint.swirl.SwirlFile`
        :param swirlFile: the SwirlFile we need to find all the dependencies

        :type swirl: :class:`FingerPrint.swirl.Swirl`
        :param swirl: the Swirl that will be used to first lookup already
                          discovered dependencies
        """

        # find rpath first
        rpath = getOutputAsList([
            "bash", "-c",
            "objdump -x %s |grep RPATH|awk '{print $2}'" % swirlFile.path
        ])[0]
        if len(rpath) > 0:
            if "$ORIGIN" in rpath[0]:
                rpath[0] = string.replace(rpath[0], "$ORIGIN",
                                          os.path.dirname(swirlFile.path))
            swirlFile.rpaths = rpath[0].split(":")
# check LD_LIBRARY_PATH
        ld_library = FingerPrint.utils.getLDLibraryPath(swirlFile.env)

        #find deps
        for line in getOutputAsList(['bash', cls._RPM_FIND_DEPS],
                                    swirlFile.path)[0]:
            if len(line) > 0:
                newDep = Dependency.fromString(line)
                swirlFile.addDependency(newDep)
                p = cls.getPathToLibrary(newDep,
                                         useCache=True,
                                         rpath=swirlFile.rpaths + ld_library)
                if not p:
                    # a dependency was not found complain loudly
                    logger.error("Unable to find library %s" % newDep)
                    continue
                if p and not swirl.isFileTracked(p):
                    # p not null and p is not already in swirl
                    cls.getSwirl(p, swirl, swirlFile.env)

        #find provides
        for line in getOutputAsList(['bash', cls._RPM_FIND_PROV],
                                    swirlFile.path)[0]:
            if len(line) > 0:
                newProv = Dependency.fromString(line)
                swirlFile.addProvide(newProv)
Ejemplo n.º 4
0
    def _setDepsRequs(cls, swirlFile, swirl):
        """
        given a SwirlFile object add all the dependency and all the provides
        to it

        :type swirlFile: :class:`FingerPrint.swirl.SwirlFile`
        :param swirlFile: the SwirlFile we need to find all the dependencies

        :type swirl: :class:`FingerPrint.swirl.Swirl`
        :param swirl: the Swirl that will be used to first lookup already
                          discovered dependencies
        """

        # find rpath first
        rpath = getOutputAsList(["bash","-c", "objdump -x %s |grep RPATH|awk '{print $2}'" % swirlFile.path ])[0]
        if len( rpath ) > 0:
            if "$ORIGIN" in rpath[0]:
                rpath[0] = string.replace(rpath[0], "$ORIGIN", os.path.dirname(swirlFile.path))
            swirlFile.rpaths = rpath[0].split(":")
	# check LD_LIBRARY_PATH
	ld_library = FingerPrint.utils.getLDLibraryPath(swirlFile.env)

        #find deps
        for line in getOutputAsList(['bash', cls._RPM_FIND_DEPS], swirlFile.path)[0]:
            if len(line) > 0:
                newDep = Dependency.fromString( line )
                swirlFile.addDependency( newDep )
                p = cls.getPathToLibrary( newDep , useCache = True,
                        rpath = swirlFile.rpaths + ld_library)
                if not p:
                    # a dependency was not found complain loudly
                    logger.error("Unable to find library %s" % newDep)
                    continue
                if p and not swirl.isFileTracked(p):
                    # p not null and p is not already in swirl
                    cls.getSwirl(p, swirl, swirlFile.env)
        
        #find provides
        for line in getOutputAsList(['bash', cls._RPM_FIND_PROV], swirlFile.path)[0]:
            if len(line) > 0 :
                newProv = Dependency.fromString(line)
                swirlFile.addProvide(newProv)
Ejemplo n.º 5
0
 header = f.readline().rstrip()
 f.close()
 pythonVer = None
 if header[0:2] == '#!':
     for i in re.split(' |/|!', header):
         if 'python' in i:
             pythonVer = i
 if not pythonVer:
     pythonVer = cls._prefix
 for item in cls._getModules(lis) :
     newdepName = pythonVer + "(" + item + ")"
     # newdepName is not in buildin_modules and
     # it's really a new dep
     if item not in cls._buildin_modules and \
         newdepName not in [ i.depname for i in swirlFile.dependencies ]:
         newDep = Dependency( newdepName )
         newDep.setPluginName( cls.pluginName )
         #
         # we have to find which file provides this dep
         #
         #TODO move to a function
         paths = []
         #TODO load from a differen interpreter
         if pythonVer == 'python' or pythonVer == cls._prefix:
             #we can use this interpreter
             try:
                 if '.' in item:
                     # When the name variable is of the form package.module,
                     # normally, the top-level package (the name up till the
                     # first dot) is returned, not the module named by name.
                     # so we need __import__('xml.sax.handler', glob, local, 'handler')