mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-08 12:28:00 -05:00
pactest: pylint changes for pmrule
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
2c6be06bba
commit
946f4af7f3
@ -16,8 +16,9 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from util import *
|
import stat
|
||||||
from stat import *
|
|
||||||
|
import util
|
||||||
|
|
||||||
class pmrule:
|
class pmrule:
|
||||||
"""Rule object
|
"""Rule object
|
||||||
@ -54,11 +55,11 @@ class pmrule:
|
|||||||
if retcode != int(key):
|
if retcode != int(key):
|
||||||
success = 0
|
success = 0
|
||||||
elif case == "OUTPUT":
|
elif case == "OUTPUT":
|
||||||
logfile = os.path.join(root, LOGFILE)
|
logfile = os.path.join(root, util.LOGFILE)
|
||||||
if not os.access(logfile, os.F_OK):
|
if not os.access(logfile, os.F_OK):
|
||||||
print "LOGFILE not found, cannot validate 'OUTPUT' rule"
|
print "LOGFILE not found, cannot validate 'OUTPUT' rule"
|
||||||
success = 0
|
success = 0
|
||||||
elif not grep(os.path.join(root, LOGFILE), key):
|
elif not util.grep(os.path.join(root, util.LOGFILE), key):
|
||||||
success = 0
|
success = 0
|
||||||
else:
|
else:
|
||||||
print "PACMAN rule '%s' not found" % case
|
print "PACMAN rule '%s' not found" % case
|
||||||
@ -68,8 +69,8 @@ class pmrule:
|
|||||||
if not newpkg:
|
if not newpkg:
|
||||||
success = 0
|
success = 0
|
||||||
else:
|
else:
|
||||||
vprint("\tnewpkg.checksum : %s" % newpkg.checksum)
|
util.vprint("\tnewpkg.checksum : %s" % newpkg.checksum)
|
||||||
vprint("\tnewpkg.mtime : %s" % newpkg.mtime)
|
util.vprint("\tnewpkg.mtime : %s" % newpkg.mtime)
|
||||||
if case == "EXIST":
|
if case == "EXIST":
|
||||||
success = 1
|
success = 1
|
||||||
elif case == "MODIFIED":
|
elif case == "MODIFIED":
|
||||||
@ -124,8 +125,8 @@ class pmrule:
|
|||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
success = 0
|
success = 0
|
||||||
else:
|
else:
|
||||||
mode = os.lstat(filename)[ST_MODE]
|
mode = os.lstat(filename)[stat.ST_MODE]
|
||||||
if int(value,8) != S_IMODE(mode):
|
if int(value, 8) != stat.S_IMODE(mode):
|
||||||
success = 0
|
success = 0
|
||||||
elif case == "TYPE":
|
elif case == "TYPE":
|
||||||
if value == "dir":
|
if value == "dir":
|
||||||
@ -138,13 +139,13 @@ class pmrule:
|
|||||||
if not os.path.islink(filename):
|
if not os.path.islink(filename):
|
||||||
success = 0
|
success = 0
|
||||||
elif case == "PACNEW":
|
elif case == "PACNEW":
|
||||||
if not os.path.isfile("%s%s" % (filename, PM_PACNEW)):
|
if not os.path.isfile("%s.pacnew" % filename):
|
||||||
success = 0
|
success = 0
|
||||||
elif case == "PACORIG":
|
elif case == "PACORIG":
|
||||||
if not os.path.isfile("%s%s" % (filename, PM_PACORIG)):
|
if not os.path.isfile("%s.pacorig" % filename):
|
||||||
success = 0
|
success = 0
|
||||||
elif case == "PACSAVE":
|
elif case == "PACSAVE":
|
||||||
if not os.path.isfile("%s%s" % (filename, PM_PACSAVE)):
|
if not os.path.isfile("%s.pacsave" % filename):
|
||||||
success = 0
|
success = 0
|
||||||
else:
|
else:
|
||||||
print "FILE rule '%s' not found" % case
|
print "FILE rule '%s' not found" % case
|
||||||
|
@ -29,9 +29,6 @@ PM_SYNCDBPATH = "var/lib/pacman/sync"
|
|||||||
PM_LOCK = "var/lib/pacman/db.lck"
|
PM_LOCK = "var/lib/pacman/db.lck"
|
||||||
PM_CACHEDIR = "var/cache/pacman/pkg"
|
PM_CACHEDIR = "var/cache/pacman/pkg"
|
||||||
PM_EXT_PKG = ".pkg.tar.gz"
|
PM_EXT_PKG = ".pkg.tar.gz"
|
||||||
PM_PACNEW = ".pacnew"
|
|
||||||
PM_PACORIG = ".pacorig"
|
|
||||||
PM_PACSAVE = ".pacsave"
|
|
||||||
|
|
||||||
# Pacman
|
# Pacman
|
||||||
PACCONF = "etc/pacman.conf"
|
PACCONF = "etc/pacman.conf"
|
||||||
|
Loading…
Reference in New Issue
Block a user