RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ rpmgi.c rpm/perl/ RPM_Header.xs rpm/p...

From: Jeff Johnson <jbj@rpm5.org>
Date: Wed 21 Nov 2007 - 01:25:05 CET
Message-Id: <20071121002505.05A1D34845C@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:   21-Nov-2007 01:25:05
  Branch: HEAD                             Handle: 2007112100250301

  Modified files:
    rpm                     CHANGES
    rpm/lib                 rpmgi.c
    rpm/perl                RPM_Header.xs
    rpm/python              header-py.c
    rpm/rpmdb               hdrinline.h pkgio.c

  Log:
    - jbj: convert+remove headerRead() from the API, use rpmpkgRead
    instead.

  Summary:
    Revision    Changes     Path
    1.1860      +1  -0      rpm/CHANGES
    2.41        +9  -1      rpm/lib/rpmgi.c
    1.13        +12 -1      rpm/perl/RPM_Header.xs
    1.79        +35 -5      rpm/python/header-py.c
    1.35        +0  -12     rpm/rpmdb/hdrinline.h
    1.48        +12 -0      rpm/rpmdb/pkgio.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1859 -r1.1860 CHANGES
  --- rpm/CHANGES	20 Nov 2007 23:50:55 -0000	1.1859
  +++ rpm/CHANGES	21 Nov 2007 00:25:03 -0000	1.1860
  @@ -1,4 +1,5 @@
   5.0a2 -> 5.0a3:
  +    - jbj: convert+remove headerRead() from the API, use rpmpkgRead instead.
       - jbj: rebase rpmParseState_e +256 to permit rpmRC to be returned too.
       - jbj: remove headerWrite() from the public API, use rpmpkgWrite instead.
       - jbj: convert last headerWrite to use rpmpkgWrite instead.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmgi.c
  ============================================================================
  $ cvs diff -u -r2.40 -r2.41 rpmgi.c
  --- rpm/lib/rpmgi.c	19 Nov 2007 18:57:54 -0000	2.40
  +++ rpm/lib/rpmgi.c	21 Nov 2007 00:25:04 -0000	2.41
  @@ -672,7 +672,15 @@
   	    path = _free(path);
   	}
   	if (gi->fd != NULL) {
  -	    Header h = headerRead(gi->fd);
  +	    Header h = NULL;
  +	    const char item[] = "Header";
  +	    const char * msg = NULL;
  +	    rpmrc = rpmpkgRead(item, gi->fd, &h, &msg);
  +	    if (rpmrc != RPMRC_OK) {
  +		rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +		h = NULL;
  +	    }
  +	    msg = _free(msg);
   	    if (h != NULL) {
   		if (!(gi->flags & RPMGI_NOHEADER))
   		    gi->h = headerLink(h);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/perl/RPM_Header.xs
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 RPM_Header.xs
  --- rpm/perl/RPM_Header.xs	20 Nov 2007 23:02:50 -0000	1.12
  +++ rpm/perl/RPM_Header.xs	21 Nov 2007 00:25:04 -0000	1.13
  @@ -38,7 +38,18 @@
       Header header;
       PPCODE:
       if (fp && (fd = fdDup(fileno(fp)))) {
  -        while ((header = headerRead(fd))) {
  +	while (1) {
  +	    const char item[] = "Header";
  +	    const char * msg = NULL;
  +	    header = NULL;
  +	    rpmRC rc = rpmpkgRead(item, fd, &header, &msg);
  +	    if (rc != RPMRC_OK) {
  +		rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +		header = NULL;
  +	    }
  +	    msg = _free(msg);
  +	    if (header == NULL)
  +		break;
               if (callback != NULL && SvROK(callback)) {
                   ENTER;
                   SAVETMPS;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/python/header-py.c
  ============================================================================
  $ cvs diff -u -r1.78 -r1.79 header-py.c
  --- rpm/python/header-py.c	17 Nov 2007 18:11:45 -0000	1.78
  +++ rpm/python/header-py.c	21 Nov 2007 00:25:04 -0000	1.79
  @@ -692,7 +692,13 @@
   
       list = PyList_New(0);
       Py_BEGIN_ALLOW_THREADS
  -    h = headerRead(fd);
  +    {   const char item[] = "Header";
  +	const char * msg = NULL;
  +	rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  +	if (rc != RPMRC_OK)
  +	    rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +	msg = _free(msg);
  +    }
       Py_END_ALLOW_THREADS
   
       while (h) {
  @@ -707,7 +713,13 @@
   	h = headerFree(h);	/* XXX ref held by hdr */
   
   	Py_BEGIN_ALLOW_THREADS
  -	h = headerRead(fd);
  +	{   const char item[] = "Header";
  +	    const char * msg = NULL;
  +	    rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  +	    if (rc != RPMRC_OK)
  +		rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +	    msg = _free(msg);
  +	}
   	Py_END_ALLOW_THREADS
       }
   
  @@ -778,7 +790,13 @@
       int xx;
   
       Py_BEGIN_ALLOW_THREADS
  -    h = headerRead(fd);
  +    {   const char item[] = "Header";
  +	const char * msg = NULL;
  +	rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  +	if (rc != RPMRC_OK)
  +	    rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +	msg = _free(msg);
  +    }
       Py_END_ALLOW_THREADS
   
       while (h) {
  @@ -826,7 +844,13 @@
   	h = headerFree(h);
   
   	Py_BEGIN_ALLOW_THREADS
  -	h = headerRead(fd);
  +	{   const char item[] = "Header";
  +	    const char * msg = NULL;
  +	    rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  +	    if (rc != RPMRC_OK)
  +		rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +	    msg = _free(msg);
  +	}
   	Py_END_ALLOW_THREADS
       }
   
  @@ -890,7 +914,13 @@
       }
   
       Py_BEGIN_ALLOW_THREADS
  -    h = headerRead(fd);
  +    {   const char item[] = "Header";
  +	const char * msg = NULL;
  +	rpmRC rc = rpmpkgRead(item, fd, &h, &msg);
  +	if (rc != RPMRC_OK)
  +	    rpmlog(RPMLOG_ERR, "%s: %s: %s\n", "headerRead", item, msg);
  +	msg = _free(msg);
  +    }
       Py_END_ALLOW_THREADS
   
       Fclose(fd);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/hdrinline.h
  ============================================================================
  $ cvs diff -u -r1.34 -r1.35 hdrinline.h
  --- rpm/rpmdb/hdrinline.h	20 Nov 2007 23:02:50 -0000	1.34
  +++ rpm/rpmdb/hdrinline.h	21 Nov 2007 00:25:04 -0000	1.35
  @@ -192,18 +192,6 @@
   }
   
   /** \ingroup header
  - * Read (and load) header from file handle.
  - * @param _fd		file handle
  - * @return		header (or NULL on error)
  - */
  -/*@unused@*/ static inline
  -/*@null@*/ Header headerRead(void * _fd)
  -	/*@modifies _fd @*/
  -{
  -    return hdrVec->hdrread(_fd);
  -}
  -
  -/** \ingroup header
    * Check if tag is in header.
    * @param h		header
    * @param tag		tag
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmdb/pkgio.c
  ============================================================================
  $ cvs diff -u -r1.47 -r1.48 pkgio.c
  --- rpm/rpmdb/pkgio.c	20 Nov 2007 23:02:50 -0000	1.47
  +++ rpm/rpmdb/pkgio.c	21 Nov 2007 00:25:04 -0000	1.48
  @@ -53,6 +53,18 @@
   
   /*===============================================*/
   /** \ingroup header
  + * Read (and load) header from file handle.
  + * @param _fd		file handle
  + * @return		header (or NULL on error)
  + */
  +/*@unused@*/ static inline
  +/*@null@*/ Header headerRead(void * _fd)
  +	/*@modifies _fd @*/
  +{
  +    return hdrVec->hdrread(_fd);
  +}
  +
  +/** \ingroup header
    * Write (with unload) header to file handle.
    * @param _fd		file handle
    * @param h		header
  @@ .
Received on Wed Nov 21 01:25:05 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.