pmrule: add FILE_EMPTY rule
Succeeds if the specified path is a file and is empty. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
1601532a53
commit
4763341ea1
|
@ -299,6 +299,7 @@ its DEPENDS field.
|
||||||
. FILE rules
|
. FILE rules
|
||||||
|
|
||||||
FILE_EXIST=path/to/file
|
FILE_EXIST=path/to/file
|
||||||
|
FILE_EMPTY=path/to/file
|
||||||
FILE_MODIFIED=path/to/file
|
FILE_MODIFIED=path/to/file
|
||||||
FILE_MODE=path/to/file|octal
|
FILE_MODE=path/to/file|octal
|
||||||
FILE_TYPE=path/to/file|type (possible types: dir, file, link)
|
FILE_TYPE=path/to/file|type (possible types: dir, file, link)
|
||||||
|
|
|
@ -112,6 +112,10 @@ def check(self, test):
|
||||||
if case == "EXIST":
|
if case == "EXIST":
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
success = 0
|
success = 0
|
||||||
|
elif case == "EMPTY":
|
||||||
|
if not (os.path.isfile(filename)
|
||||||
|
and os.path.getsize(filename) == 0):
|
||||||
|
success = 0
|
||||||
elif case == "MODIFIED":
|
elif case == "MODIFIED":
|
||||||
for f in test.files:
|
for f in test.files:
|
||||||
if f.name == key:
|
if f.name == key:
|
||||||
|
|
Loading…
Reference in New Issue