diff options
-rw-r--r-- | lib/rpmtag.h | 1 | ||||
-rw-r--r-- | lib/tagexts.c | 22 | ||||
-rw-r--r-- | tests/rpmgeneral.at | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/lib/rpmtag.h b/lib/rpmtag.h index 767e17c39..e8e9dee26 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -306,6 +306,7 @@ typedef enum rpmTag_e { RPMTAG_PROVIDENEVRS = 5042, /* s[] extension */ RPMTAG_OBSOLETENEVRS = 5043, /* s[] extension */ RPMTAG_CONFLICTNEVRS = 5044, /* s[] extension */ + RPMTAG_FILENLINKS = 5045, /* i[] extension */ RPMTAG_FIRSTFREE_TAG /*!< internal */ } rpmTag; diff --git a/lib/tagexts.c b/lib/tagexts.c index bc12d2b90..77d202443 100644 --- a/lib/tagexts.c +++ b/lib/tagexts.c @@ -767,6 +767,27 @@ static int conflictnevrsTag(Header h, rpmtd td, headerGetFlags hgflags) return depnevrsTag(h, td, hgflags, RPMTAG_CONFLICTNAME); } +static int filenlinksTag(Header h, rpmtd td, headerGetFlags hgflags) +{ + rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, RPMFI_NOHEADER); + rpm_count_t fc = rpmfiFC(fi); + + if (fc > 0) { + uint32_t *nlinks = xmalloc(fc * sizeof(*nlinks)); + int ix; + while ((ix = rpmfiNext(fi)) >= 0) { + nlinks[ix] = rpmfiFNlink(fi); + } + td->data = nlinks; + td->type = RPM_INT32_TYPE; + td->count = fc; + td->flags = RPMTD_ALLOCED; + } + + rpmfiFree(fi); + return (fc > 0); +} + static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_GROUP, groupTag }, { RPMTAG_DESCRIPTION, descriptionTag }, @@ -796,6 +817,7 @@ static const struct headerTagFunc_s rpmHeaderTagExtensions[] = { { RPMTAG_PROVIDENEVRS, providenevrsTag }, { RPMTAG_OBSOLETENEVRS, obsoletenevrsTag }, { RPMTAG_CONFLICTNEVRS, conflictnevrsTag }, + { RPMTAG_FILENLINKS, filenlinksTag }, { 0, NULL } }; diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at index 04857ab02..13131e233 100644 --- a/tests/rpmgeneral.at +++ b/tests/rpmgeneral.at @@ -104,6 +104,7 @@ FILEMD5S FILEMODES FILEMTIMES FILENAMES +FILENLINKS FILEPROVIDE FILERDEVS FILEREQUIRE |