RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/python/ rpmmodule.c rpm/rpmdb/ hdrfmt.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 24 Nov 2007 - 21:11:36 CET
Message-Id: <20071124201136.DF02034844E@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   24-Nov-2007 21:11:36
  Branch: HEAD                             Handle: 2007112420113600

  Modified files:
    rpm                     CHANGES
    rpm/python              rpmmodule.c
    rpm/rpmdb               hdrfmt.c

  Log:
    - python: hmmm, add header extensions to dictionary correctly.
    - terminate on headerTagTable sentinel, don't use rpmTagTableSize.

  Summary:
    Revision    Changes     Path
    1.1883      +2  -0      rpm/CHANGES
    1.157       +11 -8      rpm/python/rpmmodule.c
    1.40        +1  -6      rpm/rpmdb/hdrfmt.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1882 -r1.1883 CHANGES
  --- rpm/CHANGES	24 Nov 2007 19:46:05 -0000	1.1882
  +++ rpm/CHANGES	24 Nov 2007 20:11:36 -0000	1.1883
  @@ -1,4 +1,6 @@
   5.0a2 -> 5.0a3:
  +    - jbj: python: hmmm, add header extensions to dictionary correctly.
  +    - jbj: terminate on headerTagTable sentinel, don't use rpmTagTableSize.
       - jbj: use NULL default, not rpmTagTable, arg to headerSprintf everywhere.
       - jbj: hdrfmt.c: relocate (and extend) rpmDisplayQueryTags.
       - jbj: add tag{Clean,Name,Value,Type} methods to librpmdb.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/rpmmodule.c
  ============================================================================
  $ cvs diff -u -r1.156 -r1.157 rpmmodule.c
  --- rpm/python/rpmmodule.c	24 Nov 2007 17:18:57 -0000	1.156
  +++ rpm/python/rpmmodule.c	24 Nov 2007 20:11:36 -0000	1.157
  @@ -336,25 +336,28 @@
   
       dict = PyDict_New();
   
  -    for (i = 0; i < rpmTagTableSize; i++) {
  -	tag = PyInt_FromLong(rpmTagTable[i].val);
  -	PyDict_SetItemString(d, (char *) rpmTagTable[i].name, tag);
  -	Py_DECREF(tag);
  -        PyDict_SetItem(dict, tag, o=PyString_FromString(rpmTagTable[i].name + 7));
  + {  const struct headerTagTableEntry_s * t;
  +    PyObject * to;
  +    for (t = rpmTagTable; t && t->name; t++) {
  +	PyDict_SetItemString(d, (char *) t->name, to=PyInt_FromLong(t->val));
  +	Py_DECREF(to);
  +        PyDict_SetItem(dict, to, o=PyString_FromString(t->name + 7));
   	Py_DECREF(o);
       }
  + }
   
    {  headerSprintfExtension exts = rpmHeaderFormats;
       headerSprintfExtension ext;
  +    PyObject * to;
       int extNum;
       for (ext = exts, extNum = 0; ext != NULL && ext->type != HEADER_EXT_LAST;
           ext = (ext->type == HEADER_EXT_MORE ? *ext->u.more : ext+1), extNum++)
       {
   	if (ext->name == NULL || ext->type != HEADER_EXT_TAG)
   	    continue;
  -	PyDict_SetItemString(d, (char *) ext->name, o=PyCObject_FromVoidPtr((void *)ext, NULL));
  -	Py_DECREF(o);
  -        PyDict_SetItem(dict, tag, o=PyString_FromString(ext->name + 7));
  +	PyDict_SetItemString(d, (char *) ext->name, to=PyCObject_FromVoidPtr((void *)ext, NULL));
  +	Py_DECREF(to);
  +        PyDict_SetItem(dict, to, o=PyString_FromString(ext->name + 7));
   	Py_DECREF(o);
       }
    }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrfmt.c
  ============================================================================
  $ cvs diff -u -r1.39 -r1.40 hdrfmt.c
  --- rpm/rpmdb/hdrfmt.c	24 Nov 2007 19:46:07 -0000	1.39
  +++ rpm/rpmdb/hdrfmt.c	24 Nov 2007 20:11:36 -0000	1.40
  @@ -1397,7 +1397,6 @@
       headerSprintfExtension exts;
       headerSprintfExtension ext;
       int extNum;
  -    int i;
   
       if (fp == NULL)
   	fp = stdout;
  @@ -1408,13 +1407,9 @@
       if (_rpmHeaderFormats == NULL)
   	_rpmHeaderFormats = headerCompoundFormats;
   
  -/* XXX FIXME: don't use rpmTagTableSize here. */
  -assert(_rpmTagTable == rpmTagTable);
  -    for (i = 0, t = _rpmTagTable; i < rpmTagTableSize; i++, t++) {
  +    for (t = _rpmTagTable; t && t->name; t++) {
   	uint32_t ttype;
   
  -	if (t->name == NULL)
  -	    continue;
   	if (rpmIsVerbose()) {
   	    /*@observer@*/
   	    static const char * tagtypes[] = {
  @@ .
Received on Sat Nov 24 21:11:36 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.