Skip to content

Creating and applying patches with EasyBuild

Guilherme edited this page Nov 23, 2016 · 1 revision

Set up source tree for patching and generate patch file

Untar the source package and make a backup copy (for being able to 'diff')

tar xf source.tar.bz2 ; cp -r source/ source.orig/

Apply the needed corrections to the files under source/

The EasyBuild-compatible patch file is generated as

diff -Nru source.orig source/ > patch_file.patch

The diff command must be executed at least at the top of the package source tree (or anywhere outside the package itself), so that the full source tree could appear within the .patch file. This last condition is required by EasyBuild in order to correctly define the patch level within the source tree.

Diff against non-existing file

If you are adding only one new file, patch might not automatically find the patch level. In that case you can use:

patches = [('new.file', 'dest/path/')]

Install the patch

Create the easyconf file (patch_easyconf.eb) according to instructions in http://easybuild.readthedocs.org/en/latest/Writing_easyconfig_files.html ("Source files and patches" section) adding the patch file name, with relative path with respect to the easyconf file position. The easyconf file shall therefore include the patch line

patches = ['relative_path/patch_file.patch'] 

Run EasyBuild module installation

eb <options> patch_easyconf.eb

If the patch is applied on an already installed module, the above command must be modified in order to force the installation of the patched module. In this case the command is

eb <options> patch_easyconf.eb -f