GBS文件配置概述

本文从:https://source.tizen.org/documentation/reference/git-build-system/configuration-file翻译而来。

1 概述

GBS为编译tizen源码的工具,GBS的配置文件包含GBS所有的配置信息.例如编译后的根目录;gbs build的远程repo url地址;gbs remotebuild的OBS服务器等。

2 GBS如何如何使用配置文件

GBS将会在下述目录中查找配置文件(.gbs.confi),如果GBS找到多个配置文件,那么它将按下面的顺序来装载它:

  • /etc/.gbs.conf                 ---全局配置文件,不建议修改(如果存在的话)
  • ~/.gbs.conf                     ---由用户修改的配置文件
  • $PWD/.gbs.conf           ---局部或本地配置文件

如果同时存在上述三个配置文件中的多个,那么后面的参数值如果与前面有重复的话,那么后面的参数值将会覆盖前面定义的参数值。也可以指定具体使用哪个配置文件,可以在gbs -c(--conf)后面指定具体的配置文件。如果GBS找不到配置文件,那么它将会生成一个配置文件,并且保存到~/.gbs.conf文件中。

3 配置文件中面向profile的风格

一个profile可以包含gbs build或gbs remotebuild的多项配置。也可以在一个conf文件中同时存在多个profile,以针对多个不同的设备,如手机,IVI等。

默认使用的profile在[general] 的section处定义。

注:这里section不太好翻译,它表示的是.gbs.conf文件中以中括号开始到下一个中括号之间的部分。可以包含多个选项,它一般作为一个整体可以被其它地方索引,中括号内是它的索引名字.

如果你修改[general]的profile索引,那表示使用另一个配置,这可能跟之前的prlfile配置有很大的区别。

section必须遵循如下规则:

profile section的名字必须以profile.开头。

OBS section的名字必须以obs.开头。

Repository section的名字必须以repo.开头。

常用的登陆认证信息可以在profile section部分进行配置,没必要在不同的obs和repo处进行配置。如果实在是不同的obs和repo的登陆认证信息不一样,那么可以在不同的obs和repo section处理进行配置。

下面是一个配置文件的例子:

[general]
#Current profile name which should match a profile section name
profile = profile.tizen
buildroot = ~/GBS-ROOT/

[profile.tizen]
obs = obs.tizen
repos = repo.tizen_latest
# If no buildroot for profile, the buildroot in general section will be used
buildroot = ~/GBS-ROOT-profile.tizen/

[obs.tizen]
url = https://api.tizen.org
user = xxxx
passwd = xxxx
# set default base_prj for this obs
#base_prj=Tizen:Main
# set default target prj for this obs, default is home:<user>:gbs:<base_prj>
#target_prj=<specify target project>

[repo.tizen_latest]
url = http://download.tizen.org/releases/trunk/daily/ivi/latest/
#Optional user and password, set if differ from profile's user and password
#user =
#passwd =

4 如何为gbs build进行配置

repo section部分配置的是仓库信息,它的名字必须以repo.开头,它主要包含三项信息:url,user和passwd.

注:当你配置仓库信息时,请使用release下的目录,而不是snapshot下的目录。release下的images/repos是经过release工程师测试过的,而snapshot下的images/repos是由后台服务自动生成,可靠性没有保障。

你可以在conf文件中定义多个repo,请看示例:

[profile.tizen]
repos = repo.tizen_latest, repo.my_local

[repo.tizen_latest]
url = http://download.tizen.org/releases/trunk/daily/ivi/latest/
user = xxx
passwd = xxx
[repo.my_local]
#local repo must be an absolute path
url = /path/to/local/repo/

注:本地仓库必须是绝对路径。你不必要通过'createrepo'指令来创建那个本地仓库,只需要写上注释即可。

5 为gbs build配置生成根目录

默认的gbs build生成的根目录是~/GBS-ROOT/,不过你可以修改它。如下:

[profile.tizen]
obs = obs.tizen
repos = repo.tizen_latest
buildroot = ~/GBS-ROOT/

注:当使用gbs后,密码passwd将会被自动修改成passwdx,如下所示:

[obs.tizen]
url = https://api.tizen.org
user = xxxx
passwdx = QlpoOTFBWSZTWVyCeo8AAAKIAHJAIAAhhoGaAlNOLuSKcKEguQT1
如果你要设置新密码,那么只需要将passwdx字样改回passwd,然后修改其后的密码即可。

6 配置多个profile

针对多种不同的设备,如手机,IVI等,你可以在一个gbs conf文件中配置多个profile,只需要在[general]下指定到底使用哪个profile即可。

如下:

[general]
profile = profile.ivi

[profile.mobile]
...
[profile.ivi]
...

7 在命令行下指定profile

除了在配置文件中指定profile,你也可以在命令行下指令,只需要在gbs build后面使用---profile/-P就可以了。你可以指出profile的全称(包含profile.前缀),也可以指定不包含profile.前缀的名称,如下:

$ gbs build --profile=profile.mobile -A i586
$ gbs remotebuild --profile=mobile -A i586   # given profile name without the "profile." prefix

8 在命令行下指定配置文件

如果你预告定义了多个配置文件,那么你可以命令行下通过使用--conf/-C选项来指定到底使用哪个具体的配置文件,此时,默认的.gbs.conf将会被忽略。如下:

gbs -C ~/gbs-my.conf build -A ...


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章