RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/rpmio/ rpmmtree.c rpm/tools/ rpmmtree.c

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 16 Jun 2008 - 11:52:41 CEST
Message-id: <ED2412A0-78D8-4EDB-B8EE-2F78D58F4E34@mac.com>
Oooh, thank you. The broken <sys/queue.h> in older glibc has already
appeared as a portabbility problem on the rpm-4_5 branch with PLD.

Meanwhile tools/rpmmtree.c, rather than rpmio/rpmmtree.c change is  
needed.

The only reason I haven't nuked the confusing copy is that I'm  
conflicted
about whether I should leave rpmmtree standalone or should I attempt
an rpmio API. I can go either way, but much of the *BSD library routines
should be either rewritten or (alternatively( stuck in misc if an API  
is desired.

I plan to generate mtree specs directly from packages for indepndent
external verification of rpm installs, including SELinux and othe  
xattrs. That
work is about half complete, was hampered by build in rpmio/ rather  
than tools/.

73 de Jeff

On Jun 16, 2008, at 5:41 AM, Ralf S. Engelschall wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Ralf S. Engelschall
>   Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
>   Module: rpm                              Date:   16-Jun-2008  
> 11:41:28
>   Branch: HEAD                             Handle: 2008061609412701
>
>   Modified files:
>     rpm                     CHANGES
>     rpm/rpmio               rpmmtree.c
>     rpm/tools               rpmmtree.c
>
>   Log:
>     Fix portability by providing own RPM_LIST_XXX macros in  
> rpmmtree.c.
>     This fixes building under non-BSD platforms, including SUSE  
> SLES 10
>     where <sys/queue.h> does not provide a full-featured LIST_XXX  
> macro
>     set and this way RPM failed to build under this platform, too.
>
>   Summary:
>     Revision    Changes     Path
>     1.2417      +1  -0      rpm/CHANGES
>     1.41        +26 -7      rpm/rpmio/rpmmtree.c
>     2.2         +26 -7      rpm/tools/rpmmtree.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2416 -r1.2417 CHANGES
>   --- rpm/CHANGES	16 Jun 2008 08:36:52 -0000	1.2416
>   +++ rpm/CHANGES	16 Jun 2008 09:41:27 -0000	1.2417
>   @@ -1,5 +1,6 @@
>
>    5.1.0 -> 5.2a0:
>   +    - rse: fix portability by providing own RPM_LIST_XXX macros  
> in rpmmtree.c
>        - jbj: fix: RPMTAG_SIZE is incorrect with %exclude and % 
> ghost directives
>    	(Alexey Tourbin<at@altlinux.ru>).
>        - jbj: fix: Install-Size: spewage in Kb, not bytes. everone  
> gotta be different.
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmio/rpmmtree.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.40 -r1.41 rpmmtree.c
>   --- rpm/rpmio/rpmmtree.c	25 Mar 2008 09:20:44 -0000	1.40
>   +++ rpm/rpmio/rpmmtree.c	16 Jun 2008 09:41:28 -0000	1.41
>   @@ -50,7 +50,6 @@
>    #endif
>
>    #if defined(__linux__)
>   -#include <sys/queue.h>		/* XXX LIST_ENTRY (needs to be removed) */
>    #define	st_mtimespec	st_mtim
>    #endif
>
>   @@ -70,6 +69,26 @@
>    #include <rpmts.h>
>    #endif
>
>   +#define	RPM_LIST_HEAD(name, type) \
>   +    struct name { struct type *lh_first; }
>   +#define	RPM_LIST_ENTRY(type) \
>   +    struct { struct type *le_next;struct type **le_prev; }
>   +#define RPM_LIST_EMPTY(head) \
>   +    ((head)->lh_first == NULL)
>   +#define RPM_LIST_FIRST(head) \
>   +    ((head)->lh_first)
>   +#define	RPM_LIST_NEXT(elm, field) \
>   +    ((elm)->field.le_next)
>   +#define	RPM_LIST_INIT(head) \
>   +    do { RPM_LIST_FIRST((head)) = NULL; } while (0)
>   +#define	RPM_LIST_INSERT_HEAD(head, elm, field) \
>   +    do { if ((RPM_LIST_NEXT((elm), field) = RPM_LIST_FIRST 
> ((head))) != NULL) \
>   +        RPM_LIST_FIRST((head))->field.le_prev = &RPM_LIST_NEXT 
> ((elm), field);\
>   +    RPM_LIST_FIRST((head)) = (elm); \
>   +    (elm)->field.le_prev = &RPM_LIST_FIRST((head)); } while (0)
>   +#define RPM_LIST_FOREACH(var, head, field) \
>   +    for ((var) = RPM_LIST_FIRST((head)); (var); (var) =  
> RPM_LIST_NEXT((var), field))
>   +
>    #define	_MTREE_INTERNAL
>    /*==============================================================*/
>
>   @@ -265,15 +284,15 @@
>    /*@unchecked@*/
>    static enum mtreeFlags_e mtreeFlags = MTREE_FLAGS_NONE;
>
>   -/* XXX merge into _rpmfts, use mmiRE instead, get rid of goofy  
> LIST_ENTRY */
>   +/* XXX merge into _rpmfts, use mmiRE instead */
>    struct exclude {
>   -    LIST_ENTRY(exclude) link;
>   +    RPM_LIST_ENTRY(exclude) link;
>        const char *glob;
>        int pathname;
>    };
>
>    /*@unchecked@*/
>   -static LIST_HEAD(, exclude) excludes;
>   +static RPM_LIST_HEAD(, exclude) excludes;
>
>    /*@unchecked@*/
>    static struct rpmop_s dc_totalops;
>   @@ -2779,7 +2798,7 @@
>    	e->glob = xstrdup(line);
>    	e->pathname = (strchr(line, '/') != NULL ? 1 : 0);
>    /*@-immediatetrans@*/
>   -	LIST_INSERT_HEAD(&excludes, e, link);
>   +	RPM_LIST_INSERT_HEAD(&excludes, e, link);
>    /*@=immediatetrans@*/
>        }
>        if (fd != NULL)
>   @@ -2799,7 +2818,7 @@
>    #define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
>
>    /*@-predboolptr@*/
>   -    LIST_FOREACH(e, &excludes, link) {
>   +    RPM_LIST_FOREACH(e, &excludes, link) {
>    	if ((e->pathname && MATCH(e->glob, path)) || MATCH(e->glob,  
> fname))
>    	    return 1;
>        }
>   @@ -3668,7 +3687,7 @@
>
>        __progname = "rpmmtree";
>
>   -    LIST_INIT(&excludes);
>   +    RPM_LIST_INIT(&excludes);
>        fts->keys = KEYDEFAULT;
>        fts->maxg = 5000;
>        fts->maxu = 5000;
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/tools/rpmmtree.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r2.1 -r2.2 rpmmtree.c
>   --- rpm/tools/rpmmtree.c	2 Jun 2008 19:23:03 -0000	2.1
>   +++ rpm/tools/rpmmtree.c	16 Jun 2008 09:41:28 -0000	2.2
>   @@ -50,7 +50,6 @@
>    #endif
>
>    #if defined(__linux__)
>   -#include <sys/queue.h>		/* XXX LIST_ENTRY (needs to be removed) */
>    #define	st_mtimespec	st_mtim
>    #endif
>
>   @@ -70,6 +69,26 @@
>    #include <rpmts.h>
>    #endif
>
>   +#define	RPM_LIST_HEAD(name, type) \
>   +    struct name { struct type *lh_first; }
>   +#define	RPM_LIST_ENTRY(type) \
>   +    struct { struct type *le_next;struct type **le_prev; }
>   +#define RPM_LIST_EMPTY(head) \
>   +    ((head)->lh_first == NULL)
>   +#define RPM_LIST_FIRST(head) \
>   +    ((head)->lh_first)
>   +#define	RPM_LIST_NEXT(elm, field) \
>   +    ((elm)->field.le_next)
>   +#define	RPM_LIST_INIT(head) \
>   +    do { RPM_LIST_FIRST((head)) = NULL; } while (0)
>   +#define	RPM_LIST_INSERT_HEAD(head, elm, field) \
>   +    do { if ((RPM_LIST_NEXT((elm), field) = RPM_LIST_FIRST 
> ((head))) != NULL) \
>   +        RPM_LIST_FIRST((head))->field.le_prev = &RPM_LIST_NEXT 
> ((elm), field);\
>   +    RPM_LIST_FIRST((head)) = (elm); \
>   +    (elm)->field.le_prev = &RPM_LIST_FIRST((head)); } while (0)
>   +#define RPM_LIST_FOREACH(var, head, field) \
>   +    for ((var) = RPM_LIST_FIRST((head)); (var); (var) =  
> RPM_LIST_NEXT((var), field))
>   +
>    #define	_MTREE_INTERNAL
>    /*==============================================================*/
>
>   @@ -265,15 +284,15 @@
>    /*@unchecked@*/
>    static enum mtreeFlags_e mtreeFlags = MTREE_FLAGS_NONE;
>
>   -/* XXX merge into _rpmfts, use mmiRE instead, get rid of goofy  
> LIST_ENTRY */
>   +/* XXX merge into _rpmfts, use mmiRE instead */
>    struct exclude {
>   -    LIST_ENTRY(exclude) link;
>   +    RPM_LIST_ENTRY(exclude) link;
>        const char *glob;
>        int pathname;
>    };
>
>    /*@unchecked@*/
>   -static LIST_HEAD(, exclude) excludes;
>   +static RPM_LIST_HEAD(, exclude) excludes;
>
>    /*@unchecked@*/
>    static struct rpmop_s dc_totalops;
>   @@ -2779,7 +2798,7 @@
>    	e->glob = xstrdup(line);
>    	e->pathname = (strchr(line, '/') != NULL ? 1 : 0);
>    /*@-immediatetrans@*/
>   -	LIST_INSERT_HEAD(&excludes, e, link);
>   +	RPM_LIST_INSERT_HEAD(&excludes, e, link);
>    /*@=immediatetrans@*/
>        }
>        if (fd != NULL)
>   @@ -2799,7 +2818,7 @@
>    #define MATCH(g, n) (fnmatch((g), (n), FNM_PATHNAME) == 0)
>
>    /*@-predboolptr@*/
>   -    LIST_FOREACH(e, &excludes, link) {
>   +    RPM_LIST_FOREACH(e, &excludes, link) {
>    	if ((e->pathname && MATCH(e->glob, path)) || MATCH(e->glob,  
> fname))
>    	    return 1;
>        }
>   @@ -3668,7 +3687,7 @@
>
>        __progname = "rpmmtree";
>
>   -    LIST_INIT(&excludes);
>   +    RPM_LIST_INIT(&excludes);
>        fts->keys = KEYDEFAULT;
>        fts->maxg = 5000;
>        fts->maxu = 5000;
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Mon Jun 16 11:54:09 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.