Fix timestamp verification in FileSpec on some file systems

This commit is contained in:
rdb 2016-07-20 11:44:39 +02:00
parent 69f15258e4
commit e691a679d4

View File

@ -31,7 +31,7 @@ class FileSpec:
if st is None: if st is None:
st = os.stat(pathname.toOsSpecific()) st = os.stat(pathname.toOsSpecific())
self.size = st.st_size self.size = st.st_size
self.timestamp = st.st_mtime self.timestamp = int(st.st_mtime)
self.readHash(pathname) self.readHash(pathname)
@ -122,7 +122,7 @@ class FileSpec:
self.__correctHash(packageDir, pathname, st, notify) self.__correctHash(packageDir, pathname, st, notify)
return False return False
if st.st_mtime == self.timestamp: if int(st.st_mtime) == self.timestamp:
# If the size is right and the timestamp is right, the # If the size is right and the timestamp is right, the
# file passes. # file passes.
if notify: if notify:
@ -196,7 +196,7 @@ class FileSpec:
# The hash is OK. If the timestamp is wrong, change it back # The hash is OK. If the timestamp is wrong, change it back
# to what we expect it to be, so we can quick-verify it # to what we expect it to be, so we can quick-verify it
# successfully next time. # successfully next time.
if st.st_mtime != self.timestamp: if int(st.st_mtime) != self.timestamp:
self.__updateTimestamp(pathname, st) self.__updateTimestamp(pathname, st)
return True return True
@ -217,7 +217,7 @@ class FileSpec:
if notify: if notify:
notify.info("Correcting timestamp of %s to %d (%s)" % ( notify.info("Correcting timestamp of %s to %d (%s)" % (
self.filename, st.st_mtime, time.asctime(time.localtime(st.st_mtime)))) self.filename, st.st_mtime, time.asctime(time.localtime(st.st_mtime))))
self.timestamp = st.st_mtime self.timestamp = int(st.st_mtime)
def checkHash(self, packageDir, pathname, st): def checkHash(self, packageDir, pathname, st):
""" Returns true if the file has the expected md5 hash, false """ Returns true if the file has the expected md5 hash, false