rpm  5.4.15
Data Structures | Macros | Functions | Variables
rpmevr.c File Reference
#include "system.h"
#include <rpmiotypes.h>
#include <rpmmacro.h>
#include <mire.h>
#include <rpmlog.h>
#include <set.h>
#include <rpmtag.h>
#include <rpmevr.h>
#include "debug.h"
Include dependency graph for rpmevr.c:

Go to the source code of this file.

Data Structures

struct  EVRop_s
 

Macros

#define _MIRE_INTERNAL
 
#define _RPMEVR_INTERNAL
 
#define MAX(x, y)   ( ((x)>(y))?(x):(y) )
 

Functions

EVR_t rpmEVRnew (uint32_t Flags, int initialize)
 Create a new EVR container. More...
 
EVR_t rpmEVRfree (EVR_t evr)
 Destroy an EVR container. More...
 
static int xisrpmalpha (int c)
 Return rpm's analogue of xisalpha. More...
 
int rpmEVRcmp (const char *a, const char *b)
 Segmented string compare. More...
 
static miRE rpmEVRmire (void)
 
int rpmEVRparse (const char *evrstr, EVR_t evr)
 Split EVR string into epoch, version, and release components. More...
 
static int compare_values (const char *a, const char *b)
 Dressed rpmEVRcmp, handling missing values. More...
 
static const char * rpmEVRorder (void)
 Return precedence permutation string. More...
 
int rpmEVRcompare (const EVR_t a, const EVR_t b)
 Compare EVR containers for equality. More...
 
int rpmEVRoverlap (EVR_t a, EVR_t b)
 Compare EVR containers for overlap. More...
 
rpmsenseFlags rpmEVRflags (const char *op, const char **end)
 Return comparison operator sense flags. More...
 
int rpmVersionCompare (Header A, Header B)
 

Variables

int _rpmevr_debug = 0
 
static int _invert_digits_alphas_comparison = 1
 
static const char * _rpmnotalpha = ".:-"
 
static const char _evr_tuple_match []
 
const char * evr_tuple_match = NULL
 
miRE evr_tuple_mire = NULL
 
static const char _evr_tuple_order [] = "EVR"
 
static const char * evr_tuple_order = NULL
 
int(* rpmvercmp )(const char *a, const char *b) = rpmEVRcmp
 Segmented string compare vector. More...
 
static struct EVRop_s cops []
 

Macro Definition Documentation

#define _MIRE_INTERNAL

Definition at line 8 of file rpmevr.c.

#define _RPMEVR_INTERNAL

Definition at line 15 of file rpmevr.c.

#define MAX (   x,
 
)    ( ((x)>(y))?(x):(y) )

Definition at line 28 of file rpmevr.c.

Referenced by gridfile_get_contentlength(), and rpmEVRcmp().

Function Documentation

static int compare_values ( const char *  a,
const char *  b 
)
static

Dressed rpmEVRcmp, handling missing values.

Parameters
a1st string
b2nd string
Returns
+1 if a is "newer", 0 if equal, -1 if b is "newer"

Definition at line 248 of file rpmevr.c.

References rpmvercmp.

Referenced by rpmEVRcompare().

int rpmEVRcmp ( const char *  a,
const char *  b 
)

Segmented string compare.

Parameters
a1st string
b2nd string
Returns
+1 if a is "newer", 0 if equal, -1 if b is "newer"

Definition at line 87 of file rpmevr.c.

References _invert_digits_alphas_comparison, b, MAX, xisdigit(), and xisrpmalpha().

int rpmEVRcompare ( const EVR_t  a,
const EVR_t  b 
)

Compare EVR containers for equality.

Parameters
a1st EVR container
b2nd EVR container
Returns
+1 if a is "newer", 0 if equal, -1 if b is "newer"

Definition at line 280 of file rpmevr.c.

References _, compare_values(), rpmEVRorder(), rpmlog(), RPMLOG_WARNING, RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, and rpmsetCmp().

Referenced by evrCompare(), labelCompare(), pointRpmEVR(), rpmEVRoverlap(), and rpmfcHelper().

rpmsenseFlags rpmEVRflags ( const char *  op,
const char **  end 
)

Return comparison operator sense flags.

Parameters
opoperator string (NULL or "" uses RPMSENSE_EQUAL)
*endpointer to 1st character after operator (or NULL)
Returns
sense flags

Definition at line 406 of file rpmevr.c.

References cops, EVRop_s::opstr, RPMSENSE_EQUAL, and EVRop_s::sense.

