From: Slava Barinov Date: Wed, 3 Oct 2018 08:33:36 +0000 (+0300) Subject: Add BUILDINFO rpm tag X-Git-Tag: accepted/tizen/base/20181102.125658^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b05a3cf2c82b4981f55ac264a4790d79307a0950;p=platform%2Fupstream%2Frpm.git Add BUILDINFO rpm tag The tag is intended for storage of Sanitizer build information or toolchain details. The tag is array of strings and it can be added to .spec file using line BuildInfo: buildtag1 buildtag2 or by defining tag trough %define _buildinfo buildtag1 Also the tag value can be queried using regular rpm query syntax: rpm -qp --queryformat "[%{BUILDINFO}\n]" The storage is intended for use at least for sanitized firmwares, but can be reused for storing any information required for Tizen build details. Change-Id: Icfc0c384c5a5d3b82973ee0be9345e396723174c Signed-off-by: Slava Barinov --- diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 523e452..c337053 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -837,6 +837,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag, break; } case RPMTAG_COLLECTIONS: + case RPMTAG_BUILDINFO: if (addOrAppendListEntry(pkg->header, tag, field)) goto exit; break; @@ -920,6 +921,7 @@ static struct PreambleRec_s const preambleList[] = { {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildsupplements")}, {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildenhances")}, {RPMTAG_SECMANIFEST, 0, 0, LEN_AND_STR("manifest")}, + {RPMTAG_BUILDINFO, 0, 0, LEN_AND_STR("buildinfo")}, {0, 0, 0, 0} }; @@ -1058,7 +1060,15 @@ int parsePreamble(rpmSpec spec, int initialPackage) } } - /* + { + /* + * Add system-wide Tizen build information + */ + char *value = rpmExpand("%{?_buildinfo}", NULL); + addOrAppendListEntry(pkg->header, RPMTAG_BUILDINFO, value); + } + + /* * Expand buildroot one more time to get %{version} and the like * from the main package, validate sanity. The spec->buildRoot could * still contain unexpanded macros but it cannot be empty or '/', and it diff --git a/lib/rpmtag.h b/lib/rpmtag.h index 025a0a4..5169101 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -307,6 +307,8 @@ typedef enum rpmTag_e { RPMTAG_OBSOLETENEVRS = 5043, /* s[] extension */ RPMTAG_CONFLICTNEVRS = 5044, /* s[] extension */ RPMTAG_FILENLINKS = 5045, /* i[] extension */ + /* Skip numbers which might be used in new RPM versions */ + RPMTAG_BUILDINFO = 7000, /* s[] information about build */ RPMTAG_FIRSTFREE_TAG /*!< internal */ } rpmTag;