diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2015-11-12 01:19:57 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-11-28 07:23:08 +0100 |
commit | e03fa67445f9d7bd6a45c0f4094b08d46496008b (patch) | |
tree | 8f10bb24d04dea1d81702fb1b3396188ab2ada22 /test | |
parent | 23f128ad5e2b26733376d16f5095d36085a97747 (diff) | |
download | pacman-e03fa67445f9d7bd6a45c0f4094b08d46496008b.tar.gz pacman-e03fa67445f9d7bd6a45c0f4094b08d46496008b.tar.xz |
pmrule.py: add FILE_CONTENTS rule
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/pacman/README | 1 | ||||
-rw-r--r-- | test/pacman/pmrule.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/test/pacman/README b/test/pacman/README index 6c601b2f..a5fdeaad 100644 --- a/test/pacman/README +++ b/test/pacman/README @@ -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 diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py index 3bcac86a..f8991fd0 100644 --- a/test/pacman/pmrule.py +++ b/test/pacman/pmrule.py @@ -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: |