1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-29 17:34:12 +02:00

- added the following new modules:

* util/packagequery.py: it's used to query a RPM or DEB package. It also contains a
    base class for all package types (PackageQuery())
  * util/debquery.py: query a DEB package (name, version, release, provides, requires etc.)
- adapted util/rpmquery.py to use PackageQuery() as a base class
- minor changes in util/ar.py
This commit is contained in:
Marcus Hüwe
2009-09-12 19:02:58 +00:00
parent 572b790345
commit 4bb893a114
5 changed files with 186 additions and 11 deletions

View File

@@ -1,10 +1,9 @@
import os
import sys
import struct
import packagequery
class RpmError(Exception):
def __init__(self, msg):
self.msg = msg
class RpmError(packagequery.PackageError):
pass
class RpmHeaderError(RpmError):
pass
@@ -45,7 +44,7 @@ class RpmHeaderEntry():
self.count = count
self.data = None
class RpmQuery():
class RpmQuery(packagequery.PackageQuery):
LEAD_SIZE = 96
LEAD_MAGIC = 0xedabeedb
HEADER_MAGIC = 0x8eade801
@@ -211,10 +210,12 @@ def unpack_string(data):
return val
if __name__ == '__main__':
import sys
try:
rpmq = RpmQuery.query(sys.argv[1])
except RpmError, e:
print e.msg
sys.exit(2)
print rpmq.name(), rpmq.version(), rpmq.release(), rpmq.arch(), rpmq.url()
print rpmq.summary()
print rpmq.description()