pmrule: make backup file test more robust

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@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2014-10-06 03:55:06 -04:00 committed by Allan McRae
parent 19c3179b7e
commit 6dd593c293
1 changed files with 4 additions and 6 deletions

View File

@ -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