def copy_attribs(rpin, rpout):
"""Change file attributes of rpout to match rpin
Only changes the chmoddable bits, uid/gid ownership, and
timestamps, so both must already exist.
"""
log.Log("Copying attributes from %s to %s" % (rpin.index, rpout.path), 7)
assert rpin.lstat() == rpout.lstat() or rpin.isspecial()
if Globals.change_ownership:
rpout.chown(*rpout.conn.user_group.map_rpath(rpin))
if Globals.eas_write: rpout.write_ea(rpin.get_ea())
if rpin.issym(): return # symlinks don't have times or perms
if (Globals.resource_forks_write and rpin.isreg() and
rpin.has_resource_fork()):
rpout.write_resource_fork(rpin.get_resource_fork())
if (Globals.carbonfile_write and rpin.isreg() and
rpin.has_carbonfile()):
rpout.write_carbonfile(rpin.get_carbonfile())
rpout.chmod(rpin.getperms())
if Globals.acls_write: rpout.write_acl(rpin.get_acl())
if not rpin.isdev(): rpout.setmtime(rpin.getmtime())
if Globals.win_acls_write: rpout.write_win_acl(rpin.get_win_acl())
评论列表
文章目录