Re: Accessing changelog info
Brad Smith <[email protected]> Sun, 25 Jul 2004 20:24:55 -0400
| Newsgroups | gmane.linux.redhat.rpm.python |
|---|---|
| Organization | Red Hat |
| Message-ID | <[email protected]> |
--===============51478671052386349== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-IZr0A1+AM0jD7v8q7b0M" --=-IZr0A1+AM0jD7v8q7b0M Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2004-07-25 at 18:04, Alan Sparks wrote: > Can someone provide a reference how to access the "changelog" > information using the rpm module? I see that accessing the header > CHANGELOGTEXT, CHANGELOGNAME, etc attributes return lists of data, but I > cannot see how to correlate the text/name/date lists. >=20 > Thanks for any pointers. Unless I'm mistaken it should be as simple as: changelogtime[X] + changelogname[X] + changelogtext[X] =3D Line X of the changelog. Below I've cut-and-pasted a snippet from Fedora Tracker (starting at line 352 of repo.py), which stores each package's changelog as a single string. There is one gotcha to this, described in the comments. Hope this helps, --Brad P.S. I'm not a python or rpm guru, so if I'm doing anything stupid here, let me know. =3D;) --------------------------------------------------------------- if hdr['changelogtext'] and hdr['changelogname']: self.changelog =3D "" for clidx in range(0,len(hdr['changelogtext'])): # I've seen yum headers where changelogs with a single entry have the tim= estamp (but not the other stuff) # stored as a string instead of a list. Tres annoying. =3D:\ try: # Generates 'TypeError' exception on string len(hdr['changelogtime']) timestamp =3D time.ctime(hdr['changelogtime'][clidx]) except TypeError: timestamp =3D time.ctime(hdr['changelogtime']) =09 self.changelog =3D self.changelog+"* %s - %s\n%s\n\n" % (timestamp,hdr['c= hangelogname'][clidx],hdr['changelogtext'][clidx]) --=-IZr0A1+AM0jD7v8q7b0M Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQBBBE9XDvp49DvQ8kcRAkSYAJ9+D+BVQ+KDKFA0LgFAtEB7VPICDQCfQb95 VWdDg/IwHrsRaoVNpALPxu0= =ZrA7 -----END PGP SIGNATURE----- --=-IZr0A1+AM0jD7v8q7b0M-- --===============51478671052386349== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Rpm-python-list mailing list Rpm-python-list-cunTk1MwBs9zPNxIf5reH/[email protected] https://lists.dulug.duke.edu/mailman/listinfo/rpm-python-list --===============51478671052386349==--