Commit 731d346b authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add path when dealing with changed files...

parent b778cecc
......@@ -68,28 +68,29 @@ class Backup:
def check(self, src, dst):
if src.name != dst.name:
raise Exception('Names differ: %s, %s' % (src, dst))
dst_path = os.path.join(self.dst_root, dst.name)
if src.kind != dst.kind or src.md5 != dst.md5 or src.size != dst.size:
self.log.DEBUG('Replace...', src.name, dst.name,
src.md5, dst.md5, src.size, dst.size)
self.status.replaced += 1
self.delete(dst)
self.add(src)
elif os.path.exists(dst.name):
elif os.path.exists(dst_path):
changed = False
if src.kind in [ 'F', 'D'] and src.mode != dst.mode:
if src.kind in [ b'F', b'D'] and src.mode != dst.mode:
self.log.DEBUG('MODE', dst.name, src.mode, dst.mode)
os.chmod(dst.name, int(src.mode, 8))
os.chmod(dst_path, int(src.mode, 8))
changed = True
if (src.kind in [ 'F', 'D'] and
src.uid != dst.uid or src.gid != dst.gid):
if (src.kind in [ b'F', b'D'] and
(src.uid != dst.uid or src.gid != dst.gid)):
self.log.DEBUG('UID/GID', dst.name, src.uid, src.gid,
dst.uid, dst.gid)
os.lchown(dst.name, int(src.uid), int(src.gid))
os.lchown(dst_path, int(src.uid), int(src.gid))
changed = True
if src.kind == 'F' and src.mtime != dst.mtime:
if src.kind == b'F' and src.mtime != dst.mtime:
self.log.DEBUG('MTIME', src.name, src.mtime, dst.mtime)
atime = os.stat(dst.name).st_atime
os.utime(dst.name, (int(atime), int(src.mtime)))
atime = os.stat(dst_path).st_atime
os.utime(dst_path, (int(atime), int(src.mtime)))
changed = True
if changed:
self.status.metadata += 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment