[Yum] RPM Header Info..

Nick Urbanik nicku at vtc.edu.hk
Wed Dec 17 19:51:15 UTC 2003

Dear Folks,

seth vidal wrote:

> > First post and I'm completely new to YUM, but as I'm learning I'm also
> > documenting my every step as I migrate from RHN to YUM.
> >
> > Anyhow.. for the sake of documentation I am trying to 'illustrate' how YUM
> > 'works..
> >
> > And, as I'm reading the 'How it Works' info on the website I'm curious
> > about the following line
> >
> > <snip>
> > Every rpm has a header. That header contains a complete file list,
> > package descriptions, lists of what features/libs it provides, lists of
> > what it requires, what it conflicts with etc. In order for rpm to make a
> > decision about what an rpm will need to be installed it needs the
> > information in the header.
> > </snip>
> >
> > My question is.. how can I view this 'header'?  How can I see exactly what
> > YUM see's when it determines what dependencies and such?  I imagine this
> > is a simple RPM command?
> >
> You know all the stuff you see when you do an rpm -qi [somepackage] or
> rpm -ql [somepackage] that comes from the header. there is lots of
> information in there.
> If you want to read the header yourself you can import it in python and
> run something like:
> for key in hdr.keys():
>     print hdr[key]

After trying to import mach-0-0.4.3-1.fr.i386.hdr, then doing
zcat mach-0-0.4.3-1.fr.i386.hdr > mach.py, and also mach.pyc, I failed to
import the header:
$ python
Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
[GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mach
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: Bad magic number in mach.pyc
Now I tried to learn enough python by reading the source, but still haven't
figured out how.  Sorry to be so slow.

Please give me a clue as to how to do this.  I just want to write a very simple
utility to show the contents of headers, so I can do
showheader mach-0-0.4.3-1.fr.i386.hdr
instead of
sudo yum install mach
rpm -qi mach
sudo yum remove mach

Nick Urbanik   RHCE                               nicku(at)vtc.edu.hk
Dept. of Information & Communications Technology
Hong Kong Institute of Vocational Education (Tsing Yi)
Tel:   (852) 2436 8576, (852) 2436 8713          Fax: (852) 2436 8526
PGP: 53 B6 6D 73 52 EE 1F EE EC F8 21 98 45 1C 23 7B     ID: 7529555D
GPG: 7FFA CDC7 5A77 0558 DC7A 790A 16DF EC5B BB9D 2C24   ID: BB9D2C24

More information about the Yum mailing list