diff --git a/lib/rpmtag.h b/lib/rpmtag.h index e9878c1099..0b87d3d76b 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -302,6 +302,10 @@ typedef enum rpmTag_e { RPMTAG_MSSFMANIFEST = 5038, /* s[] reservation (unimplemented) */ RPMTAG_MSSFDOMAIN = 5039, /* s[] reservation (unimplemented) */ RPMTAG_INSTFILENAMES = 5040, /* s[] extension */ + RPMTAG_REQUIRENEVRS = 5041, /* s[] extension */ + RPMTAG_PROVIDENEVRS = 5042, /* s[] extension */ + RPMTAG_OBSOLETENEVRS = 5043, /* s[] extension */ + RPMTAG_CONFLICTNEVRS = 5044, /* s[] extension */ RPMTAG_FIRSTFREE_TAG /*!< internal */ } rpmTag; diff --git a/lib/tagexts.c b/lib/tagexts.c index d316396ff3..bc12d2b900 100644 --- a/lib/tagexts.c +++ b/lib/tagexts.c @@ -726,6 +726,47 @@ static int epochnumTag(Header h, rpmtd td, headerGetFlags hgflags) return 1; } +static int depnevrsTag(Header h, rpmtd td, headerGetFlags hgflags, + rpmTagVal tag) +{ + rpmds ds = rpmdsNew(h, tag, 0); + int ndeps = rpmdsCount(ds); + + if (ndeps > 0) { + char **deps = xmalloc(sizeof(*deps) * ndeps); + int i; + while ((i = rpmdsNext(ds)) >= 0) { + deps[i] = rpmdsNewDNEVR(NULL, ds); + } + td->data = deps; + td->type = RPM_STRING_ARRAY_TYPE; + td->count = ndeps; + td->flags |= (RPMTD_ALLOCED | RPMTD_PTR_ALLOCED); + } + rpmdsFree(ds); + return (ndeps > 0); +} + +static int requirenevrsTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + return depnevrsTag(h, td, hgflags, RPMTAG_REQUIRENAME); +} + +static int providenevrsTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + return depnevrsTag(h, td, hgflags, RPMTAG_PROVIDENAME); +} + +static int obsoletenevrsTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + return depnevrsTag(h, td, hgflags, RPMTAG_OBSOLETENAME); +} + +static int conflictnevrsTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + return depnevrsTag(h, td, hgflags, RPMTAG_CONFLICTNAME); +} + static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_GROUP, groupTag }, { RPMTAG_DESCRIPTION, descriptionTag }, @@ -751,6 +792,10 @@ static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_VERBOSE, verboseTag }, { RPMTAG_EPOCHNUM, epochnumTag }, { RPMTAG_INSTFILENAMES, instfilenamesTag }, + { RPMTAG_REQUIRENEVRS, requirenevrsTag }, + { RPMTAG_PROVIDENEVRS, providenevrsTag }, + { RPMTAG_OBSOLETENEVRS, obsoletenevrsTag }, + { RPMTAG_CONFLICTNEVRS, conflictnevrsTag }, { 0, NULL } }; diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at index 3ccb6559ec..04857ab021 100644 --- a/tests/rpmgeneral.at +++ b/tests/rpmgeneral.at @@ -65,6 +65,7 @@ CLASSDICT COLLECTIONS CONFLICTFLAGS CONFLICTNAME +CONFLICTNEVRS CONFLICTS CONFLICTVERSION COOKIE @@ -142,6 +143,7 @@ NVRA O OBSOLETEFLAGS OBSOLETENAME +OBSOLETENEVRS OBSOLETES OBSOLETEVERSION OLDFILENAMES @@ -191,6 +193,7 @@ PREUNFLAGS PREUNPROG PROVIDEFLAGS PROVIDENAME +PROVIDENEVRS PROVIDES PROVIDEVERSION PUBKEYS @@ -200,6 +203,7 @@ RELEASE REMOVETID REQUIREFLAGS REQUIRENAME +REQUIRENEVRS REQUIRES REQUIREVERSION RPMVERSION