Skip to content

Commit f5a4fd4

Browse files
committed
Store Sources (and Patches) as they are declared
Append new Source/Patch entries at the end of the list instead of the front. This will also put them into the header in the order they are declared. This change does not put them in order of their numbers or have Sources and Patch separated out. Resolves: rpm-software-management#3014
1 parent ef948df commit f5a4fd4

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

build/parsePreamble.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static inline int parseYesNo(const char * s)
137137
static struct Source *newSource(uint32_t num, const char *path, int flags)
138138
{
139139
struct Source *p = new Source {};
140+
p->next = NULL;
140141
p->num = num;
141142
p->fullSource = xstrdup(path);
142143
p->flags = flags;
@@ -320,10 +321,16 @@ int addSource(rpmSpec spec, int specline, const char *srcname, rpmTagVal tag)
320321
return RPMRC_FAIL;
321322
}
322323

323-
/* Create the entry and link it in */
324+
/* Create the entry and link it at the end */
324325
p = newSource(num, srcname, flag);
325-
p->next = spec->sources;
326-
spec->sources = p;
326+
if (!spec->sources) {
327+
spec->sources = p;
328+
} else {
329+
Source * s = spec->sources;
330+
while (s->next)
331+
s = s->next;
332+
s->next = p;
333+
}
327334
spec->numSources++;
328335

329336
rasprintf(&buf, "%s%d",

tests/rpmbuild.at

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,8 +3021,8 @@ runroot rpmbuild \
30213021
],
30223022
[1],
30233023
[],
3024-
[error: Bad file: /notthere/hello-1.0-modernize.patch: No such file or directory
3025-
error: Bad file: /notthere/hello-1.0.tar.gz: No such file or directory
3024+
[error: Bad file: /notthere/hello-1.0.tar.gz: No such file or directory
3025+
error: Bad file: /notthere/hello-1.0-modernize.patch: No such file or directory
30263026
])
30273027
RPMTEST_CLEANUP
30283028

tests/rpmpython.at

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ for pkg in spec.packages:
7676
print(pkg.header.format('%{nvr}'))
7777
print(spec.sourceHeader.format('%{nvr}'))
7878
],
79-
[src hello-1.0-modernize.patch 0 2
80-
src hello-1.0.tar.gz 0 1
79+
[src hello-1.0.tar.gz 0 1
80+
src hello-1.0-modernize.patch 0 2
8181
hello-1.0-1
8282
hello-1.0-1
8383
])

0 commit comments

Comments
 (0)