Skip to content

Commit ee37956

Browse files
authored
Merge pull request #4939 from bedroge/copy_exts_patches
also copy patches of extensions to `easybuild` subdirectory of installation directory
2 parents bfaf320 + 3c1c212 commit ee37956

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

easybuild/framework/easyblock.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5119,7 +5119,10 @@ def ensure_writable_log_dir(log_dir):
51195119
block = det_full_ec_version(app.cfg) + ".block"
51205120
repo.add_easyconfig(ecdict['original_spec'], app.name, block, buildstats, currentbuildstats)
51215121
repo.add_easyconfig(spec, app.name, det_full_ec_version(app.cfg), buildstats, currentbuildstats)
5122-
for patch in app.patches:
5122+
patches = app.patches
5123+
for ext in app.exts:
5124+
patches += ext.get('patches', [])
5125+
for patch in patches:
51235126
repo.add_patch(patch['path'], app.name)
51245127
repo.commit("Built %s" % app.full_mod_name)
51255128
del repo
@@ -5142,7 +5145,10 @@ def ensure_writable_log_dir(log_dir):
51425145
_log.debug("Copied easyconfig file %s to %s", spec, newspec)
51435146

51445147
# copy patches
5145-
for patch in app.patches:
5148+
patches = app.patches
5149+
for ext in app.exts:
5150+
patches += ext.get('patches', [])
5151+
for patch in patches:
51465152
target = os.path.join(new_log_dir, os.path.basename(patch['path']))
51475153
copy_file(patch['path'], target)
51485154
_log.debug("Copied patch %s to %s", patch['path'], target)

test/framework/toy_build.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,16 @@ def test_toy_extension_patches_postinstallcmds(self):
13871387
fn = 'created-via-postinstallcmds.txt'
13881388
self.assertExists(os.path.join(installdir, fn))
13891389

1390+
# make sure that patch file for extension was copied to 'easybuild' subdir in installation directory
1391+
easybuild_subdir = os.path.join(installdir, 'easybuild')
1392+
patches = sorted(os.path.basename(x) for x in glob.glob(os.path.join(easybuild_subdir, '*.patch')))
1393+
expected_patches = [
1394+
'bar-0.0_fix-silly-typo-in-printf-statement.patch',
1395+
'bar-0.0_fix-very-silly-typo-in-printf-statement.patch',
1396+
'toy-0.0_fix-silly-typo-in-printf-statement.patch',
1397+
]
1398+
self.assertEqual(patches, expected_patches)
1399+
13901400
def test_toy_extension_sources(self):
13911401
"""Test install toy that includes extensions with 'sources' spec (as single-item list)."""
13921402
topdir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)