Skip to content

Commit

Permalink
Check Source header for mandarory tags
Browse files Browse the repository at this point in the history
Generating mandatory tags dynamically has them missing in SRPMs if build
with rpmbuid -bs or such. To prevent this from happening check the
source header right after the initial parse run of the spec file. This is
more strict than before relaxing this for the dynamic spec feature as now
errors can come up even if no package is actually build.

Resolves: rpm-software-management#3096
  • Loading branch information
ffesti committed Jun 12, 2024
1 parent fc27d4e commit 6ff3348
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build/parseSpec.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,13 +677,14 @@ static const rpmTagVal sourceTags[] = {
0
};

static void initSourceHeader(rpmSpec spec)
static int initSourceHeader(rpmSpec spec)
{
Package sourcePkg = spec->sourcePackage;
struct Source *srcPtr;
int rc = 0;

if (headerIsEntry(sourcePkg->header, RPMTAG_NAME))
return;
return rc;

char *os = rpmExpand("%{_target_os}", NULL);
headerPutString(sourcePkg->header, RPMTAG_OS, os);
Expand Down Expand Up @@ -739,6 +740,10 @@ static void initSourceHeader(rpmSpec spec)
spec->noSource ? "no" : "");
free(nvr);
}

rc = checkForRequired(spec->sourcePackage->header);

return rc;
}

static void finalizeSourceHeader(rpmSpec spec)
Expand Down Expand Up @@ -1320,7 +1325,8 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
goto errxit;

/* Assemble source header from parsed components */
initSourceHeader(spec);
if (initSourceHeader(spec))
goto errxit;
return spec;

errxit:
Expand Down

0 comments on commit 6ff3348

Please sign in to comment.