9 #define _RPMEVR_INTERNAL
67 xx = poptParseArgvString(line, &argc, &argv);
86 static char buf[BUFSIZ];
88 strcpy(linebuf, line);
91 (void)strtok(linebuf,
" \t\n");
93 if (!(tok = strtok(NULL,
" \t\n"))) {
98 if (!strcmp(tok,
"-n")) {
99 if (!(tok = strtok(NULL,
" \t\n")))
108 return (strtok(NULL,
" \t\n")) ? 1 : 0;
117 return ((!s || (s[0] ==
'n' || s[0] ==
'N' || s[0] ==
'0') ||
132 {
"interp", RPMSENSE_INTERP },
133 {
"preun", RPMSENSE_SCRIPT_PREUN },
134 {
"pre", RPMSENSE_SCRIPT_PRE },
135 {
"postun", RPMSENSE_SCRIPT_POSTUN },
136 {
"post", RPMSENSE_SCRIPT_POST },
137 {
"rpmlib", RPMSENSE_RPMLIB },
138 {
"verify", RPMSENSE_SCRIPT_VERIFY },
139 {
"hint", RPMSENSE_MISSINGOK },
147 {
"prep", RPMSENSE_SCRIPT_PREP },
148 {
"build", RPMSENSE_SCRIPT_BUILD },
149 {
"install", RPMSENSE_SCRIPT_INSTALL },
150 {
"clean", RPMSENSE_SCRIPT_CLEAN },
151 {
"hint", RPMSENSE_MISSINGOK },
169 while ((c = *s) &&
xisspace(c)) s++;
171 while ((c = *se) &&
xisalpha(c)) se++;
174 for (tb = tokbits; tb->
name; tb++) {
175 if (tb->
name != NULL &&
176 strlen(tb->
name) == (se-s) && !strncmp(tb->
name, s, (se-s)))
179 if (tb->
name == NULL)
182 while ((c = *se) &&
xisspace(c)) se++;
188 if (c == 0 && bp) *bp =
bits;
198 char *se = s + strlen(s);
201 while (--se > s && strchr(
" \t\n\r", *se) != NULL)
220 if (!hge(h, tag, &type, &names, &count))
227 names = hfd(names, type);
229 return (count >= 0 ? 1 : 0);
238 const char *arch =
rpmExpand(
"%{_target_cpu}", NULL);
239 const char *os =
rpmExpand(
"%{_target_os}", NULL);
281 _(
"%s field must be present in package: %s\n"),
346 if (val && *val !=
'%')
361 static size_t iconsize = 0;
362 const char *fn, *Lurlfn = NULL;
376 icon =
alloca(iconsize+1);
378 for (sp = spec->
sources; sp != NULL; sp = sp->
next) {
390 urltype =
urlPath(Lurlfn, &fn);
406 if (fd == NULL ||
Ferror(fd)) {
414 nb =
Fread(icon,
sizeof(icon[0]), iconsize, fd);
415 if (
Ferror(fd) || nb == 0) {
420 if (nb >= iconsize) {
426 if (!strncmp(icon,
"GIF",
sizeof(
"GIF")-1))
428 else if (!strncmp(icon,
"/* XPM",
sizeof(
"/* XPM")-1))
441 Lurlfn =
_free(Lurlfn);
467 sprintf(buf,
"%s(%s)", n,
tagName(tag));
477 #define SINGLE_TOKEN_ONLY \
479 rpmError(RPMERR_BADSPEC, _("line %d: Tag takes single token only: %s\n"), \
480 spec->lineNum, spec->line); \
481 return RPMERR_BADSPEC; \
492 const char *macro,
const char *
lang)
503 char * field = spec->
line;
516 while ((*field) && (*field !=
':'))
550 if (strchr(field,
'-') != NULL) {
557 if (strchr(field,
'-') != NULL) {
585 (void)
urlPath(buildRootURL, &buildRoot);
587 if (*buildRoot ==
'\0') buildRoot =
"/";
589 if (!strcmp(buildRoot,
"/")) {
591 _(
"BuildRoot can not be \"/\": %s\n"), spec->buildRootURL);
592 buildRootURL =
_free(buildRootURL);
595 buildRootURL =
_free(buildRootURL);
602 xx = hge(pkg->
header, tag, &type, &array, &num);
605 if (array[num][0] !=
'/') {
607 _(
"line %d: Prefixes must begin with \"/\": %s\n"),
609 array = hfd(array, type);
612 len = strlen(array[num]);
613 if (array[num][len - 1] ==
'/' && len > 1) {
615 _(
"line %d: Prefixes must not end with \"/\": %s\n"),
617 array = hfd(array, type);
621 array = hfd(array, type);
625 if (field[0] !=
'/') {
627 _(
"line %d: Docdir must begin with '/': %s\n"),
641 _(
"line %d: %s takes an integer value: %s\n"),
661 if ((rc =
addSource(spec, pkg, field, tag)))
667 if ((rc =
addSource(spec, pkg, field, tag)))
681 if ((rc =
parseBits(lang, buildScriptBits, &tagflags))) {
683 _(
"line %d: Bad %s: qualifiers: %s\n"),
687 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
692 if ((rc =
parseBits(lang, installScriptBits, &tagflags))) {
694 _(
"line %d: Bad %s: qualifiers: %s\n"),
698 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
704 tagflags = RPMSENSE_MISSINGOK;
705 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
712 tagflags = RPMSENSE_MISSINGOK;
713 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
723 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
734 if ((rc = poptParseArgvString(field,
738 _(
"line %d: Bad BuildArchitecture format: %s\n"),
839 const char ** macro,
char *
lang)
846 for (p = preambleList; p->
token != NULL; p++) {
847 len = strlen(p->
token);
857 if (p == NULL || p->
token == NULL)
860 s = spec->
line + len;
868 if (*s !=
':')
return 1;
877 if (*s !=
'(')
return 1;
884 if (*s !=
')')
return 1;
887 if (*s !=
':')
return 1;
911 strcpy(NVR,
"(main package)");
915 if (! initialPackage) {
933 const char * mainName;
935 sprintf(NVR,
"%s-%s", mainName, name);
953 if (*linep !=
'\0') {