RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/rpmdb/ rpmevr.c

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 10 Jan 2009 - 15:41:54 CET
Message-id: <7BC4AE29-6040-47B6-A20F-DB9C80FB22D5@mac.com>
This check-in is a watershed event because RPM is now using
*RE pattern matching on a critically important internal code path.

That means that a *RE implementation (rpm is currently using PCRE)
is now MANDATORY. RPM simply will not work if an EVR string cannot be
split into a tuple using some *RE API.

Because of linkage issues with dueling symbols and -Wl,-as-needed -Wl,- 
z.relro,
that also means that supporting a external system POSIX RE interface is
likely doomed. RPM just got through internalizing glob.c to solve  
similar linkage issues,
and I currently know of no other fully general solution to the linkage  
issues
than internalizing the symbols.

Which means that RPM CVS will need to import PCRE, which I will get to  
soonishly. In
the interim, use external -lpcre.

That also means that either PCRE and ERE patterns can be used in  
future RPM development.
PCRE patterns are quite a bit easier to read imho, and I'm sure that I  
will find that
PCRE patterns are easier to write as well (whenever I get a chance to  
learn how to do so).

Since I don't wish to be supporting different and competing RPM  
implementations, I will proceed
pushing the changes all the way back to the -r rpm-4_5 branch over the  
next week/month.

In short: RPM <-> PCRE just got hitched up. I hope its a happy and  
prolific marriage.

73 de Jeff


On Jan 10, 2009, at 9:23 AM, Jeff Johnson wrote:

