Re: need some help!
Basem Narmok <[email protected]> Tue, 22 Mar 2005 11:16:54 +0200
| Newsgroups | gmane.linux.redhat.rpm.python |
|---|---|
| Message-ID | <[email protected]> |
Panu Matilainen wrote:
>
> There's no package "foo" installed? This certainly works for me on
> rhel 4 and others:
>
> ---
> #!/usr/bin/python
>
> import rpm
> import sys
>
> ts = rpm.TransactionSet()
>
> mi=ts.dbMatch("name",sys.argv[1])
> for hdr in mi:
> print "%s-%s-%s" % (hdr["name"], hdr["version"], hdr["release"])
> ---
>
> [pmatilai@localhost ~]$ ./pytest.py kernel
> kernel-2.6.9-5.0.3.EL
>
> - Panu -
ya that works, but when I use:#!/usr/bin/python
rpm.addMacro("_dbpath", "/usr/lib/rpmdb/i386-redhat-linux/redhat")
ts = rpm.TransactionSet()
ts.openDB()
rpm.delMacro("_dbpath")
mi=ts.dbMatch("name",sys.argv[1])
for hdr in mi:
print "%s-%s-%s" % (hdr["name"], hdr["version"], hdr["release"])
it doesn't !!
Basem