准备一个新的 Koji 编译环境
这里讲解了将软件包导入到 Koji 服务器中用来编译RPM包的步骤。前提是您已经成功搭建好了 Koji hub,配置好了合适的认证机制,维护 Koji 库的守护进程(kojira
)也已经配置好并且能正常运行了,系统中至少配置了一台 Koji 编译机(kojid
)并且运行正常。我们假设本文中所有的终端命令是以 Koji 系统管理员的身份运行的。如果您需要搭建 Koji 系统方面的帮助信息,请阅读 ServerHowTo .
- Download all source rpms and binary rpms for the arches you're interested in
- Import all source rpms
$ koji import /path/to/package1.src.rpm /path/to/package2.src.rpm ...
If the files are on the same volume as /mnt/koji, you can use koji import --link
, which
hardlinks the files into place, avoiding the need to upload them to the hub and very significantly
increasing import speed. When using --link
, you must run as root. It is highly recommended that
you use --link
.
- Import all binary rpms using the same method as above
- Create a new tag
$ koji add-tag dist-foo
- Tag all of the packages you just imported into the tag you just created
You can use koji list-untagged
to get a list of all of the packages you just imported.
$ koji list-pkgs --quiet | xargs koji add-pkg --owner <kojiuser> dist-foo $ koji list-untagged | xargs -n 1 koji call tagBuildBypass dist-foo
We call the tagBuildBypass method instead of using koji tag-pkg
because it doesn't require
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
$ koji add-tag --parent dist-foo --arches "i386 x86_64 ppc ppc64" dist-foo-build
- Create a build target that includes the tags you've already created
$ koji add-target dist-foo dist-foo-build
- Create a build group associated with your build tag
$ koji add-group dist-foo-build build
- Populate the build group with packages that will be installed into the minimal buildroot
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.