summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-10-25 02:38:17 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2005-10-25 02:38:17 +0000
commit783b379388e400ce192b8c67e3c814cb56755f41 (patch)
treee476275d36edf05fbe659ad2b4c385d30cb68d9f
parent2e5e834e37fad52f4e5471117b809ce68e6e88d3 (diff)
downloadrdiff-backup-783b379388e400ce192b8c67e3c814cb56755f41.tar.gz
Misc changes, passes all tests now
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@651 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/eas_acls.py13
-rw-r--r--rdiff-backup/rdiff_backup/user_group.py4
-rw-r--r--rdiff-backup/testing/iterfiletest.py6
-rw-r--r--rdiff-backup/testing/statisticstest.py7
4 files changed, 14 insertions, 16 deletions
diff --git a/rdiff-backup/rdiff_backup/eas_acls.py b/rdiff-backup/rdiff_backup/eas_acls.py
index 709f324..6b74ac4 100644
--- a/rdiff-backup/rdiff_backup/eas_acls.py
+++ b/rdiff-backup/rdiff_backup/eas_acls.py
@@ -458,24 +458,15 @@ def list_to_acl(entry_list, map_names = 1):
"trigger further warnings" % (name,), 2)
dropped_acl_names[name] = name
- def map_id_name(owner_pair, group = None):
- """Return id of mapped id and user given original owner_pair"""
- id, name = owner_pair
- Map = group and user_group.GroupMap or user_group.UserMap
- if name: return Map.get_id_from_name(name)
- else:
- assert id is not None
- return Map.get_id_from_id(id)
-
acl = posix1e.ACL()
for typechar, owner_pair, perms in entry_list:
id = None
if owner_pair:
if map_names:
- if typechar == "u": id = map_id_name(owner_pair, 0)
+ if typechar == "u": id = user_group.acl_user_map(*owner_pair)
else:
assert typechar == "g", (typechar, owner_pair, perms)
- id = map_id_name(owner_pair, 1)
+ id = user_group.acl_group_map(*owner_pair)
if id is None:
warn_drop(owner_pair[1])
continue
diff --git a/rdiff-backup/rdiff_backup/user_group.py b/rdiff-backup/rdiff_backup/user_group.py
index 186e1b6..39b27e1 100644
--- a/rdiff-backup/rdiff_backup/user_group.py
+++ b/rdiff-backup/rdiff_backup/user_group.py
@@ -155,7 +155,7 @@ class NumericalMap:
def map_acl(self, id, name = None): return id
-############ Public section - don't use outside user_group ###########
+############ Public section - can use these outside user_group ###########
def uid2uname(uid):
@@ -213,3 +213,5 @@ def map_rpath(rp):
uname, gname = rp.getuname(), rp.getgname()
return (UserMap(uid, uname), GroupMap(gid, gname))
+def acl_user_map(uid, uname): return UserMap.map_acl(uid, uname)
+def acl_group_map(gid, gname): return GroupMap.map_acl(gid, gname)
diff --git a/rdiff-backup/testing/iterfiletest.py b/rdiff-backup/testing/iterfiletest.py
index 2c357ef..4f3083d 100644
--- a/rdiff-backup/testing/iterfiletest.py
+++ b/rdiff-backup/testing/iterfiletest.py
@@ -41,11 +41,11 @@ class testIterFile(unittest.TestCase):
def testFileException(self):
"""Test encoding a file which raises an exception"""
- f = FileException(100*1024)
+ f = FileException(200*1024) # size depends on buffer size
new_iter = IterWrappingFile(FileWrappingIter(iter([f, "foo"])))
f_out = new_iter.next()
- assert f_out.read(10000) == "a"*10000
- try: buf = f_out.read(100*1024)
+ assert f_out.read(50000) == "a"*50000
+ try: buf = f_out.read(190*1024)
except IOError: pass
else: assert 0, len(buf)
diff --git a/rdiff-backup/testing/statisticstest.py b/rdiff-backup/testing/statisticstest.py
index 686c4ca..7402b44 100644
--- a/rdiff-backup/testing/statisticstest.py
+++ b/rdiff-backup/testing/statisticstest.py
@@ -171,6 +171,11 @@ class IncStatTest(unittest.TestCase):
could change with different file systems...
"""
+ def sorti(inclist):
+ l = [(inc.getinctime(), inc) for inc in inclist]
+ l.sort()
+ return [inc for (t, inc) in l]
+
Globals.compression = 1
Myrm("testfiles/output")
InternalBackup(1, 1, "testfiles/stattest1", "testfiles/output")
@@ -180,7 +185,7 @@ class IncStatTest(unittest.TestCase):
rbdir = rpath.RPath(Globals.local_connection,
"testfiles/output/rdiff-backup-data")
- incs = restore.get_inclist(rbdir.append("session_statistics"))
+ incs = sorti(restore.get_inclist(rbdir.append("session_statistics")))
assert len(incs) == 2
s2 = statistics.StatsObj().read_stats_from_rp(incs[0])
assert s2.SourceFiles == 7