blob: 8ba908e14cf4ea99529d72898920161dce8b9036 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "system.h"
#include "rpmbuild.h"
int parseBuildInstallClean(Spec spec, int parsePart)
{
int nextPart, rc;
StringBuf *sbp = NULL;
char *name = NULL;
switch (parsePart) {
case PART_BUILD:
sbp = &(spec->build);
name = "%build";
break;
case PART_INSTALL:
sbp = &(spec->install);
name = "%install";
break;
case PART_CLEAN:
sbp = &(spec->clean);
name = "%clean";
break;
}
if (*sbp) {
rpmError(RPMERR_BADSPEC, _("line %d: second %s"), spec->lineNum, name);
return RPMERR_BADSPEC;
}
*sbp = newStringBuf();
/* There are no options to %build, %install, or %clean */
if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
return PART_NONE;
}
if (rc) {
return rc;
}
while (! (nextPart = isPart(spec->line))) {
appendStringBuf(*sbp, spec->line);
if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
return PART_NONE;
}
if (rc) {
return rc;
}
}
return nextPart;
}
|