1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 07:48:50 -05:00

pactest: use actual regexes in OUTPUT rules

I managed to just make deptest001.py fail by changing a DEBUG-level
logger in commit b12be99c89. This should not be this fickle. Enhance the
OUTPUT rule to use an actual Python re object when looking for matches,
and make a lot of the rules use stronger patterns to match with.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-03-01 14:24:13 -06:00
parent b12be99c89
commit d68635e7c2
14 changed files with 29 additions and 26 deletions

View File

@ -10,7 +10,7 @@ self.addpkg2db("local", lp3)
self.args = "-T pkg1 pkg2 pkg3\>2.1 prov\>\=3.0"
self.addrule("PACMAN_RETCODE=127")
self.addrule("!PACMAN_OUTPUT=pkg1")
self.addrule("PACMAN_OUTPUT=pkg2")
self.addrule("PACMAN_OUTPUT=pkg3")
self.addrule("!PACMAN_OUTPUT=prov")
self.addrule("!PACMAN_OUTPUT=^pkg1")
self.addrule("PACMAN_OUTPUT=^pkg2")
self.addrule("PACMAN_OUTPUT=^pkg3")
self.addrule("!PACMAN_OUTPUT=^prov")

View File

@ -18,4 +18,4 @@ self.args = "--ask=1 -S grp"
self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=%s" % pkg1.name)
self.addrule("PKG_EXIST=%s" % pkg2.name)
self.addrule("PACMAN_OUTPUT=IgnorePkg")
self.addrule("PACMAN_OUTPUT=is in IgnorePkg")

View File

@ -9,4 +9,4 @@ self.addpkg(p)
self.args = "--debug -U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=ldconfig")
self.addrule("PACMAN_OUTPUT=running ldconfig")

View File

@ -13,4 +13,4 @@ self.args = "--debug -U %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-2")
self.addrule("PACMAN_OUTPUT=ldconfig")
self.addrule("PACMAN_OUTPUT=running ldconfig")

View File

@ -11,4 +11,4 @@ self.args = "-S %s" % sp.name
self.args = "--debug -S %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=ldconfig")
self.addrule("PACMAN_OUTPUT=running ldconfig")

View File

@ -7,4 +7,4 @@ self.addpkg2db("local", p)
self.args = "-Q %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)
self.addrule("PACMAN_OUTPUT=^%s" % p.name)

View File

@ -16,6 +16,6 @@ self.addpkg2db("local", p)
self.args = "-Qi %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)
self.addrule("PACMAN_OUTPUT=%s" % p.desc)
self.addrule("PACMAN_OUTPUT=2007")
self.addrule("PACMAN_OUTPUT=^Name.*%s" % p.name)
self.addrule("PACMAN_OUTPUT=^Description.*%s" % p.desc)
self.addrule("PACMAN_OUTPUT=^Build Date.*2007")

View File

@ -8,4 +8,4 @@ self.addpkg2db("local", p)
self.args = "-Qs %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)
self.addrule("PACMAN_OUTPUT=^local/%s" % p.name)

View File

@ -7,4 +7,4 @@ self.addpkg2db("local", p)
self.args = "-Q %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)
self.addrule("PACMAN_OUTPUT=^%s" % p.name)

View File

@ -16,6 +16,6 @@ self.addpkg2db("local", p)
self.args = "-Qi %s" % p.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % p.name)
self.addrule("PACMAN_OUTPUT=%s" % p.desc)
self.addrule("PACMAN_OUTPUT=2007")
self.addrule("PACMAN_OUTPUT=^Name.*%s" % p.name)
self.addrule("PACMAN_OUTPUT=^Description.*%s" % p.desc)
self.addrule("PACMAN_OUTPUT=^Build Date.*2007")

View File

@ -18,6 +18,6 @@ self.addpkg2db("sync", sp)
self.args = "-Si %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)
self.addrule("PACMAN_OUTPUT=%s" % sp.desc)
self.addrule("PACMAN_OUTPUT=2007")
self.addrule("PACMAN_OUTPUT=^Name.*%s" % sp.name)
self.addrule("PACMAN_OUTPUT=^Description.*%s" % sp.desc)
self.addrule("PACMAN_OUTPUT=^Build Date.*2007")

View File

@ -9,4 +9,4 @@ self.addpkg2db("sync", sp)
self.args = "-Ss %s" % sp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)
self.addrule("PACMAN_OUTPUT=^sync/%s" % sp.name)

View File

@ -8,4 +8,4 @@ self.addpkg2db("sync", sp)
self.args = "-Sl"
self.addrule("PACMAN_RETCODE=0")
self.addrule("PACMAN_OUTPUT=%s" % sp.name)
self.addrule("PACMAN_OUTPUT=^sync %s" % sp.name)

View File

@ -17,6 +17,7 @@
import os
import re
import hashlib
import stat
@ -194,11 +195,13 @@ def which(filename):
return None
def grep(filename, pattern):
lines = file(filename, 'r').readlines()
for line in lines:
if not line: break
if line.find(pattern) != -1:
pat = re.compile(pattern)
myfile = open(filename, 'r')
for line in myfile:
if pat.search(line):
myfile.close()
return True
myfile.close()
return False
def mkdir(path):