[Rpm-metadata] Is there an easy way to get a simple dict of rpm attributes from xml metadata?

Hans-Peter Jansen hpj at urpla.net
Sat Apr 16 22:10:27 UTC 2005


Saturday 16 April 2005 23:21, seth vidal wrote:
>
> Well it depends on what you're trying to do but you could always just:
> import yum
> foo = yum.YumBase()
> foo.doConfigSetup()
> foo.doRepoSetup()
> foo.doSackSetup()
>
> foo.pkgSack is a package Sack object and it's filled with PackageObject
> instances.
>
> then you can just do:
>
> for pkg in foo.pkgSack:
>     print pkg.returnSimple('description')
>     print dir(pkg)

Unfortunately, only root can do that with yum 2.3.2 here, as user,
I get:

Python 2.4 (#1, Mar 22 2005, 21:42:42) 
[GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import yum
>>> foo = yum.YumBase()
>>> foo.doConfigSetup()
>>> foo.doRepoSetup()
Baseurl(s) for repo: ['file:/net/xxx/opt/suse/i386/9.3/cd1']
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 216, in doRepoSetup
    
  File "repos.py", line 628, in getRepoXML
  File "repos.py", line 605, in get
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 414, in urlgrab
    return self._mirror_try(func, url, kw)
  File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 400, in _mirror_try
    return func_ref( *(fullurl,), **kwargs )
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 618, in urlgrab
    return self._retry(opts, retryfunc, url, filename)
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 547, in _retry
    return apply(func, (opts,) + args, {})
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 606, in retryfunc
    fo._do_grab()
  File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 908, in _do_grab
    else: new_fo = open(self.filename, 'wb')
IOError: [Errno 13] Permission denied: '//var/cache/yum/base1/repomd.xml'

Is that to be expected, Seth?

urlgrabber is version 2.9.6, btw..

Apart from this, yum does really nice here on SuSE 9.3 ;)

No excessive memory hogging any more like in 2.0 times, and it feels
fast, man..

Pete



More information about the Rpm-metadata mailing list