[CalendarServer-changes] [6437] CalendarServer/trunk/txdav/common/datastore/util.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Oct 18 09:39:09 PDT 2010
Revision: 6437
http://trac.macosforge.org/projects/calendarserver/changeset/6437
Author: sagen at apple.com
Date: 2010-10-18 09:39:08 -0700 (Mon, 18 Oct 2010)
Log Message:
-----------
Handle the symlinks the migrator may have created in order to avoid copying the "-migrated" directories across file systems.
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/util.py
Modified: CalendarServer/trunk/txdav/common/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/util.py 2010-10-18 16:34:37 UTC (rev 6436)
+++ CalendarServer/trunk/txdav/common/datastore/util.py 2010-10-18 16:39:08 UTC (rev 6437)
@@ -97,12 +97,14 @@
@return: a Deferred which fires when the migration is complete.
"""
self.log_warn("Beginning filesystem -> database upgrade.")
- for homeType, migrateFunc, eachFunc, destFunc in [
+ for homeType, migrateFunc, eachFunc, destFunc, topPathName in [
("calendar", migrateCalendarHome,
self.fileStore.eachCalendarHome,
- lambda txn: txn.calendarHomeWithUID),
+ lambda txn: txn.calendarHomeWithUID,
+ "calendars"),
("addressbook", migrateAddressbookHome, self.fileStore.eachAddressbookHome,
- lambda txn: txn.addressbookHomeWithUID)
+ lambda txn: txn.addressbookHomeWithUID,
+ "addressbooks")
]:
for fileTxn, fileHome in eachFunc():
uid = fileHome.uid()
@@ -122,10 +124,11 @@
sqlTxn.commit()
# FIXME: need a public remove...HomeWithUID() for de-
# provisioning
- storePath = self.fileStore._path
- fromParent = fileHome._path.segmentsFrom(storePath)
- fromParent[0] += "-migrated"
- backupPath = storePath
+ storePath = self.fileStore._path # Documents
+ topPath = storePath.child(topPathName) # calendars|addressbooks
+ fromParent = fileHome._path.segmentsFrom(topPath)
+ topPath = topPath.realpath() # follow possible symlink
+ backupPath = topPath.sibling(topPathName + "-migrated")
for segment in fromParent:
try:
backupPath.createDirectory()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101018/dd290cce/attachment.html>
More information about the calendarserver-changes
mailing list