summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gemato/recursiveloader.py24
-rw-r--r--tests/test_recursiveloader.py6
2 files changed, 18 insertions, 12 deletions
diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py
index 815afbb..53a328e 100644
--- a/gemato/recursiveloader.py
+++ b/gemato/recursiveloader.py
@@ -594,6 +594,10 @@ class ManifestRecursiveLoader(object):
suitable to passing to subprocesses.
"""
for dirpath, dirnames, filenames in it:
+ dir_st = os.stat(dirpath)
+ if dir_st.st_dev != self.manifest_device:
+ raise gemato.exceptions.ManifestCrossDevice(dirpath)
+
relpath = os.path.relpath(dirpath, self.root_directory)
# strip dot to avoid matching problems
if relpath == '.':
@@ -609,10 +613,6 @@ class ManifestRecursiveLoader(object):
de = dirdict.get(d)
if de is None:
- syspath = os.path.join(dirpath, d)
- st = os.stat(syspath)
- if st.st_dev != self.manifest_device:
- raise gemato.exceptions.ManifestCrossDevice(syspath)
continue
# if we have an entry for the directory, it's either
@@ -967,6 +967,10 @@ class ManifestRecursiveLoader(object):
followlinks=True)
for dirpath, dirnames, filenames in it:
+ dir_st = os.stat(dirpath)
+ if dir_st.st_dev != self.manifest_device:
+ raise gemato.exceptions.ManifestCrossDevice(dirpath)
+
relpath = os.path.relpath(dirpath, self.root_directory)
# strip dot to avoid matching problems
if relpath == '.':
@@ -982,10 +986,6 @@ class ManifestRecursiveLoader(object):
de = dirdict.get(d, None)
if de is None:
- syspath = os.path.join(dirpath, d)
- st = os.stat(syspath)
- if st.st_dev != self.manifest_device:
- raise gemato.exceptions.ManifestCrossDevice(syspath)
continue
assert de.tag == 'IGNORE'
@@ -1067,6 +1067,10 @@ class ManifestRecursiveLoader(object):
followlinks=True)
for dirpath, dirnames, filenames in it:
+ dir_st = os.stat(dirpath)
+ if dir_st.st_dev != self.manifest_device:
+ raise gemato.exceptions.ManifestCrossDevice(dirpath)
+
relpath = os.path.relpath(dirpath, self.root_directory)
# strip dot to avoid matching problems
if relpath == '.':
@@ -1090,10 +1094,6 @@ class ManifestRecursiveLoader(object):
dpath = os.path.join(relpath, d)
mpath, de = entry_dict.pop(dpath, (None, None))
if de is None:
- syspath = os.path.join(dirpath, d)
- st = os.stat(syspath)
- if st.st_dev != self.manifest_device:
- raise gemato.exceptions.ManifestCrossDevice(syspath)
continue
if de.tag == 'IGNORE':
diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py
index 4a5662f..94002d2 100644
--- a/tests/test_recursiveloader.py
+++ b/tests/test_recursiveloader.py
@@ -1564,6 +1564,12 @@ DATA sub/version 0 MD5 d41d8cd98f00b204e9800998ecf8427e
m.assert_directory_verifies, '',
fail_handler=callback_return_true)
+ def test_assert_directory_verifies_subdir(self):
+ m = gemato.recursiveloader.ManifestRecursiveLoader(
+ os.path.join(self.dir, 'Manifest'))
+ self.assertRaises(gemato.exceptions.ManifestCrossDevice,
+ m.assert_directory_verifies, 'sub')
+
def test_cli_verifies(self):
self.assertEqual(
gemato.cli.main(['gemato', 'verify', self.dir]),