summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-02-19 18:58:34 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-02-19 19:10:55 +0900
commit7cc1caf18ba2cb9d7ad52bef135751e7fe88b853 (patch)
tree84c59ac7c00c85fdd75c9ffb67b79167c83e7805
parent87db97903dacd97cb3a714b2a850a09c98806b2c (diff)
downloadybd-tristan/symlinks-and-staging.tar.gz
utils.py: Warning when source file listed in artifact does not existtristan/symlinks-and-staging
We use the split artifact metadata to move files from the staged system directory into a <system>.inst/ subdirectory one file at a time, after running system integration commands and ldconfig. The current working assumption is that if a file was listed in the artifact output; it will certainly exist when we try to move it into the system install directory, but this is not true. Running system integration commands and ldconfig can result in removing files, one working example is when you have broken symlink installed into an artifact inside a libdir. ldconfig will delete dangling symlinks in it's libdirs with extreme prejudice. It may or may not make sense to eventually turn this into an error.
-rw-r--r--ybd/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ybd/utils.py b/ybd/utils.py
index 8a8554e..aa49f0a 100644
--- a/ybd/utils.py
+++ b/ybd/utils.py
@@ -287,6 +287,15 @@ def _process_list(srcdir, destdir, filelist, actionfunc):
# symlink boundaries
_ensure_real_directory(destdir, os.path.dirname(destpath))
+ if not os.path.lexists(srcpath):
+ app.log('UTILS',
+ 'WARNING: Ignoring missing source file while moving '
+ 'split artifacts: %s\n\n' % srcpath +
+ ' Hint: This file is probably a broken symlink in\n' +
+ ' the artifact, if it is a library symlink\n' +
+ ' then it would have been removed by ldconfig\n')
+ continue
+
try:
file_stat = os.lstat(srcpath)
mode = file_stat.st_mode