From 6c595f38457231d53c27dd28446b9bf71bf248af Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Wed, 12 Dec 2018 10:59:45 +0300 Subject: Move %_buildinfo setup into %pack section This allows to change %_buildinfo tag during the package build if required and allows customization of tag basing on build environment, e.g. for ASan builds. Change-Id: I0104c0eed3c16ac6edccc2c7a74fb12d38fff8aa Signed-off-by: Slava Barinov --- build/pack.c | 23 ++++++++++++++++++++++- build/parsePreamble.c | 8 -------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/build/pack.c b/build/pack.c index 6480cecaa..b6c808e09 100644 --- a/build/pack.c +++ b/build/pack.c @@ -330,7 +330,28 @@ static rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileNam rasprintf(cookie, "%s %d", buildHost(), (int) (*getBuildTime())); headerPutString(h, RPMTAG_COOKIE, *cookie); } - + + /* + * Add system-wide Tizen build information + */ + char *buildinfo = rpmExpand("%{?_buildinfo}", NULL); + if (buildinfo && *buildinfo) { + int err; + int count = 0; + char **strings = NULL; + + if ((err = poptParseArgvString(buildinfo, &count, &strings))) { + rpmlog(RPMLOG_ERR, _("Can't parse BUILDINFO tag: %s\n"), poptStrerror(xx)); + goto exit; + } + + if (count) + headerPutStringArray(h, RPMTAG_BUILDINFO, strings, count); + + strings = _free(strings); + } + free(buildinfo); + /* Reallocate the header into one contiguous region. */ h = headerReload(h, RPMTAG_HEADERIMMUTABLE); if (h == NULL) { /* XXX can't happen */ diff --git a/build/parsePreamble.c b/build/parsePreamble.c index c3370538a..f02e14e92 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -1060,14 +1060,6 @@ 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 -- cgit v1.2.3