How to build r10k packages

Wanted to use r10k for puppet environments, but there where no rpm packages and I don’t like to use stuff from the interwebs on my production machines. So I ended up to build me some rpm packages for myself. This build configuration ist intended for centos 7.

First install the build dependencies.

yum install @development ruby-devel

After that, install fpm via gem (we should also paketize this)

gem install fpm

Now temporary download all the gems needed for r10k

gem install --no-ri --no-rdoc --install-dir /tmp/gems r10k

One has to delete the r10k gem, because one will do this in a seperate run afterwards

rm -rf /tmp/gems/cache/r10k-2.0.3.gem

Finally build all the other gems into rpms.

find /tmp/gems/cache -name '*.gem' | xargs -rn1 \
fpm \
-d ruby \
-d rubygems \
-s gem \
-t rpm \
--iteration 1.el7 \
--epoch 1

Now build the r10k rpm. One has to exlude „colored“ and include it „by hand“ because if one doesn’t the dependencies for r10k will be somewhat broken.

fpm \
-d ruby \
-d rubygems \
-d rubygem-colored \
--gem-disable-dependency colored \
-s gem \
-t rpm \
--iteration 1.el7 \
--epoch 1 \
r10k

Clean up…

rm -rf /tmp/gems