easybuilders / easybuild

EasyBuild - building software with ease
http://easybuild.io
GNU General Public License v2.0
468 stars 144 forks source link

Add "Patches" section to "Writing EasyConfigs" documentation #667

Open kelseymh opened 3 years ago

kelseymh commented 3 years ago

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 commented 3 years ago

@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')]
zao commented 3 years ago

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', '..')]
Flamefire commented 3 years ago

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

branfosj commented 3 years ago

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').

kelseymh commented 3 years ago

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 commented 3 years ago

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

Oh. My apologies!