[CalendarServer-changes] [8012] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 24 14:23:41 PDT 2011
Revision: 8012
http://trac.macosforge.org/projects/calendarserver/changeset/8012
Author: sagen at apple.com
Date: 2011-08-24 14:23:40 -0700 (Wed, 24 Aug 2011)
Log Message:
-----------
Re-enable upgrade.py test again now that logic is based on native xattr capability and not just platform.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
CalendarServer/trunk/twistedcaldav/upgrade.py
Modified: CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2011-08-23 20:48:00 UTC (rev 8011)
+++ CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2011-08-24 21:23:40 UTC (rev 8012)
@@ -16,7 +16,6 @@
from twisted.internet.defer import inlineCallbacks
-from twisted.python.runtime import platform
from twext.web2.dav import davxml
from twistedcaldav.config import config
from twistedcaldav.directory.calendaruserproxy import ProxySqliteDB
@@ -1395,11 +1394,7 @@
-# Conditionally bypass these tests on non-OSX
-if not platform.isMacOSX():
- UpgradeTests.todo = "Currently only running on OSX until we resolve xattr situation"
-
event01_before = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//iCal 3.0//EN
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2011-08-23 20:48:00 UTC (rev 8011)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2011-08-24 21:23:40 UTC (rev 8012)
@@ -193,20 +193,35 @@
with open(resPath, "w") as res:
res.write(data)
- # On non-native xattr systems we cannot do this, but those systems will typically not be migrating from pre-v1
- if platform.isMacOSX():
- md5value = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getcontentmd5 xmlns='http://twistedmatrix.com/xml_namespace/dav/'>%s</getcontentmd5>\r\n" % (hashlib.md5(data).hexdigest(),)
- md5value = zlib.compress(md5value)
+ md5value = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getcontentmd5 xmlns='http://twistedmatrix.com/xml_namespace/dav/'>%s</getcontentmd5>\r\n" % (hashlib.md5(data).hexdigest(),)
+ md5value = zlib.compress(md5value)
+ try:
xattr.setxattr(resPath, xattrname("{http:%2F%2Ftwistedmatrix.com%2Fxml_namespace%2Fdav%2F}getcontentmd5"), md5value)
+ except IOError, ioe:
+ if ioe.errno == errno.EOPNOTSUPP:
+ # On non-native xattr systems we cannot do this,
+ # but those systems will typically not be migrating
+ # from pre-v1
+ pass
+ except:
+ raise
collectionUpdated = True
- # On non-native xattr systems we cannot do this, but those systems will typically not be migrating from pre-v1
- if collectionUpdated and platform.isMacOSX():
+ if collectionUpdated:
ctagValue = "<?xml version='1.0' encoding='UTF-8'?>\r\n<getctag xmlns='http://calendarserver.org/ns/'>%s</getctag>\r\n" % (str(datetime.datetime.now()),)
ctagValue = zlib.compress(ctagValue)
- xattr.setxattr(calPath, xattrname("{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag"), ctagValue)
+ try:
+ xattr.setxattr(calPath, xattrname("{http:%2F%2Fcalendarserver.org%2Fns%2F}getctag"), ctagValue)
+ except IOError, ioe:
+ if ioe.errno == errno.EOPNOTSUPP:
+ # On non-native xattr systems we cannot do this,
+ # but those systems will typically not be migrating
+ # from pre-v1
+ pass
+ except:
+ raise
return errorOccurred
@@ -234,15 +249,24 @@
# Change the calendar-free-busy-set xattrs of the inbox to the
# __uids__/<guid> form
- # On non-native xattr systems we cannot do this, but those systems will typically not be migrating from pre-v1
- if cal == "inbox" and platform.isMacOSX():
- for attr, value in xattr.xattr(calPath).iteritems():
- if attr == xattrname("{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"):
- value = updateFreeBusySet(value, directory)
- if value is not None:
- # Need to write the xattr back to disk
- xattr.setxattr(calPath, attr, value)
+ if cal == "inbox":
+ try:
+ for attr, value in xattr.xattr(calPath).iteritems():
+ if attr == xattrname("{urn:ietf:params:xml:ns:caldav}calendar-free-busy-set"):
+ value = updateFreeBusySet(value, directory)
+ if value is not None:
+ # Need to write the xattr back to disk
+ xattr.setxattr(calPath, attr, value)
+ except IOError, ioe:
+ if ioe.errno == errno.EOPNOTSUPP:
+ # On non-native xattr systems we cannot do this,
+ # but those systems will typically not be migrating
+ # from pre-v1
+ pass
+ except:
+ raise
+
except Exception, e:
log.error("Failed to upgrade calendar home %s: %s" % (homePath, e))
raise
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110824/b1081415/attachment.html>
More information about the calendarserver-changes
mailing list