Koji/BriefSetup

De TartareFR
Aller à la navigation Aller à la recherche

Koji Tags and Targets

These commands do not have to be done on the koji build server, as long as you are setup with authority to interact with the koji server.

For this example, we will setup a tag to build on fedora 13.

koji add-tag f13
koji add-tag --arches "i686,x86_64" f13-build 
koji add-target f13 f13-build f13
koji add-group f13-build build
koji add-group-pkg f13-build build bash bzip2 coreutils cpio diffutils findutils gawk
koji add-group-pkg f13-build build gcc gcc-c++ grep gzip info make patch redhat-rpm-config
koji add-group-pkg f13-build build rpm-build sed shadow-utils tar unzip util-linux-ng which
koji add-group-pkg f13-build build fedora-release
koji add-group-pkg f13-build build buildsys-macros-el6

Now we need to setup a repository for our build target. For this example, we will use a fedora mirror that is close to our build server, in Austratia.

koji add-external-repo fedora13-base http://mirror.aarnet.edu.au/pub/fedora/linux/releases/13/Fedora/\$arch/os/
koji add-external-repo fedora13-base -t f13-build

Now we also need to add our special build repository. This is where we keep various packages that aren't in the release, but are needed for building. In this instance we have buildsys-macros-el6 that needs to be installed. This package ensures that the %dist variable is set to el6 instead of f13.

koji add-external-repo ascendos-build http://build.ascendos.org/external/ascendos/build/\$arch/
koji add-external-repo ascendos-build -t f13-build

Regenerate repo

It's always the build tag

koji regen-repo dist-f15-build

Common Mistakes, Errors and Troubleshooting

Koji is a tool which can be nightmare for you. At times, even when everything will look fine, it won't work or throw some of the most weird error messages for you to resolve. Here are some of them with probable solutions.

I am getting "OSError: [Errno 13] Permission denied" what do I do?

  • Check that permission for /var/{lib,cache}/mock is 02755.
You can set this permission by the following commands:
chmod 02755 /var/lib/mock
chmod 02755 /var/cache/mock
  • Make sure that you have build and srpm-build defined into your build tag. Use this guide to define them. Also ensure that bare minimum required packages are added to the each group. I have added following packages in my Koji instance:
bash bzip2 coreutils cpio diffutils findutils gawk gcc grep sed gcc-c++ gzip info patch redhat-rpm-config rpm-build shadow-utils tar unzip
util-linux-ng which make

I can build using srpm but not using SCM url. How to fix that?

  • You need to have some files in you scm (git or subversion etc)

These are a Makefile, all the patches and spec file. Makefile will consist of the url of the source and way to download it.

  • Make sure that you are giving a complete SCM build command, an example using anonymous checkout
koji build --scratch mytag git://abc.com/project.git#d9e1204eddd9ae972456a9bdd2d847a
  • Make sure that you have added the url of the SCM in /etc/kojid/kojid.conf and restarted the kojid

I am getting "ERROR: Could not find useradd in chroot, maybe the install failed?"

I am getting "GenericError: failed to merge repos:" while trying to regenerate repos. What do I do?

  • Use the command "koji list-external-repos" and check out that there are no extra trailing '/' and do not hardcode the arch
  • Use $arch instead and don't forget to escape $arch using '\' else it will be evaluated while adding it to repos only.
  • Ensure that disk is not full

I am getting "BuildrootError: could not init mock buildroot, mock exited with status 20; see root.log for more information" but root.log is empty.

  • Now Koji is trying to make a fool out of you. Well, no, actually Koji guesses what log has the relevant error message and this time it has guessed wrong. Just check out mock_output.log. Make sure that you have bare minimum packages added to your build group.