文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>从源码阐述Bitbake Collections

从源码阐述Bitbake Collections

时间:2007-10-16  来源:linuxGentoo

BBFILES := "${OEDIR}/openembedded/packages/*/*.bb ${LOCALDIR}/packages/*/*.bb"
BBFILE_COLLECTIONS = "upstream local"
BBFILE_PATTERN_upstream = "^${OEDIR}/openembedded/packages/"
BBFILE_PATTERN_local = "^${LOCALDIR}/packages/"
BBFILE_PRIORITY_upstream = "5"
BBFILE_PRIORITY_local = "10"
官方OE有一个分支,这算成third party,我们自己需要开发自己的oe package,所以我们也需要一个分支,但是又不希望更改OE的分支,这也就是bitbake collections的来历吧   BBFILE_COLLECTIONS定义有多少个分支,这里有upstream和local BBFILE_PATTERN,为每个分支定义正则表达式, BBFILE_PRIORITY为每个分支定义优先级   我们来看源码    

def handleCollections( self, collections ):
        """Handle collections"""
        if collections:
            collection_list = collections.split()
            for c in collection_list:
                regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1)
                if regex == None:
                    bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s not defined" % c)
                    continue
                priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1)
                if priority == None:
                    bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PRIORITY_%s not defined" % c)
                    continue
                try:
                    cre = re.compile(regex)
                except re.error:
                    bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s \"%s\" is not a valid regular expression" % (c, regex))
                    continue
                try:
                    pri = int(priority)
                    self.status.bbfile_config_priorities.append((cre, pri))
                except ValueError:
                    bb.msg.error(bb.msg.domain.Parsing, "invalid value for BBFILE_PRIORITY_%s: \"%s\"" % (c, priority))

 

传进来的参数就是BBFILE_COLLECTIONS 变量值,函数的主要功能就是为每个分支计算出正则表达式匹配和优先级,填充bbfile_config_priorities,比如如上面说定义的BBFILE_COLLECTIONS,

bbfile_config_priorities[(re.compile("^${OEDIR}/openembedded/packages/"),5),(re.compile("^${LOCALDIR}/packages/"),10)]

这就是这个函数的task

我们继续看如何计算每个bbfile 的priorities

def calc_bbfile_priority(filename):
            for (regex, pri) in self.status.bbfile_config_priorities:
                if regex.match(filename):
                    return pri
            return 0
每个bb文件,如果能够和bbfile_config_priorities里的正则表达式匹配,那么就赋予这个bb文件伴随的priorities

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载