Skip to content

%(builddir)s template does not work for extensions #3218

@casparvl

Description

@casparvl

I had an R package (later) that I first installed using the RPackage EasyBlock. I needed a patch, which created a configure script. In order to make that executable, I did a chmod relative to %(builddir)s like so:

easyblock = 'RPackage'
name = 'later'
version = '0.7.3'
...
source_urls = ['https://cran.r-project.org/src/contrib/Archive/%(name)s']
sources = ['%(name)s_%(version)s.tar.gz']
patches = [('later-0.7.3_mutex_creation.patch', 1)]
...
preinstallopts = 'chmod u+x %(builddir)s/later/configure;'
...

This worked fine, so I now wanted to apply the same patch + chmod to the general R-3.5.1-foss-2018b.eb, i.e. where later is an extension defined as follows:

('later', '0.7.3', {
        'patches': ['later-0.7.3_mutex_creation.patch'],
        'checksums': [
            '5c57148c255ee5da61cb748550b73bad7094f4e045b99b362473be5e3dbc4212',  # later_0.7.3.tar.gz
            'f24e0a9d1637a7140e487dcd7b9cfce05fe71ec11d0fe78084eaf9ce98f4dea8',  # later-0.7.3_mutex_creation.patch
        ],
        'preinstallopts': 'chmod u+x %(builddir)s/later/configure;',
    }),

This results in

= 2020-02-28 22:21:02,337 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:124 in __init__): cmd "chmod u+x %(builddir)s/later/configure; R CMD INSTALL /scratch/casparl/R/3.5.1/foss-2019b/later/later   --library=/home/casparl/.local/easybuild/Debian10/2019/software/R/3.5.1-foss-2019b/lib64/R/library --no-clean-on-error " exited with exit code 1 and output:
/bin/bash: -c: line 0: syntax error near unexpected token `('

Clearly, the %(builddir)s template is not replaced and as a result, bash throws a syntax error when encountering the opening bracket. I wasn't sure that using %(builddir)s was even supposed to work for extensions (because: should it refer to the builddir of R? Or the builddir of later? That might not be trivial to achieve...). Nevertheless, my fellow EasyBuilders on Slack seemed to think this should work...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions