diff --git a/docs/manual/tags.md b/docs/manual/tags.md index 3d2ae286d7..1478c29299 100644 --- a/docs/manual/tags.md +++ b/docs/manual/tags.md @@ -456,6 +456,7 @@ Obsoletenevrs | 5043 | string array | Formatted `name [op version]` obso Enhancenevrs | 5061 | string array | Formatted `name [op version]` enhance dependency strings. Recommendnevrs | 5058 | string array | Formatted `name [op version]` recommend dependency strings. Requirenevrs | 5041 | string array | Formatted `name [op version]` require dependency strings. +Rpmformat | 5114 | int32 | Detected rpm format version (3/4/6) Suggestnevrs | 5059 | string array | Formatted `name [op version]` suggest dependency strings. Supplementnevrs | 5060 | string array | Formatted `name [op version]` supplement dependency strings. Sysusers | 5109 | string array | Formatted systemd-sysusers lines for the package. | diff --git a/lib/tagexts.cc b/lib/tagexts.cc index 9f8386ffda..687c9c5eb5 100644 --- a/lib/tagexts.cc +++ b/lib/tagexts.cc @@ -1085,6 +1085,22 @@ static int openpgpTag(Header h, rpmtd td, headerGetFlags hgflags) return td->count != 0; } +static int rpmformatTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + if (headerGet(h, RPMTAG_RPMFORMAT, td, HEADERGET_ALLOC)) + return 1; + + uint32_t *nump = (uint32_t *)xcalloc(1, sizeof(*nump)); + *nump = headerIsEntry(h, RPMTAG_HEADERIMMUTABLE) ? 4 : 3; + + td->data = nump; + td->count = 1; + td->type = RPM_INT32_TYPE; + td->flags = RPMTD_ALLOCED; + + return 1; +} + static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_GROUP, groupTag }, { RPMTAG_DESCRIPTION, descriptionTag }, @@ -1127,6 +1143,7 @@ static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_SYSUSERS, sysusersTag }, { RPMTAG_FILEMIMES, filemimesTag }, { RPMTAG_OPENPGP, openpgpTag }, + { RPMTAG_RPMFORMAT, rpmformatTag }, { 0, NULL } };