Small enhancements to mtime handling

* Use directories mtime (so deleted or renamed files are taken into account)
* Set the tarfile mtime close to the version
This commit is contained in:
Laurent Bachelier 2012-01-29 11:47:26 +01:00
commit 863a32b96e
2 changed files with 8 additions and 3 deletions

View file

@ -20,6 +20,7 @@
from __future__ import with_statement
from datetime import datetime
from time import mktime, strptime
import tarfile
import os
import shutil
@ -110,6 +111,8 @@ class WeboobRepos(ReplApplication):
print 'Create archive for %s' % name
with closing(tarfile.open(tarname, 'w:gz')) as tar:
tar.add(module_path, arcname=name, exclude=self._archive_excludes)
tar_mtime = mktime(strptime(str(module.version), '%Y%m%d%H%M'))
os.utime(tarname, (tar_mtime, tar_mtime))
# Copy icon.
icon_path = os.path.join(module_path, 'favicon.png')