Skip to content

Commit

Permalink
Allow whitespace before directives in the Preamble
Browse files Browse the repository at this point in the history
Update to the documentation is still needed

Resolves: rpm-software-management#2927
  • Loading branch information
ffesti committed Mar 11, 2024
1 parent e56d1c4 commit 85c3207
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 7 additions & 4 deletions build/parsePreamble.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ int addSource(rpmSpec spec, int specline, const char *srcname, rpmTagVal tag)
}

if (specline) {
nonum = parseTagNumber(spec->line + strlen(name), &num);
char * s = spec->line;
SKIPSPACE(s);
nonum = parseTagNumber(s + strlen(name), &num);
if (nonum < 0) {
rpmlog(RPMLOG_ERR, _("line %d: Bad %s number: %s\n"),
spec->lineNum, name, spec->line);
Expand Down Expand Up @@ -1136,10 +1138,11 @@ static struct PreambleRec_s const preambleList[] = {
static int findPreambleTag(rpmSpec spec, PreambleRec * pr, const char ** macro, char * lang)
{
PreambleRec p;
char *s;
char *s = spec->line;
SKIPSPACE(s);

for (p = preambleList; p->token != NULL; p++) {
if (!(p->token && !rstrncasecmp(spec->line, p->token, p->len)))
if (!(p->token && !rstrncasecmp(s, p->token, p->len)))
continue;
if (p->deprecated) {
rpmlog(RPMLOG_WARNING, _("line %d: %s is deprecated: %s\n"),
Expand All @@ -1150,7 +1153,7 @@ static int findPreambleTag(rpmSpec spec, PreambleRec * pr, const char ** macro,
if (p == NULL || p->token == NULL)
return 1;

s = spec->line + p->len;
s = s + p->len;
SKIPSPACE(s);

switch (p->type) {
Expand Down
10 changes: 5 additions & 5 deletions tests/data/SPECS/hello.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
# package which can be built under runroot in the test-suite.

Summary: hello -- hello, world rpm
Name: hello
Name: hello
Version: 1.0
Release: 1
Group: Utilities
Release: 1
Group: Utilities
License: GPL
SourceLicense: GPL, ASL 1.0
Distribution: RPM test suite.
URL: http://rpm.org
Source0: hello-1.0.tar.gz
Patch0: hello-1.0-modernize.patch
Source0: hello-1.0.tar.gz
Patch0: hello-1.0-modernize.patch
Prefix: /usr

%description
Expand Down

0 comments on commit 85c3207

Please sign in to comment.