Commit 3bea0e45 authored by bescoto's avatar bescoto

re-enable carbonfile default, ignore errors


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@674 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 5dcd45bc
......@@ -88,7 +88,7 @@ resource_forks_conn = None
# Like the above, but applies to MacOS Carbon Finder creator/type info.
# As of 1.0.2 this has defaulted to off because of bugs
carbonfile_active = 0
carbonfile_active = None
carbonfile_write = None
carbonfile_conn = None
......
......@@ -436,9 +436,6 @@ class SetGlobals:
def set_carbonfile(self):
self.update_triple(self.src_fsa.carbonfile, self.dest_fsa.carbonfile,
('carbonfile_active', 'carbonfile_write', 'carbonfile_conn'))
if self.src_fsa.carbonfile and not Globals.carbonfile_active:
log.Log("Source may have carbonfile support, but support "
"defaults to off.\n Use --carbonfile to enable.", 5)
def set_hardlinks(self):
if Globals.preserve_hardlinks != 0:
......
......@@ -64,6 +64,7 @@ class ParsingError(Exception):
def carbonfile2string(cfile):
"""Convert CarbonFile data to a string suitable for storing."""
if not cfile: return "None"
retvalparts = []
retvalparts.append('creator:%s' % binascii.hexlify(cfile['creator']))
retvalparts.append('type:%s' % binascii.hexlify(cfile['type']))
......@@ -107,8 +108,7 @@ def RORP2Record(rorpath):
# If there is Carbon data, save it.
if rorpath.has_carbonfile():
if not rorpath.get_carbonfile(): cfile = "None"
else: cfile = carbonfile2string(rorpath.get_carbonfile())
cfile = carbonfile2string(rorpath.get_carbonfile())
str_list.append(" CarbonFile %s\n" % (cfile,))
# If file is hardlinked, add that information
......
......@@ -163,7 +163,8 @@ def copy_attribs(rpin, rpout):
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():
if (Globals.carbonfile_write and rpin.isreg() and
rpin.has_carbonfile()):
rpout.write_carbonfile(rpin.get_carbonfile())
if Globals.eas_write: rpout.write_ea(rpin.get_ea())
rpout.chmod(rpin.getperms())
......@@ -185,7 +186,8 @@ def copy_attribs_inc(rpin, rpout):
if (Globals.resource_forks_write and rpin.isreg() and
rpin.has_resource_fork() and rpout.isreg()):
rpout.write_resource_fork(rpin.get_resource_fork())
if Globals.carbonfile_write and rpin.isreg() and rpout.isreg():
if (Globals.carbonfile_write and rpin.isreg() and
rpin.has_carbonfile() and rpout.isreg()):
rpout.write_carbonfile(rpin.get_carbonfile())
if Globals.eas_write: rpout.write_ea(rpin.get_ea())
if rpin.isdir() and not rpout.isdir():
......@@ -1161,36 +1163,9 @@ class RPath(RORPath):
ea.write_to_rp(self)
self.data['ea'] = ea
def get_carbonfile(self):
"""Return resource fork data, loading from filesystem if
necessary."""
from Carbon.File import FSSpec
import MacOS
try: return self.data['cfile']
except KeyError: pass
try:
fsobj = FSSpec(self.path)
finderinfo = fsobj.FSpGetFInfo()
cfile = {'creator': finderinfo.Creator,
'type': finderinfo.Type,
'location': finderinfo.Location,
'flags': finderinfo.Flags}
self.data['carbonfile'] = cfile
return cfile
except MacOS.Error:
log.Log("Cannot read carbonfile information from %s" %
(self.path,), 2)
self.data['carbonfile'] = None
return self.data['carbonfile']
def write_carbonfile(self, cfile):
"""Write new carbon data to self."""
if not cfile:
# This should be made cleaner---if you know Mac OS X tell
# me what could cause an error in get_carbonfile above
return
if not cfile: return
log.Log("Writing carbon data to %s" % (self.index,), 7)
from Carbon.File import FSSpec
import MacOS
......@@ -1256,7 +1231,25 @@ def setdata_local(rpath):
if Globals.acls_conn: rpath.data['acl'] = acl_get(rpath)
if Globals.resource_forks_conn and rpath.isreg():
rpath.get_resource_fork()
if Globals.carbonfile_conn and rpath.isreg(): rpath.get_carbonfile()
if Globals.carbonfile_conn and rpath.isreg():
rpath.data['carbonfile'] = carbonfile_get(rpath)
def carbonfile_get(rpath):
"""Return carbonfile value for local rpath"""
from Carbon.File import FSSpec
import MacOS
try:
fsobj = FSSpec(self.path)
finderinfo = fsobj.FSpGetFInfo()
cfile = {'creator': finderinfo.Creator,
'type': finderinfo.Type,
'location': finderinfo.Location,
'flags': finderinfo.Flags}
return cfile
except MacOS.Error:
log.Log("Cannot read carbonfile information from %s" %
(self.path,), 2)
return None
# These functions are overwritten by the eas_acls.py module. We can't
......
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