summaryrefslogtreecommitdiff
path: root/buildstream/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/utils.py')
-rw-r--r--buildstream/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 1e04a31ed..28ba0fb25 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -831,8 +831,18 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result,
result.ignored.append(path)
continue
+ if not file_stat.st_mode & stat.S_IRUSR:
+ os.chmod(srcpath, file_stat.st_mode | stat.S_IRUSR)
+
actionfunc(srcpath, destpath, result=result)
+ if not file_stat.st_mode & stat.S_IRUSR:
+ # actionfunc would normally preserve permissions, but
+ # if we changed them before copying, we need to reset
+ # the permissions on both.
+ os.chmod(destpath, file_stat.st_mode)
+ os.chmod(srcpath, file_stat.st_mode)
+
elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode):
# Block or character device. Put contents of st_dev in a mknod.
if not safe_remove(destpath):