9163 : Narrative web : "errno: 1, operation is not permitted" when creating archive.

This commit is contained in:
SNoiraud 2016-01-09 10:20:32 +01:00
parent cf7edc6844
commit 38f66a2f58

View File

@ -7989,9 +7989,19 @@ class NavWebReport(Report):
# log.debug("copying '%s' to '%s/%s'" % (from_fname, to_dir, to_fname)) # log.debug("copying '%s' to '%s/%s'" % (from_fname, to_dir, to_fname))
mtime = os.stat(from_fname).st_mtime mtime = os.stat(from_fname).st_mtime
if self.archive: if self.archive:
def set_mtime(tarinfo):
"""
For each file, we set the last modification time.
We could also set uid, gid, uname, gname and mode
#tarinfo.uid = os.getuid()
#tarinfo.mode = 0660
#tarinfo.uname = tarinfo.gname = "www-data"
"""
tarinfo.mtime = mtime
return tarinfo
dest = os.path.join(to_dir, to_fname) dest = os.path.join(to_dir, to_fname)
os.utime(from_fname, (mtime, mtime)) self.archive.add(from_fname, dest, filter=set_mtime)
self.archive.add(from_fname, dest)
else: else:
dest = os.path.join(self.html_dir, to_dir, to_fname) dest = os.path.join(self.html_dir, to_dir, to_fname)