Skip to content
itkovian edited this page Apr 19, 2012 · 13 revisions

Configuring EasyBuild is done by providing a configuration file.

EasyBuild will try and find a config file in the following places (in order):

  • if a configuration file is specified on the EasyBuild command line, the build process tries use it,
  • else, if the environment variable EASYBUILDCONFIG is defined, it treats this as the path for the configuration file,
  • otherwise, it will try and use the (default) configuration file at the <path where EasyBuild was placed>/easybuild/easybuild_config.py.

Once found, the configuration file is executed as if it were Python code (using exec), which provides a lot of flexibility to configurate EasyBuild.

How configuration works

The configuration file should define the following six variables: buildPath, installPath, sourcePath, repositoryType, repositoryPath and logFormat. If one of these variables is not defined, EasyBuild will complain and bail.

Build path

The buildPath variable specifies the directory in which EasyBuild builds software packages.

Building a software package is always performed in a subdirectory of the build path given by <name>/<version>/<toolkit><versionsuffix> .

These build directories are emptied by EasyBuild when the installation is completed.

Install path

The installPath variable specifies the directory in which EasyBuild installs software packages.

In the install path, EasyBuild creates a few extra subdirectories. software is the subdirectory where all the software packages will be installed. Each specific package then goes into softeware/<name>/<version>-<toolkit><versionsuffix>. The module files corresponding to the packages are installed in the modules subdirectory, residing immediately under the installPath.

Setting MODULEPATH

After configuration, you need to make sure that MODULEPATH environment variable is extended with the modules/all subdirectory of the installPath, i.e.:

export MODULEPATH=<installPath>/modules/all:$MODULEPATH

It's probably a good idea to add this to your .bashrc and/or .profile startup scripts, so you don't need to adjust the MODULEPATH variable every time you start a new session.

Source path

The sourcePath variable should specify the directory in which EasyBuild should look for software source/install files.

EasyBuild will try and find the installation files specified by the sources variable in the .eb specification file, in the following order of preference:

  • <sourcePath>/<name>: in a subdirectory determined by the name of the software package
  • <sourcePath>/<letter>/<name>: in the style of the easyblocks/easyconfigs directories: in a subdirectory determined by the name of the software package and the first letter of that name (lower case)
  • <sourcePath>: directly in the source path

Patch files will also be looked for in these locations, and in addition in the various easybuild/easyconfigs directories that are in the listed in the PYTHONPATH.

Reconfiguration using environment variables

The build path and install path can be (temporary) redefined afterwards using the EASYBUILDBUILDPATH and EASYBUILDINSTALLPATH environment variables, which have preference over the paths specified in the configuration file.

This can be useful when testing new easyblocks, for example.

Specification files repository

EasyBuild supports keeping track of .eb specification files which serve as software package installation configuration files. To support this, EasyBuild will upload the specification file used in a successful installation to a repository defined by the repositoryType and repositoryPath configuration variables.

The repositoryType should be set to one of the following, to indicate the type of repository:

  • fs: a plain flat file repository; the repositoryPath should contain the directory where the files should be stored
  • git: a non-empty bare git repository (created with git init --bare or git clone --bare); the repositoryPath should contain the location of the git repository, i.e., a directory or URL
  • svn: an SVN repository; the repositoryPath should indicate the repository location (directory or URL)

Using git requires the GitPython Python modules, using svn requires the pysvn Python module (see Dependencies).

If access to the specification files repository fails for some reason (e.g., no network or a required Python module), then this will just result in a warning. EasyBuild will still install the software, only the specification file will not be added automatically into the repository.

Log format

The logFormat variable should contain a tuple specifying a log directory name and a template string, optionally using the following supported fields:

  • name: the name of the software package being installed
  • version: the version of the software package being installed
  • date: the date on which the installation was performed (in YYYYMMDD format, e.g. 20120324)
  • time: the time at which the installation was started (in HHMMSS format, e.g. 214359)

Example : logFormat=("easylog","easybuild-%(name)s.log")

Example configuration

A simple example configuration file, which specifies the home directory as base and dictates to use /tmp as build path:

import os

home = os.getenv('HOME')

buildPath = "/tmp/easybuild"
installPath = home
sourcePath = os.path.join(home, "sources")

repositoryType = 'fs'
repositoryPath = os.path.join(home, "ebfiles")

logFormat = ("easybuildlogs", "%(name)s-%(version)s.log")`

Default configuration

The default configuration file that comes with EasyBuild (easybuild/easybuild_config.py) can be used as a starting point. It uses the following settings:

Paths

The prefix for the build, install and source directories is obtained from the EASYBUILDPREFIX environment variable, if it is defined.

If not, the prefix is set to the home directory, which is determined using the environment variable HOME.

If for some reason $HOME is not defined, the configuration file reverts to using /tmp as prefix.

The different paths are then defined as follows:

  • buildPath: <prefix>/easybuild_build
  • installPath: <prefix>/easybuild
  • sourcePath: <prefix>/easybuild_sources

Specification files repository

The repositoryType is set to fs, and the repositoryPath is specified as <prefix>/easybuild_ebfiles_repo.

Log format

The default log format uses all fields available:

("easybuildlog", "easybuild-%(name)s-%(version)s-%(date)s.%(time)s.log")

Clone this wiki locally