Merge pull request #211 from LLNL/bugfix/github-154
Fix #154 -- better log messages for do_patch()
This commit is contained in:
commit
9a23e1a9df
@ -735,6 +735,7 @@ def do_patch(self):
|
|||||||
# keep track of whether patches were successfully applied.
|
# keep track of whether patches were successfully applied.
|
||||||
archive_dir = self.stage.source_path
|
archive_dir = self.stage.source_path
|
||||||
good_file = join_path(archive_dir, '.spack_patched')
|
good_file = join_path(archive_dir, '.spack_patched')
|
||||||
|
no_patches_file = join_path(archive_dir, '.spack_no_patches')
|
||||||
bad_file = join_path(archive_dir, '.spack_patch_failed')
|
bad_file = join_path(archive_dir, '.spack_patch_failed')
|
||||||
|
|
||||||
# If we encounter an archive that failed to patch, restage it
|
# If we encounter an archive that failed to patch, restage it
|
||||||
@ -749,29 +750,46 @@ def do_patch(self):
|
|||||||
if os.path.isfile(good_file):
|
if os.path.isfile(good_file):
|
||||||
tty.msg("Already patched %s" % self.name)
|
tty.msg("Already patched %s" % self.name)
|
||||||
return
|
return
|
||||||
|
elif os.path.isfile(no_patches_file):
|
||||||
|
tty.msg("No patches needed for %s." % self.name)
|
||||||
|
return
|
||||||
|
|
||||||
# Apply all the patches for specs that match this one
|
# Apply all the patches for specs that match this one
|
||||||
|
patched = False
|
||||||
for spec, patch_list in self.patches.items():
|
for spec, patch_list in self.patches.items():
|
||||||
if self.spec.satisfies(spec):
|
if self.spec.satisfies(spec):
|
||||||
for patch in patch_list:
|
for patch in patch_list:
|
||||||
tty.msg('Applying patch %s' % patch.path_or_url)
|
|
||||||
try:
|
try:
|
||||||
patch.apply(self.stage)
|
patch.apply(self.stage)
|
||||||
|
tty.msg('Applied patch %s' % patch.path_or_url)
|
||||||
|
patched = True
|
||||||
except:
|
except:
|
||||||
# Touch bad file if anything goes wrong.
|
# Touch bad file if anything goes wrong.
|
||||||
|
tty.msg('Patch %s failed.' % patch.path_or_url)
|
||||||
touch(bad_file)
|
touch(bad_file)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# patch succeeded. Get rid of failed file & touch good file so we
|
if has_patch_fun:
|
||||||
# don't try to patch again again next time.
|
try:
|
||||||
|
self.patch()
|
||||||
|
tty.msg("Ran patch() for %s." % self.name)
|
||||||
|
patched = True
|
||||||
|
except:
|
||||||
|
tty.msg("patch() function failed for %s." % self.name)
|
||||||
|
touch(bad_file)
|
||||||
|
raise
|
||||||
|
|
||||||
|
# Get rid of any old failed file -- patches have either succeeded
|
||||||
|
# or are not needed. This is mostly defensive -- it's needed
|
||||||
|
# if the restage() method doesn't clean *everything* (e.g., for a repo)
|
||||||
if os.path.isfile(bad_file):
|
if os.path.isfile(bad_file):
|
||||||
os.remove(bad_file)
|
os.remove(bad_file)
|
||||||
|
|
||||||
|
# touch good or no patches file so that we skip next time.
|
||||||
|
if patched:
|
||||||
touch(good_file)
|
touch(good_file)
|
||||||
|
else:
|
||||||
if has_patch_fun:
|
touch(no_patches_file)
|
||||||
self.patch()
|
|
||||||
|
|
||||||
tty.msg("Patched %s" % self.name)
|
|
||||||
|
|
||||||
|
|
||||||
def do_fake_install(self):
|
def do_fake_install(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user