1 def base_detect_revision(d):
2 path = base_get_scmbasepath(d)
3 return base_get_metadata_git_revision(path, d)
4
>> 5 def base_detect_branch(d):
6 path = base_get_scmbasepath(d)
7 return base_get_metadata_git_branch(path, d)
8
>> 9 def base_get_scmbasepath(d):
10 return os.path.join(d.getVar('COREBASE'), 'meta')
11
>> 12 def base_get_metadata_svn_revision(path, d):
-- 13 # This only works with older subversion. For newer versions
14 # this function will need to be fixed by someone interested
15 revision = "<unknown>"
16 try:
17 ¦ with open("%s/.svn/entries" % path) as f:
18 ¦ ¦ revision = f.readlines()[3].strip()
19 except (IOError, IndexError):
20 ¦ pass
21 return revision
22
>> 23 def base_get_metadata_git_branch(path, d):
24 import bb.process
25
26 try:
27 ¦ rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
28 except bb.process.ExecutionError:
29 ¦ rev = '<unknown>'
30 return rev.strip()
31 base_get_metadata_git_revision(path, d)
>> 32 def base_get_metadata_git_revision(path, d):
33 import bb.process
34
35 try:
36 ¦ rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
37 except bb.process.ExecutionError:
38 ¦ rev = '<unknown>'
39 return rev.strip()
40
>> 41 METADATA_BRANCH := "${@base_detect_branch(d)}"
42 METADATA_BRANCH[vardepvalue] = "${METADATA_BRANCH}"
>> 43 METADATA_REVISION := "${@base_detect_revision(d)}"
44 METADATA_REVISION[vardepvalue] = "${METADATA_REVISION}"
base.bbclass 详细分析 —— metadata_scm.bbclass
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1 设置 NATIVELSBSTRING ORIGNATIVELSBSTRING BB_VERSION 2 hos...
- Handle backfilling Handle PACKAGECONFIG 用到的方法 根据PACKAGECO...
- task chain 构建 base.class patch.bbclass staging.bbclass ut...