easybuild icon indicating copy to clipboard operation
easybuild copied to clipboard

Add "Patches" section to "Writing EasyConfigs" documentation

Open kelseymh opened this issue 5 years ago • 6 comments

I learned today (thank you, @zao !) that the patches easyconfig parameter can take tuples, as well as simple patchfile names (.patch required):

There's two extended forms, ('pie.patch', 1) for patch level and ('src.file', 'dst') which is for straight copies or the 'sourcepath' (suffix of source path to apply patch in) depending on if the first element is a '.patch' or not.

This should be documented on the "Writing EasyConfig files" page.

kelseymh avatar Dec 22 '20 07:12 kelseymh

@zao also provided three examples for the tuple syntax, which I'll include in the documentation:

easybuild/easyconfigs/c/CPB/CPB-11-4-2011-foss-2017a-Python-2.7.13.eb:patches = [('CPB-%(version)s_makefile.patch', 1)]
easybuild/easyconfigs/p/PLUMED/PLUMED-2.5.1-intel-2018b-PathCV.eb:patches = [('PathCV.cpp', 'src/function/')]
easybuild/easyconfigs/q/QuantumESPRESSO/QuantumESPRESSO-6.4.1-intel-2019a.eb:patches = [('backports-%(version)s.diff', 'qe-%(version)s')]

kelseymh avatar Dec 22 '20 07:12 kelseymh

A better example than the QE one may be suitable if it's indeed only honoring '.patch' files for the sourcepath alternative. I can't find any obvious ones in tree, most are ancient and specify '..'-relative paths like:

easybuild/easyconfigs/g/GCC/GCC-5.1.0.eb:patches = [('mpfr-%s-allpatches-20141204.patch' % local_mpfr_version, '../mpfr-%s' % local_mpfr_version)]
easybuild/easyconfigs/__archive__/p/problog/problog-1.1-ictce-5.3.0.eb:patches = [('SimpleCUDD-hardcoding.patch', '..')]

zao avatar Dec 22 '20 07:12 zao

On a side note: Tuples are ugly. How is anyone supposed to know what that means and it can mean either a level or a folder but you can't use both, yuck. We should coerce that to a dict and deprecate tuples

Flamefire avatar Dec 22 '20 09:12 Flamefire

There is a PR for patches documentation: https://github.com/easybuilders/easybuild/pull/642 which also links to https://github.com/easybuilders/easybuild-framework/pull/3412 ('Add patch step dict notation').

branfosj avatar Dec 22 '20 10:12 branfosj

On a side note: Tuples are ugly. How is anyone supposed to know what that means and it can mean either a level or a folder but you can't use both, yuck. We should coerce that to a dict and deprecate tuples

I don't fully disagree, but I'm thinking that for this Issue, I'd rather document what's there and working now. (Which also addresses the current "what does it mean" problem :-) ). Maybe open a separate issue for switching to a dictionary construct?

kelseymh avatar Dec 22 '20 17:12 kelseymh

There is a PR for patches documentation: #642 which also links to easybuilders/easybuild-framework#3412 ('Add patch step dict notation').

Oh. My apologies!

kelseymh avatar Dec 22 '20 17:12 kelseymh