From Fedora Project Wiki
Line 3: Line 3:
这里讲解了将软件包导入到 Koji 服务器中用来编译RPM包的步骤。前提是您已经成功搭建好了 Koji hub,配置好了合适的认证机制,维护 Koji 库的守护进程(<code>kojira</code>)也已经配置好并且能正常运行了,系统中至少配置了一台 Koji 编译机(<code>kojid</code>)并且运行正常。我们假设本文中所有的终端命令是以 Koji ''系统管理员''的身份运行的。如果您需要搭建 Koji 系统方面的帮助信息,请阅读[[Koji/ServerHowTo| ServerHowTo]] .
这里讲解了将软件包导入到 Koji 服务器中用来编译RPM包的步骤。前提是您已经成功搭建好了 Koji hub,配置好了合适的认证机制,维护 Koji 库的守护进程(<code>kojira</code>)也已经配置好并且能正常运行了,系统中至少配置了一台 Koji 编译机(<code>kojid</code>)并且运行正常。我们假设本文中所有的终端命令是以 Koji ''系统管理员''的身份运行的。如果您需要搭建 Koji 系统方面的帮助信息,请阅读[[Koji/ServerHowTo| ServerHowTo]] .


* Download all source rpms and binary rpms for the arches you're interested in
* 下载所有的源 rpm 包和你感兴趣的系统架构对应的编译好的二进制 rpm 包。


* Import all source rpms
* 导入所有的源 rpm 包
<pre>
<pre>
$ koji import /path/to/package1.src.rpm /path/to/package2.src.rpm ...
$ koji import /path/to/package1.src.rpm /path/to/package2.src.rpm ...
</pre>
</pre>
If the files are on the same volume as /mnt/koji, you can use <code>koji import --link</code>, which
如果这些文件与 /mnt/koji 位于同一个分区中,您可以使用 <code>koji import --link</code>,这条命令将会创建硬链接,将需要导入的文件链接到合适的位置,这样就避免了上传文件到 koji hub 的过程,可以显著地增加导入速度。如果想使用参数 <code>--link</code>,您必须使用 root 身份。'''强烈'''建议您使用参数 <code>--link</code>
hardlinks the files into place, avoiding the need to upload them to the hub and '''very significantly'''
increasing import speed.  When using <code>--link</code>, you must run as root.  It is '''highly''' recommended that
you use <code>--link</code>.


* Import all binary rpms using the same method as above
* 使用上面同样的命令导入所有的二进制 rpm 包


* Create a new tag
* 创建一个新标签
<pre>
<pre>
$ koji add-tag dist-foo
$ koji add-tag dist-foo
</pre>
</pre>


* Tag all of the packages you just imported into the tag you just created
* 将您导入的所有软件包加入到你刚刚创建的标签中
You can use <code>koji list-untagged</code> to get a list of all of the packages you just imported.
您可以使用 <code>koji list-untagged</code> 列出您导入的所有软件包。
<pre>
<pre>
$ koji list-pkgs --quiet | xargs koji add-pkg --owner <kojiuser> dist-foo
$ koji list-pkgs --quiet | xargs koji add-pkg --owner <kojiuser> dist-foo
$ koji list-untagged | xargs -n 1 koji call tagBuildBypass dist-foo
$ koji list-untagged | xargs -n 1 koji call tagBuildBypass dist-foo
</pre>
</pre>
We call the ''tagBuildBypass'' method instead of using <code>koji tag-pkg</code> because it doesn't require
我们调用了 ''tagBuildBypass'' 方法而不是提交 <code>koji tag-pkg</code> 任务,因为它不需要编译机逐个执行 ''tagBuild'' 任务,而是直接将软件包打入到标签中了。这将节省大量的时间,尤其是在您需要处理大量软件包的时候。
the builders to process ''tagBuild'' tasks one at a time, but does the tagging directly.  This will save a significant amount of time, especially when tagging a large number of packages.


* Create a build tag with the desired arches, and the previously created tag as a parent
*以您前面创建的标签为父标签,创建一个包含您所需系统架构的编译标签
<pre>
<pre>
$ koji add-tag --parent dist-foo --arches "i386 x86_64 ppc ppc64" dist-foo-build
$ koji add-tag --parent dist-foo --arches "i386 x86_64 ppc ppc64" dist-foo-build
</pre>
</pre>


* Create a build target that includes the tags you've already created
* 创建一个编译目标包含您前面已经创建的两个标签
<pre>
<pre>
$ koji add-target dist-foo dist-foo-build
$ koji add-target dist-foo dist-foo-build
</pre>
</pre>


* Create a ''build'' group associated with your build tag
* 创建一个与你的编译标签有关的 ''build'' 分组
<pre>
<pre>
$ koji add-group dist-foo-build build
$ koji add-group dist-foo-build build
</pre>
</pre>


* Populate the ''build'' group with packages that will be installed into the minimal buildroot
* 将构建最小编译环境的软件包添加到这个 ''build'' 分组中
You can find out what the current build group for Fedora is by running <code>koji list-groups f16-build</code>
You can find out what the current build group for Fedora is by running <code>koji list-groups f16-build</code>
against the Fedora Koji instance.  This is probably a good starting point for your minimal buildroot.
against the Fedora Koji instance.  This is probably a good starting point for your minimal buildroot.

Revision as of 02:43, 24 March 2012

准备一个新的 Koji 编译环境

这里讲解了将软件包导入到 Koji 服务器中用来编译RPM包的步骤。前提是您已经成功搭建好了 Koji hub,配置好了合适的认证机制,维护 Koji 库的守护进程(kojira)也已经配置好并且能正常运行了,系统中至少配置了一台 Koji 编译机(kojid)并且运行正常。我们假设本文中所有的终端命令是以 Koji 系统管理员的身份运行的。如果您需要搭建 Koji 系统方面的帮助信息,请阅读 ServerHowTo .

  • 下载所有的源 rpm 包和你感兴趣的系统架构对应的编译好的二进制 rpm 包。
  • 导入所有的源 rpm 包
$ koji import /path/to/package1.src.rpm /path/to/package2.src.rpm ...

如果这些文件与 /mnt/koji 位于同一个分区中,您可以使用 koji import --link,这条命令将会创建硬链接,将需要导入的文件链接到合适的位置,这样就避免了上传文件到 koji hub 的过程,可以显著地增加导入速度。如果想使用参数 --link,您必须使用 root 身份。强烈建议您使用参数 --link

  • 使用上面同样的命令导入所有的二进制 rpm 包
  • 创建一个新标签
$ koji add-tag dist-foo
  • 将您导入的所有软件包加入到你刚刚创建的标签中

您可以使用 koji list-untagged 列出您导入的所有软件包。

$ koji list-pkgs --quiet | xargs koji add-pkg --owner <kojiuser> dist-foo
$ koji list-untagged | xargs -n 1 koji call tagBuildBypass dist-foo

我们调用了 tagBuildBypass 方法而不是提交 koji tag-pkg 任务,因为它不需要编译机逐个执行 tagBuild 任务,而是直接将软件包打入到标签中了。这将节省大量的时间,尤其是在您需要处理大量软件包的时候。

  • 以您前面创建的标签为父标签,创建一个包含您所需系统架构的编译标签
$ koji add-tag --parent dist-foo --arches "i386 x86_64 ppc ppc64" dist-foo-build
  • 创建一个编译目标包含您前面已经创建的两个标签
$ koji add-target dist-foo dist-foo-build
  • 创建一个与你的编译标签有关的 build 分组
$ koji add-group dist-foo-build build
  • 将构建最小编译环境的软件包添加到这个 build 分组中

You can find out what the current build group for Fedora is by running koji list-groups f16-build against the Fedora Koji instance. This is probably a good starting point for your minimal buildroot.

$ koji add-group-pkg dist-foo-build build pkg1
$ koji add-group-pkg dist-foo-build build pkg2
  • Wait for the repo to regenerate, and you should now be able to run a build successfully.