summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-11-06 01:46:54 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-11-06 01:46:54 +0000
commit6cab8d962f3f6f60dc7bb0410a482d8420d16175 (patch)
treee5ca9e74e3d273e05ed9704797abc9e378b776be
parent817becf1110537f03dcc51d9b66225971d98faa1 (diff)
downloadrdiff-backup-6cab8d962f3f6f60dc7bb0410a482d8420d16175.tar.gz
re-enable carbonfile default, ignore errors
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@674 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/Globals.py2
-rw-r--r--rdiff-backup/rdiff_backup/fs_abilities.py3
-rw-r--r--rdiff-backup/rdiff_backup/metadata.py4
-rw-r--r--rdiff-backup/rdiff_backup/rpath.py55
4 files changed, 27 insertions, 37 deletions
diff --git a/rdiff-backup/rdiff_backup/Globals.py b/rdiff-backup/rdiff_backup/Globals.py
index bfeab53..f440dbd 100644
--- a/rdiff-backup/rdiff_backup/Globals.py
+++ b/rdiff-backup/rdiff_backup/Globals.py
@@ -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
diff --git a/rdiff-backup/rdiff_backup/fs_abilities.py b/rdiff-backup/rdiff_backup/fs_abilities.py
index 1a62c99..4ecdfd6 100644
--- a/rdiff-backup/rdiff_backup/fs_abilities.py
+++ b/rdiff-backup/rdiff_backup/fs_abilities.py
@@ -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:
diff --git a/rdiff-backup/rdiff_backup/metadata.py b/rdiff-backup/rdiff_backup/metadata.py
index 0d7ba4f..04115d9 100644
--- a/rdiff-backup/rdiff_backup/metadata.py
+++ b/rdiff-backup/rdiff_backup/metadata.py
@@ -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
diff --git a/rdiff-backup/rdiff_backup/rpath.py b/rdiff-backup/rdiff_backup/rpath.py
index 7647c62..30c7ab0 100644
--- a/rdiff-backup/rdiff_backup/rpath.py
+++ b/rdiff-backup/rdiff_backup/rpath.py
@@ -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