mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-21 23:38:49 -05:00
pmrule.py: add FILE_CONTENTS rule
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
23f128ad5e
commit
e03fa67445
@ -303,6 +303,7 @@ its DEPENDS field.
|
||||
|
||||
. FILE rules
|
||||
|
||||
FILE_CONTENTS=path/to/file|contents
|
||||
FILE_EXIST=path/to/file
|
||||
FILE_EMPTY=path/to/file
|
||||
FILE_MODIFIED=path/to/file
|
||||
|
@ -120,6 +120,12 @@ class pmrule(object):
|
||||
if not (os.path.isfile(filename)
|
||||
and os.path.getsize(filename) == 0):
|
||||
success = 0
|
||||
elif case == "CONTENTS":
|
||||
try:
|
||||
with open(filename, 'r') as f:
|
||||
success = f.read() == value
|
||||
except:
|
||||
success = 0
|
||||
elif case == "MODIFIED":
|
||||
for f in test.files:
|
||||
if f.name == key:
|
||||
|
Loading…
Reference in New Issue
Block a user