[game-data-packager] 04/05: preserve original timestamps
Simon McVittie
smcv at debian.org
Wed Jan 21 16:15:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit 7f810835c9fb9d28e4740c122ba692c64e8d1b26
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Wed Jan 21 16:38:54 2015 +0100
preserve original timestamps
---
lib/game_data_packager/__init__.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index e7fc8d9..f2ea54b 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -37,6 +37,7 @@ import subprocess
import sys
import tarfile
import tempfile
+import time
import urllib.request
import zipfile
@@ -1053,6 +1054,8 @@ class GameData(object):
size=entry.file_size,
progress=(entry.file_size > QUITE_LARGE))
wf.close()
+ orig_time = time.mktime(entry.date_time + (0, 0, -1))
+ os.utime(tmp, (orig_time, orig_time))
if not self.use_file(wanted, tmp, hf):
os.remove(tmp)
@@ -1107,6 +1110,8 @@ class GameData(object):
size=entry.size,
progress=(entry.size > QUITE_LARGE))
wf.close()
+ orig_time = time.mktime(entry.date_time + (0, 0, -1))
+ os.utime(tmp, (orig_time, orig_time))
if not self.use_file(wanted, tmp, hf):
os.remove(tmp)
@@ -1522,8 +1527,8 @@ class GameData(object):
mkdir_p(copy_to_dir)
# Use cp(1) so we can make a reflink if source and
# destination happen to be the same btrfs volume
- subprocess.check_call(['cp', '--reflink=auto', copy_from,
- copy_to])
+ subprocess.check_call(['cp', '--reflink=auto',
+ '--preserve=timestamps', copy_from, copy_to])
for symlink, real_file in package.symlinks.items():
symlink = symlink.lstrip('/')
@@ -1558,8 +1563,8 @@ class GameData(object):
copy_to_dir = os.path.dirname(copy_to)
if not os.path.isdir(copy_to_dir):
mkdir_p(copy_to_dir)
- subprocess.check_call(['cp', '--reflink=auto', copy_from,
- copy_to])
+ subprocess.check_call(['cp', '--reflink=auto',
+ '--preserve=timestamps', copy_from, copy_to])
# adapted from dh_md5sums
subprocess.check_call("find . -type f ! -regex '\./DEBIAN/.*' " +
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list