Skip to content

Commit f4e855b

Browse files
authored
Merge pull request #4960 from bedroge/copy_patches_fix
store all patches (incl the ones for extensions) that need to be copied to a repo/reprod dir in an `all_patches` set
2 parents 0caac31 + fe3be82 commit f4e855b

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

easybuild/base/frozendict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __repr__(self):
5252

5353
def __hash__(self):
5454
if self.__hash is None:
55-
self.__hash = reduce(operator.xor, map(hash, self.iteritems()), 0)
55+
self.__hash = reduce(operator.xor, map(hash, self.items()), 0)
5656

5757
return self.__hash
5858

easybuild/framework/easyblock.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def __init__(self, ec, logfile=None):
188188

189189
# list of patch/source files, along with checksums
190190
self.patches = []
191+
self.all_patches_paths = set() # set of paths to all patches (including patches of extensions)
191192
self.src = []
192193
self.data_src = []
193194
self.checksums = []
@@ -601,6 +602,7 @@ def fetch_patches(self, patch_specs=None, extension=False, checksums=None):
601602
patch_info['path'] = path
602603
patch_info['checksum'] = self.get_checksum_for(checksums, filename=patch_info['name'], index=index)
603604

605+
self.all_patches_paths.add(path)
604606
if extension:
605607
patches.append(patch_info)
606608
else:
@@ -5126,12 +5128,8 @@ def ensure_writable_log_dir(log_dir):
51265128
block = det_full_ec_version(app.cfg) + ".block"
51275129
repo.add_easyconfig(ecdict['original_spec'], app.name, block, buildstats, currentbuildstats)
51285130
repo.add_easyconfig(spec, app.name, det_full_ec_version(app.cfg), buildstats, currentbuildstats)
5129-
patches = app.patches
5130-
for ext in app.exts:
5131-
patches += ext.get('patches', [])
5132-
for patch in patches:
5133-
if 'path' in patch:
5134-
repo.add_patch(patch['path'], app.name)
5131+
for patch_path in app.all_patches_paths:
5132+
repo.add_patch(patch_path, app.name)
51355133
repo.commit("Built %s" % app.full_mod_name)
51365134
del repo
51375135
except EasyBuildError as err:
@@ -5153,14 +5151,10 @@ def ensure_writable_log_dir(log_dir):
51535151
_log.debug("Copied easyconfig file %s to %s", spec, newspec)
51545152

51555153
# copy patches
5156-
patches = app.patches
5157-
for ext in app.exts:
5158-
patches += ext.get('patches', [])
5159-
for patch in patches:
5160-
if 'path' in patch:
5161-
target = os.path.join(new_log_dir, os.path.basename(patch['path']))
5162-
copy_file(patch['path'], target)
5163-
_log.debug("Copied patch %s to %s", patch['path'], target)
5154+
for patch_path in app.all_patches_paths:
5155+
target = os.path.join(new_log_dir, os.path.basename(patch_path))
5156+
copy_file(patch_path, target)
5157+
_log.debug("Copied patch %s to %s", patch_path, target)
51645158

51655159
if build_option('read_only_installdir') and not app.cfg['stop']:
51665160
# take away user write permissions (again)

0 commit comments

Comments
 (0)