Referenced by parseRCPOT(), rpmdsPipe(), and rpmdsSysinfoFile().

EVR_t rpmEVRfree ( EVR_t  evr)

Destroy an EVR container.

Parameters
evrEVR container
Returns
NULL always

Definition at line 47 of file rpmevr.c.

References _free().

Referenced by addReqProv(), evrCompare(), evrSplit(), labelCompare(), nwlookupTag(), PRCOsqlTag(), rpmfcHelper(), and wnlookupTag().

static miRE rpmEVRmire ( void  )
static

Definition at line 157 of file rpmevr.c.

References _free(), evr_tuple_mire, mireNew(), mireRegcomp(), mireSetCOptions(), rpmExpand(), RPMMIRE_REGEX, and xstrdup().

Referenced by rpmEVRparse().

EVR_t rpmEVRnew ( uint32_t  Flags,
int  initialize 
)

Create a new EVR container.

Parameters
FlagsEVR inequality flags
initializeShould empty defaults be initialized?
Returns
initialized EVR container

Definition at line 31 of file rpmevr.c.

References xcalloc().

Referenced by addReqProv(), evrCompare(), evrSplit(), labelCompare(), nwlookupTag(), PRCOsqlTag(), rpmfcHelper(), and wnlookupTag().

static const char* rpmEVRorder ( void  )
static

Return precedence permutation string.

Returns
precedence permutation

Definition at line 264 of file rpmevr.c.

References _free(), evr_tuple_order, rpmExpand(), and xstrdup().

Referenced by rpmEVRcompare(), and rpmVersionCompare().

int rpmEVRoverlap ( EVR_t  a,
EVR_t  b 
)

Compare EVR containers for overlap.

Parameters
a1st EVR container
b2nd EVR container
Returns
1 if EVR inequalities overlap, 0 otherwise

Definition at line 339 of file rpmevr.c.

References rpmEVRcompare(), RPMSENSE_EQUAL, RPMSENSE_GREATER, RPMSENSE_LESS, and RPMSENSE_NOTEQUAL.

Referenced by addReqProv(), nwlookupTag(), and wnlookupTag().

int rpmEVRparse ( const char *  evrstr,
EVR_t  evr 
)

Split EVR string into epoch, version, and release components.

Parameters
evrstr[epoch:]version[-release] string
Return values
*evrparse results
Returns
0 always

Definition at line 181 of file rpmevr.c.

References i, mireRegexec(), mireSetEOptions(), rpmEVRmire(), and xstrdup().

Referenced by addReqProv(), dpkgEVRparse(), evrCompare(), evrSplit(), nwlookupTag(), parseRCPOT(), pointRpmEVR(), PRCOsqlTag(), rpmdsCompare(), rpmfcHelper(), and wnlookupTag().

int rpmVersionCompare ( Header  A,
Header  B 
)
static int xisrpmalpha ( int  c)
inlinestatic

Return rpm's analogue of xisalpha.

Parameters
ccharacter to test
Returns
is this an alpha character?

Definition at line 74 of file rpmevr.c.

References xisalpha(), and xispunct().

Referenced by rpmEVRcmp().

Variable Documentation

const char _evr_tuple_match[]
static
Initial value:
=
"^(?:([^:-]+):)?([^:-]+)(?:-([^:-]+))?(?::([^:-]+))?$"

Definition at line 150 of file rpmevr.c.

const char _evr_tuple_order[] = "EVR"
static

Definition at line 255 of file rpmevr.c.

int _invert_digits_alphas_comparison = 1
static

Definition at line 62 of file rpmevr.c.

Referenced by rpmEVRcmp().

int _rpmevr_debug = 0

Definition at line 25 of file rpmevr.c.

const char* _rpmnotalpha = ".:-"
static

Definition at line 67 of file rpmevr.c.

struct EVRop_s cops[]
static
const char* evr_tuple_match = NULL

Definition at line 153 of file rpmevr.c.

Referenced by rpmcliFini().

miRE evr_tuple_mire = NULL

Definition at line 155 of file rpmevr.c.

Referenced by rpmcliFini(), and rpmEVRmire().

const char* evr_tuple_order = NULL
static

Definition at line 257 of file rpmevr.c.

Referenced by rpmEVRorder().

int(* rpmvercmp)(const char *a, const char *b) = rpmEVRcmp

Segmented string compare vector.

Parameters
a1st string
b2nd string
Returns
+1 if a is "newer", 0 if equal, -1 if b is "newer"

Definition at line 379 of file rpmevr.c.

Referenced by compare_values(), rpmdsCompare(), and rpmVersionCompare().