2013-10-09 00:09:05

How to set up Koji for SCL

A friend of mine has private instance of Koji and want to build Software Collections (SCL) there. The true is, that you can find documentation how to build SCL localy using rpmbuild, how to modify mock config. But there is no information how to set up Koji. So here it comes:

You need to have two packages to be always presented in buildroot: 'scl-utils-build' and 'scl meta package' (e.g. 'ruby193-build'). The first one define all SCL macros. And they all expand only if %{scl} is defined. And this %{scl} macro is defined in that second package.

Why? If you realize, that your spec files contains something like:

BuildRequires: %{?scl_prefix}rubygems

You need to have defined scl_prefix (which is defined only if scl is defined) before you start parsing spec. Which means you could not BuildRequire package which provides those scl macros. So it must be presented in minimal chroot which koji always install.

Now you can try to run:

koji -c ~/.koji/katello-config list-groups katello-thirdparty-foreman-rhel6-build

Where katello-config is config which have configuration for my private instance of koji. And katello-thirdparty-foreman-rhel6-build is build tag - not to be confused with build target. And you will get output similar to:

build  [katello-thirdparty-foreman-rhel6]
  bash: None, default  [katello-thirdparty-foreman-rhel6]
  bzip2: None, default  [katello-thirdparty-foreman-rhel6]
  coreutils: None, default  [katello-thirdparty-foreman-rhel6]
  cpio: None, default  [katello-thirdparty-foreman-rhel6]
  diffutils: None, default  [katello-thirdparty-foreman-rhel6]
  findutils: None, default  [katello-thirdparty-foreman-rhel6]
  gawk: None, default  [katello-thirdparty-foreman-rhel6]
  gcc: None, default  [katello-thirdparty-foreman-rhel6]
  gcc-c++: None, default  [katello-thirdparty-foreman-rhel6]
  grep: None, default  [katello-thirdparty-foreman-rhel6]
  gzip: None, default  [katello-thirdparty-foreman-rhel6]
  info: None, default  [katello-thirdparty-foreman-rhel6]
  make: None, default  [katello-thirdparty-foreman-rhel6]
  patch: None, default  [katello-thirdparty-foreman-rhel6]
  redhat-release-server: None, default  [katello-thirdparty-foreman-rhel6]
  redhat-rpm-config: None, default  [katello-thirdparty-foreman-rhel6]
  rpm-build: None, default  [katello-thirdparty-foreman-rhel6]
  sed: None, default  [katello-thirdparty-foreman-rhel6]
  shadow-utils: None, default  [katello-thirdparty-foreman-rhel6]
  tar: None, default  [katello-thirdparty-foreman-rhel6]
  unzip: None, default  [katello-thirdparty-foreman-rhel6]
  util-linux: None, default  [katello-thirdparty-foreman-rhel6]
  which: None, default  [katello-thirdparty-foreman-rhel6]
  xz: None, default  [katello-thirdparty-foreman-rhel6]
srpm-build  [katello-thirdparty-foreman-rhel6]
  bash: None, default  [katello-thirdparty-foreman-rhel6]
  curl: None, default  [katello-thirdparty-foreman-rhel6]
  gnupg2: None, default  [katello-thirdparty-foreman-rhel6]
  make: None, default  [katello-thirdparty-foreman-rhel6]
  redhat-release-server: None, default  [katello-thirdparty-foreman-rhel6]
  redhat-rpm-config: None, default  [katello-thirdparty-foreman-rhel6]
  rpm-build: None, default  [katello-thirdparty-foreman-rhel6]
  shadow-utils: None, default  [katello-thirdparty-foreman-rhel6]

'Build' group is group which will be always installed by Koji. You can have others group as well, but that will be different story.

NOTE: I assume that you have base SCL package (ruby193 in our example) already built in Koji. This is ordinary package; without SCL macros in spec and you must build it before you enable SCL in Koji.

You can add package to some group using:

koji add-group-pkg <build tag> build <package name without version-release>

So in our case we will run:

koji -c ~/.koji/katello-config add-group-pkg katello-thirdparty-foreman-rhel6-build build scl-utils-build
koji -c ~/.koji/katello-config add-group-pkg katello-thirdparty-foreman-rhel6-build srpm-build scl-utils-build

First two commands are for 'build' group. Second two are for 'srpm-build' group.

Now you have to regenerete repo:

koji -c ~/.koji/katello-config regen-repo katello-thirdparty-foreman-rhel6-build

Now you can build base SCL package (ruby193 in our example). You could not build it earlier otherwise you will get error:

error: line 2: Unknown tag: %scl_package ruby193

So once it is build, you can add it to build tag and regen repo again:

koji -c ~/.koji/katello-config add-group-pkg katello-thirdparty-foreman-rhel6-build build ruby193-build
koji -c ~/.koji/katello-config add-group-pkg katello-thirdparty-foreman-rhel6-build srpm-build ruby193-build
koji -c ~/.koji/katello-config regen-repo katello-thirdparty-foreman-rhel6-build

Now if you run again:

koji -c ~/.koji/katello-config list-groups katello-thirdparty-foreman-rhel6-build

You will see small change in output:

build  [katello-thirdparty-foreman-rhel6]
  .... SNIP ....
  ruby193-build: None, default  [katello-thirdparty-foreman-rhel6-build]
  scl-utils-build: None, default  [katello-thirdparty-foreman-rhel6-build]
  .... SNIP ....
srpm-build  [katello-thirdparty-foreman-rhel6]
  .... SNIP ....
  ruby193-build: None, default  [katello-thirdparty-foreman-rhel6-build]
  scl-utils-build: None, default  [katello-thirdparty-foreman-rhel6-build]
  .... SNIP ....

And packages build into katello-thirdparty-foreman-rhel6 will always have those two packages in build root from now. And package with scl macros will be now in this tag build as SCL packages. But only those which have scl macros. Packages without scl macros in spec file, will be still ordinary packages.

NOTE: As you may notice, you can build only one collection per Koji tag. If you want to build two collections - e.g. ruby193 and php55 - you have to use two sets of koji tags.


Posted by Miroslav Suchý | Permanent link
Comments
comments powered by Disqus