>  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:   10-Jan-2009 15:23:59
>  Branch: HEAD                             Handle: 2009011014235900
>
>  Modified files:
>    rpm                     CHANGES
>    rpm/rpmdb               rpmevr.c
>
>  Log:
>    - EVRtuple: eliminate the old EVR parser.
>
>  Summary:
>    Revision    Changes     Path
>    1.2732      +1  -0      rpm/CHANGES
>    1.29        +2  -69     rpm/rpmdb/rpmevr.c
>   
> ____________________________________________________________________________
>
>  patch -p0 <<'@@ .'
>  Index: rpm/CHANGES
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.2731 -r1.2732 CHANGES
>  --- rpm/CHANGES	6 Jan 2009 21:48:30 -0000	1.2731
>  +++ rpm/CHANGES	10 Jan 2009 14:23:59 -0000	1.2732
>  @@ -1,5 +1,6 @@
>
>   5.2a2 -> 5.2a3:
>  +    - jbj: EVRtuple: eliminate the old EVR parser.
>       - jbj: rpmbuild: enumerate all the lexical patterns in  
> parsePreamble().
>       - jbj: rpmbuild: enable pattern validation for simple package  
> identifiers.
>       - jbj: rpmbuild: add tag data validation pattern checks.
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/rpmdb/rpmevr.c
>   
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
>  $ cvs diff -u -r1.28 -r1.29 rpmevr.c
>  --- rpm/rpmdb/rpmevr.c	5 Jan 2009 21:09:37 -0000	1.28
>  +++ rpm/rpmdb/rpmevr.c	10 Jan 2009 14:23:59 -0000	1.29
>  @@ -133,13 +133,12 @@
>   }
>
>   /*@unchecked@*/ /*@observer@*/ /*@null@*/
>  -static const char * _evr_tuple_match = "^(?:([^:-]+):)?([^:-]+)(?:- 
> ([^:-]+))?(?::([^:-]+))?$";
>  +static const char * _evr_tuple_match =
>  +	"^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-]+))?$";
>   /*@unchecked@*/ /*@null@*/
>   static const char * evr_tuple_match = NULL;
>   /*@unchecked@*/ /*@null@*/
>   static miRE evr_tuple_mire = NULL;
>  -/*@unchecked@*/
>  -static int evr_tuple_nmire;
>
>   static miRE rpmEVRmire(void)
>   	/*@*/
>  @@ -150,63 +149,15 @@
>   	if (evr_tuple_match == NULL || evr_tuple_match[0] == '\0')
>   	    evr_tuple_match = xstrdup(_evr_tuple_match);
>
>  -#ifdef	NOTYET	/* XXX avoid need for evr_tuple_nmire */
>   	evr_tuple_mire = mireNew(RPMMIRE_REGEX, 0);
>   	xx = mireSetCOptions(evr_tuple_mire, RPMMIRE_REGEX, 0, 0, NULL);
>   	xx = mireRegcomp(evr_tuple_mire, evr_tuple_match);
>  -#else
>  -	xx = mireAppend(RPMMIRE_REGEX, 0, evr_tuple_match, NULL,
>  -		&evr_tuple_mire, &evr_tuple_nmire);
>  -#endif
>
>       }
>   assert(evr_tuple_match != NULL && evr_tuple_mire != NULL);
>       return evr_tuple_mire;
>   }
>
>  -#ifndef	DYING
>  -static int oldrpmEVRparse(const char * evrstr, EVR_t evr)
>  -	/*@modifies evrstr, evr @*/
>  -{
>  -    char *s = xstrdup(evrstr);
>  -    char *se;
>  -    char *se2;
>  -
>  -    evr->str = se = s;
>  -    se2 = se;
>  -    while (*se && xisdigit((int)*se)) se++; /* se points to epoch  
> terminator */
>  -
>  -    if (*se == ':') {
>  -	evr->F[RPMEVR_E] = s;
>  -	*se++ = '\0';
>  -	evr->F[RPMEVR_V] = se;
>  -	se2 = se;
>  -	if (*evr->F[RPMEVR_E] == '\0') evr->F[RPMEVR_E] = "0";
>  -	evr->Elong = strtoul(evr->F[RPMEVR_E], NULL, 10);
>  -    } else {
>  -	evr->F[RPMEVR_E] = NULL; /* XXX disable epoch compare if missing */
>  -	evr->F[RPMEVR_V] = s;
>  -	evr->Elong = 0;
>  -    }
>  -    se = strrchr(se, ':');		/* se points to release terminator */
>  -    if (se) {
>  -	*se++ = '\0';
>  -	evr->F[RPMEVR_D] = se;
>  -    } else {
>  -	evr->F[RPMEVR_D] = NULL;
>  -    }
>  -    se = strrchr(se2, '-');		/* se points to version terminator */
>  -    if (se) {
>  -	*se++ = '\0';
>  -	evr->F[RPMEVR_R] = se;
>  -    } else {
>  -	evr->F[RPMEVR_R] = NULL;
>  -    }
>  -
>  -    return 0;
>  -}
>  -#endif
>  -
>   int rpmEVRparse(const char * evrstr, EVR_t evr)
>   	/*@modifies evrstr, evr @*/
>   {
>  @@ -255,24 +206,6 @@
>
>       xx = mireSetEOptions(mire, NULL, 0);
>
>  -#ifndef	DYING
>  -    {	EVR_t Oevr = memset(alloca(sizeof(*Oevr)), 0, sizeof(*Oevr));
>  -
>  -	xx = oldrpmEVRparse(evrstr, Oevr);
>  -assert(Oevr->Elong == evr->Elong);
>  -
>  -	for (i = 0; i < 5; i++) {
>  -	    if (Oevr->F[i] == NULL && evr->F[i] == NULL)
>  -		continue;
>  -	    if (Oevr->F[i] == NULL || evr->F[i] == NULL
>  -	     || strcmp(Oevr->F[i], evr->F[i]))
>  -		fprintf(stderr, "==> \"%s\" %d strcmp(%s,%s)\n",
>  -			evrstr, i, Oevr->F[i], evr->F[i]);
>  -	}
>  -	Oevr->str = _free(Oevr->str);
>  -    }
>  -#endif	/* DYING */
>  -
>       return 0;
>   }
>
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org



  • application/pkcs7-signature attachment: smime.p7s
Received on Sat Jan 10 15:42:01 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.