Installing management utilities

In previous sections we have installed a build-server and several build-spaces so that we can build binary packages for use on various client systems. Whilst this will reduce installation time considerably when deploying these binary packages to clients and provide an opportunity to thoroughly test the newly built packages before deployment some of the management tasks we have been required to perform have been cumbersome to say the least.

In this section we shall install two packages which provide a collection of utility scripts designed to reduce the management burden when maintaining a build-server and the related build-spaces. As these packages are not currently available in the official portage repository we shall also install the layman overlay manager application and the Hacking Networked Solutions overlay for Gentoo Linux.

Installing the layman overlay manager

Before we can install the app-portage/layman package on the build-server we first need to install it in the relevant build-space. As you can see from the example below we do not require any of the optional checkout methods to be included when building the app-portage/layman package however if you wish to use other overlays then some of these may be required.

portage chroot /mnt/buildspaces/x86-64bit-server /bin/bash
64bit-SRV portage env-update && source /etc/profile
64bit-SRV portage emerge -pv layman
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild      ] app-portage/layman-1.3.3  USE="-bazaar -cvs -darcs -git -mercurial -subversion -test"

Once you are happy that the app-portage/layman package will be built with all the optional functionality you require it can be installed in the build-space as shown below. Once the build is complete you can exit the build-space and return to the build-server.

64bit-SRV portage emerge layman
64bit-SRV portage exit
portage 

Before the binary package of the app-portage/layman package can be installed on the build-server we need to synchronise the testing package repository to the stable package repository. As we have not yet installed any tools to help with this we shall have to do it manually as shown below.

portage rsync /mnt/repositories/testing/x86-64bit-server/packages/ /mnt/repositories/stable/x86-64bit-server/packages/ --quiet --archive

Now that the package repositories have been synchronised the app-portage/layman package can be installed on the build-server as shown below.

portage emerge layman

The final step in the installation of the app-portage/layman package is to edit the configuration file to point to the "live" repository as shown below. We have also modified the default location of the cache files to reduce clutter in the live/overlay directory and placed the layman managed make.conf file out of the way as it will not be used.

/etc/layman/layman.cfg
storage   : /var/lib/layman
storage : /mnt/repositories/live/overlays

cache : %(storage)s/cache
cache : %(storage)s/cache/cache

make_conf : %(storage)s/make.conf
make_conf : /etc/layman/make.conf

Installing the Hacking Gentoo overlay

With the layman application installed and correctly configured we can install the Hacking Networked Solutions overlay for Gentoo Linux which will provide access to the build-server and build-space utilities. As you can see from the example below before any overlays can be added a list of all available overlays has to be retrieved. Once this list has been downloaded the overlay can be added to the list of installed overlays. The layman application will automatically download the required files from our servers using the rsync application.

portage layman --list
portage layman --add hacking-gentoo

As usual, before the newly installed overlay can be used it must be copied to the testing repositories of the so it is accessible to the build-spaces. Once we have installed the build-server utilities this operation will be automated but for now we shall have to do it by hand as shown below.

portage cp -a /mnt/repositories/live/overlays /mnt/repositories/testing/x86-64bit-server/
portage cp -a /mnt/repositories/live/overlays /mnt/repositories/testing/x86-64bit-workstation/
portage cp -a /mnt/repositories/live/overlays /mnt/repositories/testing/x86-32bit-server/
portage cp -a /mnt/repositories/live/overlays /mnt/repositories/testing/x86-32bit-workstation/

Now that the required overlay has been made available in all the testing repositories we can return to the build-space and complete the installation of the layman application.

portage chroot /mnt/buildspaces/x86-64bit-server /bin/bash
64bit-SRV portage 

The only changes required to the configuration file are shown below. As you can see we have modified the storage location, as before, only this time it points to the copy of the overlays directory from the testing repository. We have also modified the cache location to match that set when configuring the "live" repository. There is no need to modify the make_conf entry as unfortunately the layman application cannot be used to manage the entries in this file, although they are easily maintained manually as shown later.

/etc/layman/layman.cfg
storage   : /var/lib/layman
storage : /mnt/portage/overlays

cache : %(storage)s/cache
cache : %(storage)s/cache/cache

