15 #define _RPMEVR_INTERNAL
16 #define _RPMTAG_INTERNAL
75 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
80 xx = poptParseArgvString(line, &argc, &argv);
109 se = strchr(spec->
line,
'#');
112 while (--se >= spec->
line && strchr(
" \t\n\r", *se) != NULL)
118 (void)strtok(s,
" \t\n");
120 if (!(se = strtok(NULL,
" \t\n")))
123 if (!strcmp(se,
"-n")) {
124 if (!(se = strtok(NULL,
" \t\n"))) {
135 rc = (strtok(NULL,
" \t\n") ? 1 : 0);
147 return ((!s || (s[0] ==
'n' || s[0] ==
'N' || s[0] ==
'0') ||
162 {
"interp", RPMSENSE_INTERP },
163 {
"preun", RPMSENSE_SCRIPT_PREUN },
164 {
"pre", RPMSENSE_SCRIPT_PRE },
165 {
"postun", RPMSENSE_SCRIPT_POSTUN },
166 {
"post", RPMSENSE_SCRIPT_POST },
167 {
"rpmlib", RPMSENSE_RPMLIB },
168 {
"verify", RPMSENSE_SCRIPT_VERIFY },
169 {
"hint", RPMSENSE_MISSINGOK },
177 {
"prep", RPMSENSE_SCRIPT_PREP },
178 {
"build", RPMSENSE_SCRIPT_BUILD },
179 {
"install", RPMSENSE_SCRIPT_INSTALL },
180 {
"clean", RPMSENSE_SCRIPT_CLEAN },
181 {
"hint", RPMSENSE_MISSINGOK },
198 while ((c = *s) &&
xisspace(c)) s++;
200 while ((c = *se) &&
xisalpha(c)) se++;
203 for (tb = tokbits; tb->
name; tb++) {
204 if (tb->
name != NULL &&
205 strlen(tb->
name) == (
size_t)(se-s) && !strncmp(tb->
name, s, (se-s)))
208 if (tb->
name == NULL)
211 while ((c = *se) &&
xisspace(c)) se++;
217 if (c == 0 && bp) *bp =
bits;
227 char *se = s + strlen(s);
230 while (--se > s && strchr(
" \t\n\r", *se) != NULL)
233 if ((se = strchr(s,
'#')) != NULL) {
235 while (--se > s && strchr(
" \t\n\r", *se) != NULL)
249 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
275 const char *arch =
rpmExpand(
"%{_target_cpu}", NULL);
276 const char *os =
rpmExpand(
"%{_target_os}", NULL);
317 _(
"%s field must be present in package: %s\n"),
336 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
345 if (he->
tag != lastTag) {
372 { 0xffffffff,
"%{class}" },
382 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
393 if (tag == 0xffffffff) {
402 if (val && *val !=
'%') {
419 static size_t iconsize = 0;
420 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
421 const char *fn, *Lurlfn = NULL;
435 icon =
alloca(iconsize+1);
437 for (sp = spec->
sources; sp != NULL; sp = sp->
next) {
446 #if defined(RPM_VENDOR_OPENPKG)
451 if (access(Lurlfn,
F_OK) == -1) {
452 Lurlfn =
_free(Lurlfn);
460 urltype =
urlPath(Lurlfn, &fn);
475 fd =
Fopen(fn,
"r%{?_rpmgio}");
476 if (fd == NULL ||
Ferror(fd)) {
484 nb =
Fread(icon,
sizeof(icon[0]), iconsize, fd);
485 if (
Ferror(fd) || nb == 0) {
490 if (nb >= iconsize) {
496 if (icon[0] ==
'G' && icon[1] ==
'I' && icon[2] ==
'F')
499 if (icon[0] ==
'/' && icon[1] ==
'*' && icon[2] ==
' '
500 && icon[3] ==
'X' && icon[4] ==
'P' && icon[5] ==
'M')
515 Lurlfn =
_free(Lurlfn);
521 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
553 #define SINGLE_TOKEN_ONLY \
555 rpmlog(RPMLOG_ERR, _("line %d: Tag takes single token only: %s\n"), \
556 spec->lineNum, spec->line); \
567 const char * tagN =
tagName(tag);
568 const char * pattern =
rpmExpand(
"%{?pattern_", tagN,
"}", NULL);
571 if (pattern && *pattern) {
592 pattern =
_free(pattern);
600 const char *macro,
const char *
lang)
609 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
610 char * field = spec->
line;
618 #if defined(RPM_VENDOR_MANDRIVA)
619 char * expand_field = NULL;
624 while ((*field) && (*field !=
':'))
639 #if defined(RPM_VENDOR_MANDRIVA)
650 #if defined(RPM_VENDOR_MANDRIVA)
658 #if defined(RPM_VENDOR_MANDRIVA)
674 if (strchr(field,
'-') != NULL) {
681 if (strchr(field,
'-') != NULL) {
696 #if defined(RPM_VENDOR_OPENPKG)
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;
994 #if defined(RPM_VENDOR_OPENPKG)
1005 const char ** macro,
char *
lang)
1013 for (p = preambleList; p->
token != NULL; p++) {
1014 len = strlen(p->
token);
1028 if (tagp && p->
token == NULL) {
1036 if (aTags != NULL && aTags[0] != NULL) {
1039 #if defined(RPM_VENDOR_OPENPKG)
1040 av = argvSearchLinear(aTags, s, argvFnmatchCasefold);
1053 s = spec->
line + len;
1061 if (*s !=
':')
return 1;
1070 if (*s !=
'(')
return 1;
1077 if (*s !=
')')
return 1;
1080 if (*s !=
':')
return 1;
1096 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
1105 strcpy(NVR,
"(main package)");
1110 assert(initialPackage);
1111 }
else if (! initialPackage) {
1129 for (lastpkg = spec->
packages; lastpkg->
next != NULL; lastpkg = lastpkg->
next)
1132 assert(lastpkg != NULL);
1133 lastpkg->
next = pkg;
1139 sprintf(NVR,
"%s-%s", he->
p.
str, name);
1157 const char * macro = NULL;
1163 if (*linep !=
'\0') {
1190 if (initialPackage) {
1191 const char *s =
rpmExpand(
"%{?buildroot}", NULL);
1193 (void)
addMacro(NULL,
"buildroot", NULL, s, -1);
1211 #ifdef RPM_VENDOR_PLD