def addDependencies(self, category, package, version = "", dep_type="both"):
        """Add a new root dependency tree to this graph."""

        pi = portage.PortageInstance

        if portage.emergePlatform.isCrossCompilingEnabled() \
        or utils.isSourceOnly():
            sp = pi.getCorrespondingSourcePackage(package)
            if sp:
                # we found such a package and we're allowed to replace it
                category = sp[0]
                package = sp[1]
                version = pi.getNewestVersion(category, package)

        if category == "":
            category = pi.getCategory(package)

        if version == "":
            version = pi.getNewestVersion(category, package)

        try:
            tag = pi.getDefaultTarget( category, package, version )
        except ImportError:
            tag = "1"

        if not os.path.exists( os.path.join( portage.getDirname( category, package ), package + "-package.xml" ) ):
            node = self.buildDepNode( category, package, version, tag, dep_type )
        else:
            node = self.buildVirtualNodes( category, package, version, tag, dep_type )

        if not node in self.roots:
            self.roots.append(node)
Пример #2
0
    def addDependencies(self, category, package, version="", depType="both"):
        """Add a new root dependency tree to this graph."""

        pi = portage.PortageInstance

        if category == "":
            category = pi.getCategory(package)

        if version == "":
            version = pi.getNewestVersion(category, package)

        try:
            tag = pi.getDefaultTarget(category, package)
        except ImportError:
            tag = "1"

        if not os.path.exists(
                os.path.join(portage.getDirname(category, package),
                             package + "-package.xml")):
            node = self.buildDepNode(category, package, version, tag, depType)
        else:
            node = self.buildVirtualNodes(category, package, version, tag,
                                          depType)

        if not node in self.roots:
            self.roots.append(node)
Пример #3
0
    def buildVirtualNodes(self, category, package, version, tag, dep_type="both"):
        converter = xml2conf.Xml2Conf()
        converter.parseFile(os.path.join(portage.getDirname(category, package), package + "-package.xml"))

        key = "%s-%s-%s-%s" % (category, package, version, tag)
        try:
            node = self.key2node[key]
            return node
        except KeyError:
            pass

        rootnode = DependenciesNode(category, package, version, tag, [])
        rootnode.metaData = self.getMetaData( category, package )

        if package == converter.moduleMetaName: rootnode.virtual = True
        self.__buildSubNodes(rootnode, converter)
        return rootnode
Пример #4
0
    def addDependencies(self, category, package, version = "", dep_type="both"):
        """Add a new root dependency tree to this graph."""

        pi = portage.PortageInstance

        if category == "":
            category = pi.getCategory(package)

        if version == "":
            version = pi.getNewestVersion(category, package)

        try:
            tag = pi.getDefaultTarget( category, package )
        except ImportError:
            tag = "1"

        if not os.path.exists( os.path.join( portage.getDirname( category, package ), package + "-package.xml" ) ):
            node = self.buildDepNode( category, package, version, tag, dep_type )
        else:
            node = self.buildVirtualNodes( category, package, version, tag, dep_type )

        if not node in self.roots:
            self.roots.append(node)
Пример #5
0
    def buildVirtualNodes(self,
                          category,
                          package,
                          version,
                          tag,
                          depType="both"):
        converter = xml2conf.Xml2Conf()
        converter.parseFile(
            os.path.join(portage.getDirname(category, package),
                         package + "-package.xml"))

        key = "%s-%s-%s-%s" % (category, package, version, tag)
        try:
            node = self.key2node[key]
            return node
        except KeyError:
            pass

        rootnode = DependenciesNode(category, package, version, tag, [])
        rootnode.metaData = self.getMetaData(category, package)

        if package == converter.moduleMetaName: rootnode.virtual = True
        self.__buildSubNodes(rootnode, converter)
        return rootnode
Пример #6
0
 def packageDir(self):
     """ add documentation """
     return self.__adjustPath( portage.getDirname( self.category, self.package ) )
Пример #7
0
 def packageDir(self):
     """ add documentation """
     return self.__adjustPath(
         portage.getDirname(self.category, self.package))