We can check that the layman application has been correctly configured, and that the overlay is available, before we add an entry to /etc/make.conf using the command below.

64bit-SRV portage layman -l
* hacking-gentoo            [Rsync     ] (rsync://rsync.mad-hacking.net/hacking-gentoo-overlay/           ) 

Once you are satisfied that the overlay is indeed installed and available to the build-space the /etc/make.conf file can be modified to include a reference to the overlay as shown in the example. If you wish to use additional overlays you will need to modify PORTDIR_OVERLAY entry accordingly by appending a space-separated list of the additional overlay paths.

/etc/make.conf
PORTDIR=/mnt/portage/portage
DISTDIR=/mnt/portage/distfiles
PKGDIR=/mnt/portage/packages

OVLDIR=/mnt/portage/overlays
PORTDIR_OVERLAY="${OVLDIR}/hacking-gentoo"
Caution:
If you wish to make use of the layman application in other build-spaces you will also need to install it there and configure it as shown above. Unfortunately, as mentioned above, the layman application cannot currently be used to manage the make.conf entries so is of limited use in the build-spaces.
 

Installing the build-space utilities

As promised at the beginning of this guide we can finally install some utilities to assist in the management of the build-server and the build-spaces that we have created. The first package of interest provides a collection of utilities to assist in automating the upgrade process of a build-space. The example below shows a pretend merge of the app-admin/buildspace-scripts package in the 64bit server workspace.

64bit-SRV portage emerge -pv buildspace-scripts
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild      ] mail-mta/ssmtp-2.62-r7  USE="-ipv6 -maxsysuid -md5sum -ssl"
[ebuild      ] virtual/mta
[ebuild      ] mail-client/mutt  USE="nls -berkdb -crypt -debug -doc -gdbm -gnutls -gpg -idn -imap -mbox -nntp -pop -qdbm -sasl -sidebar -smime -smtp -ssl -tokyocabinet -vanilla"
[ebuild      ] dev-libs/bash-outlogger-0.1
[ebuild      ] app-admin/buildspace-scripts-0.2

Once you are happy that the app-admin/buildspace-scripts package will not install any dependencies you do not require, and that the dependencies which will be installed have the correct use-flags set, you can install the package as shown below.

64bit-SRV portage emerge buildspace-scripts

As you can see from the output above one of the dependencies of the app-admin/buildspace-scripts package is a correctly configured Mail Transfer Agent (MTA), in the above example mail-mta/ssmtp. If you wish to receive email messages detailing the status of the update with the relevant log files as attachments it is critical that this package is correctly configured. It can be easily tested using the example command below which should send a totally blank message to the email address configured for the root user.

64bit-SRV portage echo | ssmtp root
Warning:
The app-admin/buildspace-scripts package will need to be installed into all of the build-spaces if the utilities provided by the app-admin/buildserver-scripts package are to function correctly. Appropriate entries will need to be added to the make.conf files of the build-spaces so that they can access the required overlay as described above.
 

Installing the build-server utilities

The second package of interest provides a collection of utilities to assist in synchronising and patching repositories as well as updating and maintaining a collection of build-spaces. The example below shows a pretend merge of the app-admin/buildserver-scripts package.

64bit-SRV portage emerge -pv buildserver-scripts
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild      ] app-portage/auto-patch-portage-0.2
[ebuild      ] app-admin/buildserver-scripts-0.2

Once you are happy that the app-admin/buildserver-scripts package will not install any dependencies you do not require, and that the dependencies which will be installed have the correct use-flags set, you can install the package as shown below.

64bit-SRV portage emerge buildserver-scripts

Before the binary package of the app-admin/buildserver-scripts package can be installed on the build-server we need to synchronise the testing package repository to the stable package repository. As we still have not yet installed any tools to help with this we shall have to do it manually one last time. Remember to exit from the build-space first as shown below.

64bit-SRV portage exit
portage rsync /mnt/repositories/testing/x86-64bit-server/packages/ /mnt/repositories/stable/x86-64bit-server/packages/ --quiet --archive

The binary package of the app-admin/buildserver-scripts package can now be installed on the build-server as shown below.

portage emerge buildserver-scripts

In the next section we shall use the build-server and build-space utilities to automate many of the processes we have had to perform manually in this and previous sections.