- As newPackage() initializes the pkg header too, we now need
a different way of checking whether initSourceHeader() has
already been called. Checking RPMTAG_NAME should suffice for the job...
(cherry picked from commit
0db12898c5d270fd4bbc7b4bad677dee4f34a617)
headerPutString(pkg->header, RPMTAG_NAME, NVR);
} else {
NVR = xstrdup("(main package)");
+ spec->sourcePackage = newPackage(NULL);
}
if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
static void initSourceHeader(rpmSpec spec)
{
- Package sourcePkg;
+ Package sourcePkg = spec->sourcePackage;
struct Source *srcPtr;
- if (spec->sourcePackage)
+ if (headerIsEntry(sourcePkg->header, RPMTAG_NAME))
return;
- sourcePkg = spec->sourcePackage = xcalloc(1, sizeof(*sourcePkg));
- sourcePkg->header = headerNew();
/* Only specific tags are added to the source package header */
headerCopyTags(spec->packages->header, sourcePkg->header, sourceTags);