[cedar-backup-svn] SF.net SVN: cedar-backup: [914] cedar-backup2/trunk
Brought to you by:
pronovic
|
From: <pro...@us...> - 2008-04-28 02:40:07
|
Revision: 914
http://cedar-backup.svn.sourceforge.net/cedar-backup/?rev=914&view=rev
Author: pronovic
Date: 2008-04-27 19:40:04 -0700 (Sun, 27 Apr 2008)
Log Message:
-----------
Add dereference flag to FilesystemList.addDirContents()
Modified Paths:
--------------
cedar-backup2/trunk/CedarBackup2/filesystem.py
cedar-backup2/trunk/Changelog
cedar-backup2/trunk/test/filesystemtests.py
Added Paths:
-----------
cedar-backup2/trunk/test/data/tree22.tar.gz
Modified: cedar-backup2/trunk/CedarBackup2/filesystem.py
===================================================================
--- cedar-backup2/trunk/CedarBackup2/filesystem.py 2008-04-28 02:38:06 UTC (rev 913)
+++ cedar-backup2/trunk/CedarBackup2/filesystem.py 2008-04-28 02:40:04 UTC (rev 914)
@@ -59,7 +59,7 @@
# Cedar Backup modules
from CedarBackup2.knapsack import firstFit, bestFit, worstFit, alternateFit
from CedarBackup2.util import AbsolutePathList, ObjectTypeList, UnorderedList, RegexList
-from CedarBackup2.util import removeKeys, displayBytes, calculateFileAge, encodePath
+from CedarBackup2.util import removeKeys, displayBytes, calculateFileAge, encodePath, dereferenceLink
########################################################################
@@ -358,7 +358,7 @@
logger.debug("Added directory to list: [%s]" % path)
return 1
- def addDirContents(self, path, recursive=True, addSelf=True, linkDepth=0):
+ def addDirContents(self, path, recursive=True, addSelf=True, linkDepth=0, dereference=False):
"""
Adds the contents of a directory to the list.
@@ -387,6 +387,9 @@
@note: The L{excludeDirs} flag only controls whether any given directory
path itself is added to the list once it has been discovered. It does
I{not} modify any behavior related to directory recursion.
+
+ @note: If you call this method I{on a link to a directory} that link will
+ never be dereferenced (it may, however, be followed).
@param path: Directory path whose contents should be added to the list
@type path: String representing a path on disk
@@ -400,6 +403,9 @@
@param linkDepth: Maximum depth of the tree at which soft links should be followed
@type linkDepth: Integer value, where zero means not to follow any soft links
+ @param dereference: Indicates whether soft links, if followed, should be dereferenced
+ @type dereference: Boolean value
+
@return: Number of items recursively added to the list
@raise ValueError: If path is not a directory or does not exist.
@@ -407,9 +413,9 @@
"""
path = encodePath(path)
path = normalizeDir(path)
- return self._addDirContentsInternal(path, addSelf, recursive, linkDepth)
+ return self._addDirContentsInternal(path, addSelf, recursive, linkDepth, dereference)
- def _addDirContentsInternal(self, path, includePath=True, recursive=True, linkDepth=0):
+ def _addDirContentsInternal(self, path, includePath=True, recursive=True, linkDepth=0, dereference=False):
"""
Internal implementation of C{addDirContents}.
@@ -433,10 +439,14 @@
gets a little confused (it has a link and a directory with the same
name).
+ @note: If you call this method I{on a link to a directory} that link will
+ never be dereferenced (it may, however, be followed).
+
@param path: Directory path whose contents should be added to the list.
@param includePath: Indicates whether to include the path as well as contents.
@param recursive: Indicates whether directory contents should be added recursively.
@param linkDepth: Depth of soft links that should be followed
+ @param dereference: Indicates whether soft links, if followed, should be dereferenced
@return: Number of items recursively added to the list
@@ -465,18 +475,31 @@
for entry in os.listdir(path):
entrypath = os.path.join(path, entry)
if os.path.isfile(entrypath):
+ if linkDepth > 0 and dereference:
+ derefpath = dereferenceLink(entrypath)
+ if derefpath != entrypath:
+ added += self.addFile(derefpath)
added += self.addFile(entrypath)
elif os.path.isdir(entrypath):
if os.path.islink(entrypath):
- if recursive and linkDepth > 0:
- newDepth = linkDepth - 1;
- added += self._addDirContentsInternal(entrypath, includePath=False, linkDepth=newDepth)
+ if recursive:
+ if linkDepth > 0:
+ newDepth = linkDepth - 1;
+ if dereference:
+ derefpath = dereferenceLink(entrypath)
+ if derefpath != entrypath:
+ added += self._addDirContentsInternal(derefpath, True, recursive, newDepth, dereference)
+ added += self.addDir(entrypath)
+ else:
+ added += self._addDirContentsInternal(entrypath, False, recursive, newDepth, dereference)
+ else:
+ added += self.addDir(entrypath)
else:
added += self.addDir(entrypath)
else:
if recursive:
newDepth = linkDepth - 1;
- added += self._addDirContentsInternal(entrypath, linkDepth=newDepth)
+ added += self._addDirContentsInternal(entrypath, True, recursive, newDepth, dereference)
else:
added += self.addDir(entrypath)
return added
@@ -1221,7 +1244,7 @@
# Add methods
##############
- def addDirContents(self, path, recursive=True, addSelf=True, linkDepth=0):
+ def addDirContents(self, path, recursive=True, addSelf=True, linkDepth=0, dereference=False):
"""
Adds the contents of a directory to the list.
@@ -1255,6 +1278,9 @@
path itself is added to the list once it has been discovered. It does
I{not} modify any behavior related to directory recursion.
+ @note: If you call this method I{on a link to a directory} that link will
+ never be dereferenced (it may, however, be followed).
+
@param path: Directory path whose contents should be added to the list
@type path: String representing a path on disk
@@ -1266,6 +1292,9 @@
@param linkDepth: Depth of soft links that should be followed
@type linkDepth: Integer value, where zero means not to follow any soft links
+ @param dereference: Indicates whether soft links, if followed, should be dereferenced
+ @type dereference: Boolean value
+
@return: Number of items recursively added to the list
@raise ValueError: If path is not a directory or does not exist.
@@ -1273,7 +1302,7 @@
"""
path = encodePath(path)
path = normalizeDir(path)
- return super(PurgeItemList, self)._addDirContentsInternal(path, False, recursive, linkDepth)
+ return super(PurgeItemList, self)._addDirContentsInternal(path, False, recursive, linkDepth, dereference)
##################
Modified: cedar-backup2/trunk/Changelog
===================================================================
--- cedar-backup2/trunk/Changelog 2008-04-28 02:38:06 UTC (rev 913)
+++ cedar-backup2/trunk/Changelog 2008-04-28 02:40:04 UTC (rev 914)
@@ -1,3 +1,9 @@
+Version 2.18.0 unreleased
+
+ * Add the ability to dereference links when following them.
+ - Add util.dereferenceLink() function
+ - Add dereference flag to FilesystemList.addDirContents()
+
Version 2.17.1 26 Apr 2008
* Updated copyright statement slightly.
Added: cedar-backup2/trunk/test/data/tree22.tar.gz
===================================================================
(Binary files differ)
Property changes on: cedar-backup2/trunk/test/data/tree22.tar.gz
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: cedar-backup2/trunk/test/filesystemtests.py
===================================================================
--- cedar-backup2/trunk/test/filesystemtests.py 2008-04-28 02:38:06 UTC (rev 913)
+++ cedar-backup2/trunk/test/filesystemtests.py 2008-04-28 02:40:04 UTC (rev 914)
@@ -131,7 +131,7 @@
DATA_DIRS = [ "./data", "./test/data" ]
RESOURCES = [ "tree1.tar.gz", "tree2.tar.gz", "tree3.tar.gz", "tree4.tar.gz", "tree5.tar.gz",
"tree6.tar.gz", "tree7.tar.gz", "tree8.tar.gz", "tree9.tar.gz", "tree10.tar.gz",
- "tree11.tar.gz", "tree12.tar.gz", "tree13.tar.gz", ]
+ "tree11.tar.gz", "tree12.tar.gz", "tree13.tar.gz", "tree22.tar.gz", ]
INVALID_FILE = "bogus" # This file name should never exist
NOMATCH_PATH = "/something" # This path should never match something we put in a file list
@@ -4758,10 +4758,11 @@
self.extractTar("tree6")
path = self.buildPath(["tree6"])
fsList = FilesystemList()
- count = fsList.addDirContents(path, addSelf=False, linkDepth=1)
+ count = fsList.addDirContents(path, linkDepth=1)
if not platformSupportsLinks():
- self.failUnlessEqual(121, count)
- self.failUnlessEqual(121, len(fsList))
+ self.failUnlessEqual(122, count)
+ self.failUnlessEqual(122, len(fsList))
+ self.failUnless(self.buildPath([ "tree6", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir001", ]) in fsList)
@@ -4884,8 +4885,9 @@
self.failUnless(self.buildPath([ "tree6", "file002", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "link001", ]) in fsList)
else:
- self.failUnlessEqual(164, count)
- self.failUnlessEqual(164, len(fsList))
+ self.failUnlessEqual(165, count)
+ self.failUnlessEqual(165, len(fsList))
+ self.failUnless(self.buildPath([ "tree6", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir002", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir003", ]) in fsList)
@@ -5058,10 +5060,11 @@
self.extractTar("tree6")
path = self.buildPath(["tree6"])
fsList = FilesystemList()
- count = fsList.addDirContents(path, addSelf=False, linkDepth=2)
+ count = fsList.addDirContents(path, linkDepth=2)
if not platformSupportsLinks():
- self.failUnlessEqual(121, count)
- self.failUnlessEqual(121, len(fsList))
+ self.failUnlessEqual(122, count)
+ self.failUnlessEqual(122, len(fsList))
+ self.failUnless(self.buildPath([ "tree6" ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir001", ]) in fsList)
@@ -5184,8 +5187,9 @@
self.failUnless(self.buildPath([ "tree6", "file002", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "link001", ]) in fsList)
else:
- self.failUnlessEqual(240, count)
- self.failUnlessEqual(240, len(fsList))
+ self.failUnlessEqual(241, count)
+ self.failUnlessEqual(241, len(fsList))
+ self.failUnless(self.buildPath([ "tree6" ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir001", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir002", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir003", ]) in fsList)
@@ -5427,7 +5431,462 @@
self.failUnless(self.buildPath([ "tree6", "file002", ]) in fsList)
self.failUnless(self.buildPath([ "tree6", "link001", ]) in fsList)
+ def testAddDirContents_093(self):
+ """
+ Attempt to add a directory with linkDepth=0, dereference=False.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=0, dereference=False)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(12, count)
+ self.failUnlessEqual(12, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", ]) in fsList)
+ def testAddDirContents_094(self):
+ """
+ Attempt to add a directory with linkDepth=1, dereference=False.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=1, dereference=False)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(16, count)
+ self.failUnlessEqual(16, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", ]) in fsList)
+
+ def testAddDirContents_095(self):
+ """
+ Attempt to add a directory with linkDepth=2, dereference=False.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=2, dereference=False)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(20, count)
+ self.failUnlessEqual(20, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001",]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002",]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "link002", ]) in fsList)
+
+ def testAddDirContents_096(self):
+ """
+ Attempt to add a directory with linkDepth=3, dereference=False.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=3, dereference=False)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(20, count)
+ self.failUnlessEqual(20, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001",]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002",]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "link001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", "link002", "link002", ]) in fsList)
+
+ def testAddDirContents_097(self):
+ """
+ Attempt to add a directory with linkDepth=0, dereference=True.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=0, dereference=True)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(12, count)
+ self.failUnlessEqual(12, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", ]) in fsList)
+
+ def testAddDirContents_098(self):
+ """
+ Attempt to add a directory with linkDepth=1, dereference=True.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=1, dereference=True)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(20, count)
+ self.failUnlessEqual(20, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005" ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link002", ]) in fsList)
+
+ def testAddDirContents_099(self):
+ """
+ Attempt to add a directory with linkDepth=2, dereference=True.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=2, dereference=True)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(32, count)
+ self.failUnlessEqual(32, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file005", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file009", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "link002", ]) in fsList)
+
+ def testAddDirContents_100(self):
+ """
+ Attempt to add a directory with linkDepth=3, dereference=True.
+ """
+ self.extractTar("tree22")
+ path = self.buildPath(["tree22", "dir003", ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, linkDepth=3, dereference=True)
+ if not platformSupportsLinks():
+ pass
+ else:
+ self.failUnlessEqual(35, count)
+ self.failUnlessEqual(35, len(fsList))
+ self.failUnless(self.buildPath(["tree22", "dir003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "dir001", "link004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir003", "link003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir001", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file005", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir002", "file009", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir004", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "file003", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir005", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "link001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir006", "link002", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir007", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir007", "file001", ]) in fsList)
+ self.failUnless(self.buildPath(["tree22", "dir008", "file001", ]) in fsList)
+
+ def testAddDirContents_101(self):
+ """
+ Attempt to add a soft link; excludeFiles and dereference set.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludeFiles = True
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to dir003
+ fsList = FilesystemList()
+ fsList.excludeFiles = True
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(1, count)
+ self.failUnlessEqual([path], fsList)
+
+ def testAddDirContents_102(self):
+ """
+ Attempt to add a soft link; excludeDirs and dereference set.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludeDirs = True
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to dir003
+ fsList = FilesystemList()
+ fsList.excludeDirs = True
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(0, count)
+ self.failUnlessEqual([], fsList)
+
+ def testAddDirContents_103(self):
+ """
+ Attempt to add a soft link; excludeLinks and dereference set.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludeLinks = True
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to dir003
+ fsList = FilesystemList()
+ fsList.excludeLinks = True
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(0, count)
+ self.failUnlessEqual([], fsList)
+
+ def testAddDirContents_104(self):
+ """
+ Attempt to add a soft link; with excludePaths including the path,
+ with dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludePaths = [ path ]
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to dir003
+ fsList = FilesystemList()
+ fsList.excludePaths = [ path ]
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(0, count)
+ self.failUnlessEqual([], fsList)
+
+ def testAddDirContents_105(self):
+ """
+ Attempt to add a soft link; with excludePatterns matching the path,
+ with dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludePatterns = [ self.pathPattern(path) ]
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to dir003
+ fsList = FilesystemList()
+ fsList.excludePatterns = [ self.pathPattern(path) ]
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(0, count)
+ self.failUnlessEqual([], fsList)
+
+ def testAddDirContents_106(self):
+ """
+ Attempt to add a link to a file, with dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree9")
+ path = self.buildPath(["tree9", "dir002", "link003", ])
+ fsList = FilesystemList()
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ def testAddDirContents_107(self):
+ """
+ Attempt to add a link to a directory (which should add its contents),
+ with dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree9")
+ path = self.buildPath(["tree9", "link002" ])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(13, count)
+ self.failUnlessEqual(13, len(fsList))
+ self.failUnless(self.buildPath([ "tree9", "link002", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree9", "link002", "dir001", ]) in fsList) # duplicated
+ self.failUnless(self.buildPath([ "tree9", "link002", "dir002", ]) in fsList) # duplicated
+ self.failUnless(self.buildPath([ "tree9", "link002", "file001", ]) in fsList) # duplicated
+ self.failUnless(self.buildPath([ "tree9", "link002", "file002", ]) in fsList) # duplicated
+ self.failUnless(self.buildPath([ "tree9", "link002", "link001", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree9", "link002", "link002", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree9", "link002", "link003", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree9", "link002", "link004", ]) in fsList)
+
+ def testAddDirContents_108(self):
+ """
+ Attempt to add an invalid link (i.e. a link that points to something that
+ doesn't exist), and dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree10")
+ path = self.buildPath(["tree10", "link001"])
+ fsList = FilesystemList()
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ def testAddDirContents_109(self):
+ """
+ Attempt to add directory containing an invalid link (i.e. a link that
+ points to something that doesn't exist), and dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree10")
+ path = self.buildPath(["tree10"])
+ fsList = FilesystemList()
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(3, count)
+ self.failUnlessEqual(3, len(fsList))
+ self.failUnless(self.buildPath([ "tree10", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree10", "file001", ]) in fsList)
+ self.failUnless(self.buildPath([ "tree10", "dir002", ]) in fsList)
+
+ def testAddDirContents_110(self):
+ """
+ Attempt to add a soft link; with excludeBasenamePatterns matching the
+ path, and dereference=True.
+ """
+ if platformSupportsLinks():
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "link001"]) # link to a file
+ fsList = FilesystemList()
+ fsList.excludeBasenamePatterns = [ "link001", ]
+ self.failUnlessRaises(ValueError, fsList.addDirContents, path, True, True, 1, True)
+
+ self.extractTar("tree5")
+ path = self.buildPath(["tree5", "dir002", "link001"]) # link to a dir
+ fsList = FilesystemList()
+ fsList.excludeBasenamePatterns = [ "link001", ]
+ count = fsList.addDirContents(path, True, True, 1, True)
+ self.failUnlessEqual(0, count)
+ self.failUnlessEqual([], fsList)
+
+
#####################
# Test removeFiles()
#####################
@@ -21420,7 +21879,1359 @@
self.failUnless(self.buildPath([ "tree6", "link001", ]) in purgeList)
self.failUnless(self.buildPath([ "tree6", "link002", ]) in purgeList)
+ def testAddDirContents_088(self):
+ """
+ Attempt to add a large tree, with excludeBasenamePatterns set to exclude
+ some entries.
+ """
+ self.extractTar("tree6")
+ path = self.buildPath(["tree6"])
+ purgeList = PurgeItemList()
+ purgeList.excludeBasenamePatterns = [ "file001", "dir001" ]
+ count = purgeList.addDirContents(path)
+ if not platformSupportsLinks():
+ self.failUnlessEqual(54, count)
+ self.failUnlessEqual(54, len(purgeList))
+ self.failUnless(self.buildPath([ "tree6", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file009", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "ignore", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "link001", ]) in purgeList)
+ else:
+ self.failUnlessEqual(63, count)
+ self.failUnlessEqual(63, len(purgeList))
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "file009", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "ignore", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "link002", ]) in purgeList)
+ def testAddDirContents_089(self):
+ """
+ Attempt to add a large tree with no exclusions
+ """
+ self.extractTar("tree6")
+ path = self.buildPath(["tree6"])
+ purgeList = PurgeItemList()
+ count = purgeList.addDirContents(path)
+ if not platformSupportsLinks():
+ self.failUnlessEqual(121, count)
+ self.failUnlessEqual(121, len(purgeList))
+ self.failUnless(self.buildPath([ "tree6", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "ignore", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir001", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir001", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "file009", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir001", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir002", "link005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "dir003", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir002", "link004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "dir001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "dir002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file001", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file003", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file004", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file005", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file006", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file007", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file008", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "file009", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir001", "link002", ]) in purgeList)
+ self.failUnless(self.buildPath([ "tree6", "dir003", "dir002", ]) in purgeLi...
[truncated message content] |