Skip to content

Commit

Permalink
Always start parsing in the preable of the main package
Browse files Browse the repository at this point in the history
even on secondary parse runs. This allows declaring tags not essential
for building in dynamic spec parts.
  • Loading branch information
ffesti committed Oct 11, 2023
1 parent d1ac667 commit 5af0ec9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 3 additions & 1 deletion build/parsePreamble.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,11 +1185,13 @@ int parsePreamble(rpmSpec spec, int initialPackage)
NVR = xstrdup(name);
pkg = newPackage(NVR, spec->pool, &spec->packages);
headerPutString(pkg->header, RPMTAG_NAME, NVR);
} else if (spec->sourcePackage) {
NVR = xstrdup("(main package)");
pkg = spec->packages;
} else {
NVR = xstrdup("(main package)");
pkg = newPackage(NULL, spec->pool, &spec->packages);
spec->sourcePackage = newPackage(NULL, spec->pool, NULL);

}

if ((rc = readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) {
Expand Down
6 changes: 0 additions & 6 deletions build/parseSpec.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,12 +891,6 @@ static rpmRC parseSpecSection(rpmSpec *specptr, int secondary)
int storedParsePart;
int initialPackage = 1;

if (secondary) {
initialPackage = 0;
parsePart = PART_EMPTY;
prevParsePart = PART_NONE;
}

/* All the parse*() functions expect to have a line pre-read */
/* in the spec's line buffer. Except for parsePreamble(), */
/* which handles the initial entry into a spec file. */
Expand Down

0 comments on commit 5af0ec9

Please sign in to comment.