RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   23-May-2008 18:26:20
  Branch: HEAD                             Handle: 2008052316261900

  Modified files:
    rpm                     CHANGES
    rpm/rpmdb               librpmdb.vers rpmdb.c rpmdb.h

  Log:
    - jbj: debuginfo: add general rpmdbCount() to get number of items for
        any tag index, not just RPMTAG_NAME as was in rpmdbCountPackages().

  Summary:
    Revision    Changes     Path
    1.2362      +2  -0      rpm/CHANGES
    1.47        +1  -0      rpm/rpmdb/librpmdb.vers
    1.251       +14 -6      rpm/rpmdb/rpmdb.c
    1.74        +14 -1      rpm/rpmdb/rpmdb.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2361 -r1.2362 CHANGES
  --- rpm/CHANGES       23 May 2008 16:23:09 -0000      1.2361
  +++ rpm/CHANGES       23 May 2008 16:26:19 -0000      1.2362
  @@ -1,5 +1,7 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: debuginfo: add general rpmdbCount() to get number of items for
  +     any tag index, not just RPMTAG_NAME as was in rpmdbCountPackages().
       - jbj: add --with-openssl to devtool system target to enable the ssl
        digital signature implementation in rpmio/rpmssl.c at runtime.
       - jbj: rpmte: add rpmteSourcerpm() (for use as a -debuginfo buildset 
key).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/librpmdb.vers
  ============================================================================
  $ cvs diff -u -r1.46 -r1.47 librpmdb.vers
  --- rpm/rpmdb/librpmdb.vers   18 May 2008 02:19:03 -0000      1.46
  +++ rpm/rpmdb/librpmdb.vers   23 May 2008 16:26:19 -0000      1.47
  @@ -86,6 +86,7 @@
       rpmdbClose;
       rpmdbBlockDBI;
       rpmdbCloseDBI;
  +    rpmdbCount;
       rpmdbCountPackages;
       rpmdbFindFpList;
       rpmdbFreeIterator;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.c
  ============================================================================
  $ cvs diff -u -r1.250 -r1.251 rpmdb.c
  --- rpm/rpmdb/rpmdb.c 18 May 2008 02:03:12 -0000      1.250
  +++ rpm/rpmdb/rpmdb.c 23 May 2008 16:26:19 -0000      1.251
  @@ -1574,8 +1574,7 @@
       return 0;
   }
   
  -/* XXX python/upgrade.c, install.c, uninstall.c */
  -int rpmdbCountPackages(rpmdb db, const char * name)
  +int rpmdbCount(rpmdb db, rpmTag tag, const void * keyp, size_t keylen)
   {
   DBC * dbcursor = NULL;
   DBT * key = alloca(sizeof(*key));
  @@ -1584,20 +1583,23 @@
       int rc;
       int xx;
   
  -    if (db == NULL)
  +    if (db == NULL || keyp == NULL)
        return 0;
   
   memset(key, 0, sizeof(*key));
   memset(data, 0, sizeof(*data));
   
  -    dbi = dbiOpen(db, RPMTAG_NAME, 0);
  +    dbi = dbiOpen(db, tag, 0);
       if (dbi == NULL)
        return 0;
   
  +    if (keylen == 0)
  +     keylen = strlen(keyp);
  +
   /[EMAIL PROTECTED]@*/
  -key->data = (void *) name;
  +key->data = (void *) keyp;
   /[EMAIL PROTECTED]@*/
  -key->size = (UINT32_T) strlen(name);
  +key->size = (UINT32_T) keylen;
   
       xx = dbiCopen(dbi, dbi->dbi_txnid, &dbcursor, 0);
       rc = dbiGet(dbi, dbcursor, key, data, DB_SET);
  @@ -1634,6 +1636,12 @@
       return rc;
   }
   
  +/* XXX python/upgrade.c, install.c, uninstall.c */
  +int rpmdbCountPackages(rpmdb db, const char * name)
  +{
  +    return rpmdbCount(db, RPMTAG_NAME, name, 0);
  +}
  +
   /**
    * Attempt partial matches on name[-version[-release]] strings.
    * @param dbi                index database handle (always RPMTAG_NAME)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/rpmdb.h
  ============================================================================
  $ cvs diff -u -r1.73 -r1.74 rpmdb.h
  --- rpm/rpmdb/rpmdb.h 8 Feb 2008 11:41:23 -0000       1.73
  +++ rpm/rpmdb/rpmdb.h 23 May 2008 16:26:19 -0000      1.74
  @@ -1004,7 +1004,20 @@
   /[EMAIL PROTECTED]@*/
   
   /** \ingroup rpmdb
  - * Return number of instances of package in rpm database.
  + * Return number of instances of key in a tag index.
  + * @param db         rpm database
  + * @param tag                rpm tag
  + * @param keyp               key data
  + * @param keylen     key data length (0 will use strlen(keyp))
  + * @return           number of instances
  + */
  +int rpmdbCount(/[EMAIL PROTECTED]@*/ rpmdb db, rpmTag tag,
  +             const void * keyp, size_t keylen)
  +     /[EMAIL PROTECTED] rpmGlobalMacroContext, h_errno, fileSystem, 
internalState @*/
  +     /[EMAIL PROTECTED] db, rpmGlobalMacroContext, fileSystem, internalState 
@*/;
  +
  +/** \ingroup rpmdb
  + * Return number of instances of package in Name index.
    * @param db         rpm database
    * @param name               rpm package name
    * @return           number of instances
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to