Add BUILDINFO rpm tag 72/190672/3 accepted/tizen/base/20181102.125658 submit/tizen_base/20181031.095739
authorSlava Barinov <v.barinov@samsung.com>
Wed, 3 Oct 2018 08:33:36 +0000 (11:33 +0300)
committerDongkyun Son <dongkyun.s@samsung.com>
Mon, 29 Oct 2018 12:33:00 +0000 (12:33 +0000)
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 <v.barinov@samsung.com>
build/parsePreamble.c
lib/rpmtag.h

index 523e452..c337053 100644 (file)
@@ -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
index 025a0a4..5169101 100644 (file)
@@ -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;