[pacman-dev] [PATCH 2/6] pmrule: make backup file test more robust

Andrew Gregory andrew.gregory.8 at gmail.com
Wed Oct 8 06:39:03 UTC 2014


This prevents an exception in the event backup entries are not in the
correct format and brings the test in line with alpm's backup parsing
which splits on the last tab rather than the first.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 test/pacman/pmrule.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
index 0eec8ea..c2336c5 100644
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -103,13 +103,11 @@ def check(self, test):
                     if not value in newpkg.files:
                         success = 0
                 elif case == "BACKUP":
-                    found = 0
+                    success = 0
                     for f in newpkg.backup:
-                        name, md5sum = f.split("\t")
-                        if value == name:
-                            found = 1
-                    if not found:
-                        success = 0
+                        if f.startswith(value + "\t"):
+                            success = 1
+                            break;
                 else:
                     tap.diag("PKG rule '%s' not found" % case)
                     success = -1
-- 
2.1.2


More information about the pacman-dev mailing list