[pacman-dev] [PATCH 1/3] pactest: build the filelist using a set()
Dan McGee
dan at archlinux.org
Tue Jan 11 19:50:20 EST 2011
This will prevent duplicates, which we had plenty of once I made a few tests
that had a list of files greater than the normal two. The previous logic was
not working quite right.
Signed-off-by: Dan McGee <dan at archlinux.org>
---
test/pacman/pmdb.py | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py
index 60460ce..b4d0e2d 100755
--- a/test/pacman/pmdb.py
+++ b/test/pacman/pmdb.py
@@ -38,16 +38,14 @@ def _mkfilelist(files):
usr/local/bin/
usr/local/bin/dummy
"""
- i = []
+ file_list = set()
for f in files:
dir = getfilename(f)
- i.append(dir)
+ file_list.add(dir)
while "/" in dir:
[dir, tmp] = dir.rsplit("/", 1)
- if not dir + "/" in files:
- i.append(dir + "/")
- i.sort()
- return i
+ file_list.add(dir + "/")
+ return sorted(file_list)
def _mkbackuplist(backup):
"""
--
1.7.3.5
More information about the pacman-dev
mailing list