summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2014-01-31 12:49:54 +0200
committerPanu Matilainen <pmatilai@redhat.com>2014-01-31 12:49:54 +0200
commit2498f1caa0ec7ff58d9fdd6ff3d5cb416ac6786e (patch)
tree74044b34cb470c824f611a8ca9d1290789328b23 /tests
parentee237ffdd98de8f0202f3db6c3b42bba05836078 (diff)
downloadrpm-2498f1caa0ec7ff58d9fdd6ff3d5cb416ac6786e.tar.gz
Add python bindings + a testcase for the archive API
- Wouldn't be surprised in the slightest if various details here changed before an actual release, but its a start. - Simple testcase showing spec file extraction from an src.rpm. Which also goes to show just how low-level our APIs are...
Diffstat (limited to 'tests')
-rw-r--r--tests/rpmpython.at22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/rpmpython.at b/tests/rpmpython.at
index 1d975a75d..9b560090b 100644
--- a/tests/rpmpython.at
+++ b/tests/rpmpython.at
@@ -345,3 +345,25 @@ P bar = 2.0
P bar = 2.0
],
[])
+
+RPMPY_TEST([archive 1],[
+import hashlib
+ts = rpm.ts()
+fd = rpm.fd.open('${RPMDATA}/SRPMS/hello-1.0-1.src.rpm')
+h = ts.hdrFromFdno(fd)
+payload = rpm.fd.open(fd, flags=h['payloadcompressor'])
+files = rpm.files(h)
+archive = files.archive(payload)
+for f in archive:
+ if not f.fflags & rpm.RPMFILE_SPECFILE:
+ continue
+ spec = archive.read()
+ hash = hashlib.md5(spec)
+ if f.digest != hash.hexdigest():
+ myprint('%s should be %s' % (hash.hexdigest(), f.digest))
+ break
+],
+[],
+[])
+
+