diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-09-04 14:51:51 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2018-09-10 16:59:44 +0100 |
commit | 02f6eb1a7440d5f5e2846c209d918a1500d45776 (patch) | |
tree | 563ef15c284ab231f93cbb7bfc169d89306a71a6 | |
parent | e0bb71b24c6e40a5dd2ee935352a301ae2113895 (diff) | |
download | buildstream-richardmaw/builddir-sockets.tar.gz |
Handle sockets when copying trees into artifactsrichardmaw/builddir-sockets
We can't include a socket in a CAS tree, but it's mostly meaningless to do so
since there can't possibly be a process serving it.
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 3 | ||||
-rw-r--r-- | buildstream/utils.py | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index a93ec01ea..78191ccf8 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -684,6 +684,9 @@ class CASCache(ArtifactCache): symlinknode = directory.symlinks.add() symlinknode.name = name symlinknode.target = os.readlink(full_path) + elif stat.S_ISSOCK(mode): + # The process serving the socket can't be cached anyway + pass else: raise ArtifactError("Unsupported file type for {}".format(full_path)) diff --git a/buildstream/utils.py b/buildstream/utils.py index 1aeea52be..60211f35b 100644 --- a/buildstream/utils.py +++ b/buildstream/utils.py @@ -372,6 +372,8 @@ def copy_files(src, dest, *, files=None, ignore_missing=False, report_written=Fa Directories in `dest` are replaced with files from `src`, unless the existing directory in `dest` is not empty in which case the path will be reported in the return value. + + UNIX domain socket files from `src` are ignored. """ presorted = False if files is None: @@ -414,6 +416,8 @@ def link_files(src, dest, *, files=None, ignore_missing=False, report_written=Fa If a hardlink cannot be created due to crossing filesystems, then the file will be copied instead. + + UNIX domain socket files from `src` are ignored. """ presorted = False if files is None: @@ -841,6 +845,13 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, os.mknod(destpath, file_stat.st_mode, file_stat.st_rdev) os.chmod(destpath, file_stat.st_mode) + elif stat.S_ISFIFO(mode): + os.mkfifo(destpath, mode) + + elif stat.S_ISSOCK(mode): + # We can't duplicate the process serving the socket anyway + pass + else: # Unsupported type. raise UtilError('Cannot extract {} into staging-area. Unsupported type.'.format(srcpath)) |