15 #define _RPMEVR_INTERNAL
16 #define _RPMTAG_INTERNAL
81 xx = poptParseArgvString(line, &argc, &argv);
110 se = strchr(spec->
line,
'#');
113 while (--se >= spec->
line && strchr(
" \t\n\r", *se) != NULL)
119 (void)strtok(s,
" \t\n");
121 if (!(se = strtok(NULL,
" \t\n")))
124 if (!strcmp(se,
"-n")) {
125 if (!(se = strtok(NULL,
" \t\n"))) {
136 rc = (strtok(NULL,
" \t\n") ? 1 : 0);
148 return ((!s || (s[0] ==
'n' || s[0] ==
'N' || s[0] ==
'0') ||
163 {
"interp", RPMSENSE_INTERP },
164 {
"preun", RPMSENSE_SCRIPT_PREUN },
165 {
"pre", RPMSENSE_SCRIPT_PRE },
166 {
"postun", RPMSENSE_SCRIPT_POSTUN },
167 {
"post", RPMSENSE_SCRIPT_POST },
168 {
"rpmlib", RPMSENSE_RPMLIB },
169 {
"verify", RPMSENSE_SCRIPT_VERIFY },
170 {
"hint", RPMSENSE_MISSINGOK },
178 {
"prep", RPMSENSE_SCRIPT_PREP },
179 {
"build", RPMSENSE_SCRIPT_BUILD },
180 {
"install", RPMSENSE_SCRIPT_INSTALL },
181 {
"clean", RPMSENSE_SCRIPT_CLEAN },
182 {
"hint", RPMSENSE_MISSINGOK },
199 while ((c = *s) &&
xisspace(c)) s++;
201 while ((c = *se) &&
xisalpha(c)) se++;
204 for (tb = tokbits; tb->
name; tb++) {
205 if (tb->
name != NULL &&
206 strlen(tb->
name) == (
size_t)(se-s) && !strncmp(tb->
name, s, (se-s)))
209 if (tb->
name == NULL)
212 while ((c = *se) &&
xisspace(c)) se++;
218 if (c == 0 && bp) *bp =
bits;
228 char *se = s + strlen(s);
231 while (--se > s && strchr(
" \t\n\r", *se) != NULL)
234 if ((se = strchr(s,
'#')) != NULL) {
236 while (--se > s && strchr(
" \t\n\r", *se) != NULL)
276 const char *arch =
rpmExpand(
"%{_target_cpu}", NULL);
277 const char *os =
rpmExpand(
"%{_target_os}", NULL);
318 _(
"%s field must be present in package: %s\n"),
346 if (he->
tag != lastTag) {
374 { 0xffffffff,
"%{class}" },
395 if (tag == 0xffffffff) {
404 if (val && *val !=
'%') {
421 static size_t iconsize = 0;
423 const char *fn, *Lurlfn = NULL;
437 icon =
alloca(iconsize+1);
439 for (sp = spec->
sources; sp != NULL; sp = sp->
next) {
448 #if defined(RPM_VENDOR_OPENPKG)
453 if (access(Lurlfn,
F_OK) == -1) {
454 Lurlfn =
_free(Lurlfn);
462 urltype =
urlPath(Lurlfn, &fn);
478 fd =
Fopen(fn,
"r%{?_rpmgio}");
479 if (fd == NULL ||
Ferror(fd)) {
487 nb =
Fread(icon,
sizeof(icon[0]), iconsize, fd);
488 if (
Ferror(fd) || nb == 0) {
493 if (nb >= iconsize) {
499 if (icon[0] ==
'G' && icon[1] ==
'I' && icon[2] ==
'F')
502 if (icon[0] ==
'/' && icon[1] ==
'*' && icon[2] ==
' '
503 && icon[3] ==
'X' && icon[4] ==
'P' && icon[5] ==
'M')
518 Lurlfn =
_free(Lurlfn);
556 #define SINGLE_TOKEN_ONLY \
558 rpmlog(RPMLOG_ERR, _("line %d: Tag takes single token only: %s\n"), \
559 spec->lineNum, spec->line); \
570 const char * tagN =
tagName(tag);
571 const char * pattern =
rpmExpand(
"%{?pattern_", tagN,
"}", NULL);
574 if (pattern && *pattern) {
595 pattern =
_free(pattern);
603 const char *macro,
const char *
lang)
613 char * field = spec->
line;
624 while ((*field) && (*field !=
':'))
664 if (strchr(field,
'-') != NULL) {
671 if (strchr(field,
'-') != NULL) {
686 #if defined(RPM_VENDOR_OPENPKG)
702 #if defined(SUPPORT_I18NSTRING_TYPE)
703 (void) headerAddI18NString(pkg->
header, tag, field, lang);
721 (void)
urlPath(buildRootURL, &buildRoot);
722 if (*buildRoot ==
'\0') buildRoot =
"/";
723 if (!strcmp(buildRoot,
"/")) {
725 _(
"BuildRoot can not be \"/\": %s\n"), spec->buildRootURL);
726 buildRootURL =
_free(buildRootURL);
729 buildRootURL =
_free(buildRootURL);
740 if (he->
p.
argv[he->
c][0] !=
'/') {
742 _(
"line %d: Prefixes must begin with \"/\": %s\n"),
747 len = (int)strlen(he->
p.
argv[he->
c]);
748 if (he->
p.
argv[he->
c][len - 1] ==
'/' && len > 1) {
750 _(
"line %d: Prefixes must not end with \"/\": %s\n"),
760 if (field[0] !=
'/') {
762 _(
"line %d: Docdir must begin with '/': %s\n"),
776 _(
"line %d: %s takes an integer value: %s\n"),
800 if ((rc =
addSource(spec, pkg, field, tag)))
806 if ((rc =
addSource(spec, pkg, field, tag)))
820 if ((rc =
parseBits(lang, buildScriptBits, &tagflags))) {
822 _(
"line %d: Bad %s: qualifiers: %s\n"),
826 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
831 if ((rc =
parseBits(lang, installScriptBits, &tagflags))) {
833 _(
"line %d: Bad %s: qualifiers: %s\n"),
837 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
843 tagflags = RPMSENSE_MISSINGOK;
844 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
851 tagflags = RPMSENSE_MISSINGOK;
852 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
861 tagflags = RPMSENSE_ANY;
862 if ((rc =
parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
874 {
const char ** BANames = NULL;
876 if ((rc = poptParseArgvString(field, &BACount, &BANames))) {
878 _(
"line %d: Bad BuildArchitecture format: %s\n"),
883 if (BACount > 0 && BANames != NULL) {
889 if (BACount != 1 || strcmp(BANames[0],
"noarch")) {
891 _(
"line %d: Only \"noarch\" sub-packages are supported: %s\n"),
893 BANames =
_free(BANames);
898 BANames =
_free(BANames);
905 he->
p.
argv= (
const char **) &field;
995 #if defined(RPM_VENDOR_OPENPKG)
1006 const char ** macro,
char *
lang)
1014 for (p = preambleList; p->
token != NULL; p++) {
1015 len = strlen(p->
token);
1029 if (tagp && p->
token == NULL) {
1037 if (aTags != NULL && aTags[0] != NULL) {
1040 #if defined(RPM_VENDOR_OPENPKG)
1041 av = argvSearchLinear(aTags, s, argvFnmatchCasefold);
1054 s = spec->
line + len;
1062 if (*s !=
':')
return 1;
1071 if (*s !=
'(')
return 1;
1078 if (*s !=
')')
return 1;
1081 if (*s !=
':')
return 1;
1106 strcpy(NVR,
"(main package)");
1111 assert(initialPackage);
1112 }
else if (! initialPackage) {
1131 for (lastpkg = spec->
packages; lastpkg->
next != NULL; lastpkg = lastpkg->
next)
1134 assert(lastpkg != NULL);
1135 lastpkg->
next = pkg;
1141 sprintf(NVR,
"%s-%s", he->
p.
str, name);
1159 const char * macro = NULL;
1165 if (*linep !=
'\0') {
1192 if (initialPackage) {
1193 const char *s =
rpmExpand(
"%{?buildroot}", NULL);
1195 (void)
addMacro(NULL,
"buildroot", NULL, s, -1);
1213 #ifdef RPM_VENDOR_PLD