return rc;
}
break;
+ case RPMTAG_BUILDREQUIRES:
+ case RPMTAG_BUILDCONFLICTS:
case RPMTAG_BUILDPREREQ:
case RPMTAG_REQUIREFLAGS:
case RPMTAG_CONFLICTFLAGS:
{RPMTAG_BUILDROOT, 0, 0, "buildroot"},
{RPMTAG_BUILDARCHS, 0, 0, "buildarchitectures"},
{RPMTAG_BUILDARCHS, 0, 0, "buildarch"},
+ {RPMTAG_BUILDCONFLICTS, 0, 0, "buildconflicts"},
{RPMTAG_BUILDPREREQ, 0, 0, "buildprereq"},
+ {RPMTAG_BUILDREQUIRES, 0, 0, "buildrequires"},
{RPMTAG_AUTOREQPROV, 0, 0, "autoreqprov"},
{RPMTAG_AUTOREQ, 0, 0, "autoreq"},
{RPMTAG_AUTOPROV, 0, 0, "autoprov"},
{ NULL, 0 },
};
-int parseRequiresConflicts(Spec spec, Package pkg, char *field,
+#define SKIPWHITE(_x) {while(*(_x) && (isspace(*_x) || *(_x) == ',')) (_x)++;}
+#define SKIPNONWHITE(_x){while(*(_x) &&!(isspace(*_x) || *(_x) == ',')) (_x)++;}
+
+int parseRequiresConflicts(Spec spec, Package pkg, const char *field,
int tag, int index)
{
- char buf[BUFSIZ], *bufp, *version, *name;
+ const char *r, *re, *v, *ve;
+ char *req, *version;
+ Header h;
int flags;
- char *req = NULL;
- struct ReqComp *rc;
-
- strcpy(buf, field);
- bufp = buf;
- while (req || (req = strtok(bufp, " ,\t\n"))) {
- bufp = NULL;
+ for (r = field; *r; r = re) {
+ SKIPWHITE(r);
+ if (*r == '\0')
+ break;
- if (tag == RPMTAG_CONFLICTFLAGS) {
- if (req[0] == '/') {
- rpmError(RPMERR_BADSPEC,
- _("line %d: No file names in Conflicts: %s"),
+ switch (tag) {
+ case RPMTAG_CONFLICTFLAGS:
+ if (r[0] == '/') {
+ rpmError(RPMERR_BADSPEC,_("line %d: File name not permitted: %s"),
+ spec->lineNum, spec->line);
+ return RPMERR_BADSPEC;
+ }
+ flags = RPMSENSE_CONFLICTS;
+ h = pkg->header;
+ break;
+ case RPMTAG_BUILDCONFLICTS:
+ if (r[0] == '/') {
+ rpmError(RPMERR_BADSPEC,_("line %d: File name not permitted: %s"),
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
flags = RPMSENSE_CONFLICTS;
- name = "Conflicts";
- } else if (tag == RPMTAG_PREREQ) {
+ h = spec->buildRestrictions;
+ break;
+ case RPMTAG_PREREQ:
flags = RPMSENSE_PREREQ;
- name = "PreReq";
- } else if (tag == RPMTAG_BUILDPREREQ) {
+ h = pkg->header;
+ break;
+ case RPMTAG_BUILDPREREQ:
flags = RPMSENSE_PREREQ;
- name = "BuildPreReq";
- } else if (tag == RPMTAG_TRIGGERIN) {
+ h = spec->buildRestrictions;
+ break;
+ case RPMTAG_TRIGGERIN:
flags = RPMSENSE_TRIGGERIN;
- name = "%triggerin";
- } else if (tag == RPMTAG_TRIGGERPOSTUN) {
+ h = pkg->header;
+ break;
+ case RPMTAG_TRIGGERPOSTUN:
flags = RPMSENSE_TRIGGERPOSTUN;
- name = "%triggerpostun";
- } else if (tag == RPMTAG_TRIGGERUN) {
+ h = pkg->header;
+ break;
+ case RPMTAG_TRIGGERUN:
flags = RPMSENSE_TRIGGERUN;
- name = "%triggerun";
- } else {
+ h = pkg->header;
+ break;
+ case RPMTAG_BUILDREQUIRES:
flags = RPMSENSE_ANY;
- name = "Requires";
+ h = spec->buildRestrictions;
+ break;
+ default:
+ case RPMTAG_REQUIREFLAGS:
+ flags = RPMSENSE_ANY;
+ h = pkg->header;
+ break;
}
- if ((version = strtok(NULL, " ,\t\n"))) {
- rc = ReqComparisons;
- while (rc->token && strcmp(version, rc->token)) {
- rc++;
+ re = r;
+ SKIPNONWHITE(re);
+ req = malloc((re-r) + 1);
+ strncpy(req, r, (re-r));
+ req[re-r] = '\0';
+
+ /* Parse version */
+ v = re;
+ SKIPWHITE(v);
+ ve = v;
+ SKIPNONWHITE(ve);
+
+ /* Check for possible logical operator */
+ if (ve > v) {
+ struct ReqComp *rc;
+ for (rc = ReqComparisons; rc->token != NULL; rc++) {
+ if (strncmp(v, rc->token, (ve-v)))
+ continue;
+
+ if (r[0] == '/') {
+ rpmError(RPMERR_BADSPEC,
+ _("line %d: Versioned file name not permitted: %s"),
+ spec->lineNum, spec->line);
+ return RPMERR_BADSPEC;
}
- if (rc->token) {
- if (req[0] == '/') {
- rpmError(RPMERR_BADSPEC,
- _("line %d: No versions on file names in %s: %s"),
- spec->lineNum, name, spec->line);
- return RPMERR_BADSPEC;
- }
- if (tag == RPMTAG_PREREQ) {
- rpmError(RPMERR_BADSPEC,
- _("line %d: No versions in PreReq: %s"),
- spec->lineNum, spec->line);
- return RPMERR_BADSPEC;
- }
- /* read a version */
- flags |= rc->sense;
- version = strtok(NULL, " ,\t\n");
+ switch(tag) {
+ case RPMTAG_BUILDPREREQ:
+ case RPMTAG_PREREQ:
+ rpmError(RPMERR_BADSPEC,
+ _("line %d: Version not permitted: %s"),
+ spec->lineNum, spec->line);
+ return RPMERR_BADSPEC;
+ break;
+ default:
+ break;
}
- }
+ flags |= rc->sense;
- if ((flags & RPMSENSE_SENSEMASK) && !version) {
- rpmError(RPMERR_BADSPEC,
- _("line %d: Version required in %s: %s"),
- spec->lineNum, name, spec->line);
- return RPMERR_BADSPEC;
+ /* now parse version */
+ v = ve;
+ SKIPWHITE(v);
+ ve = v;
+ SKIPNONWHITE(ve);
+ break;
+ }
}
- addReqProv(spec,
- (tag == RPMTAG_BUILDPREREQ ? spec->buildRestrictions : pkg->header),
- flags, req, (flags & RPMSENSE_SENSEMASK) ? version : NULL, index);
+ if (flags & RPMSENSE_SENSEMASK) {
+ if (*v == '\0' || ve == v) {
+ rpmError(RPMERR_BADSPEC, _("line %d: Version required: %s"),
+ spec->lineNum, spec->line);
+ return RPMERR_BADSPEC;
+ }
+ version = malloc((ve-v) + 1);
+ strncpy(version, v, (ve-v));
+ version[ve-v] = '\0';
+ } else
+ version = NULL;
+
+ addReqProv(spec, h, flags, req, version, index);
- /* If there is no sense, we just read the next token */
- req = (flags & RPMSENSE_SENSEMASK) ? NULL : version;
+ if (req) free(req);
+ if (version) free(version);
+
+ re = ve;
}
return 0;
}
-int parseProvidesObsoletes(Spec spec, Package pkg, char *field, int tag)
+int parseProvidesObsoletes(Spec spec, Package pkg, const char *field, int tag)
{
- char *prov, buf[BUFSIZ], *line;
+ const char *p, *pe;
+ char *prov;
int flags;
flags = (tag == RPMTAG_PROVIDES) ? RPMSENSE_PROVIDES : RPMSENSE_OBSOLETES;
- strcpy(buf, field);
- line = buf;
-
- while ((prov = strtok(line, " ,\t\n"))) {
- if (prov[0] == '/' && tag != RPMTAG_PROVIDES) {
+ for (p = field; *p; p = pe) {
+ SKIPWHITE(p);
+ if (*p == '\0')
+ break;
+
+ if (p[0] == '/' && tag != RPMTAG_PROVIDES) {
rpmError(RPMERR_BADSPEC,
_("line %d: No file names in Obsoletes: %s"),
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
- if (!(isalnum(prov[0]) || prov[0] == '_') &&
- (tag == RPMTAG_OBSOLETES || prov[0] != '/')) {
+ if (!(isalnum(p[0]) || p[0] == '_') &&
+ (tag == RPMTAG_OBSOLETES || p[0] != '/')) {
rpmError(RPMERR_BADSPEC,
- _("line %d: %s: tokens must begin with alpha-numeric: %s"),
- spec->lineNum,
- (tag == RPMTAG_PROVIDES) ? "Provides" : "Obsoletes",
- spec->line);
+ _("line %d: tokens must begin with alpha-numeric: %s"),
+ spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
+
+ pe = p;
+ SKIPNONWHITE(pe);
+ prov = malloc((pe-p) + 1);
+ strncpy(prov, p, (pe-p));
+ prov[pe-p] = '\0';
addReqProv(spec, pkg->header, flags, prov, NULL, 0);
- line = NULL;
+ free(prov);
}
return 0;
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-05-25 16:14-0400\n"
+"POT-Creation-Date: 1999-05-25 23:43-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "line %d: Epoch/Serial field must be a number: %s"
msgstr ""
-#: ../build/parsePreamble.c:524
+#: ../build/parsePreamble.c:526
#, c-format
msgid "line %d: Bad BuildArchitecture format: %s"
msgstr ""
-#: ../build/parsePreamble.c:534
+#: ../build/parsePreamble.c:536
#, c-format
msgid "Internal error: Bogus tag %d"
msgstr ""
-#: ../build/parsePreamble.c:679
+#: ../build/parsePreamble.c:683
#, c-format
msgid "Bad package specification: %s"
msgstr ""
-#: ../build/parsePreamble.c:685
+#: ../build/parsePreamble.c:689
#, c-format
msgid "Package already exists: %s"
msgstr ""
-#: ../build/parsePreamble.c:712
+#: ../build/parsePreamble.c:716
#, c-format
msgid "line %d: Unknown tag: %s"
msgstr ""
-#: ../build/parsePreamble.c:737
+#: ../build/parsePreamble.c:741
msgid "Spec file can't use BuildRoot"
msgstr ""
msgid "line %d: second %%prep"
msgstr ""
-#: ../build/parseReqs.c:45
+#: ../build/parseReqs.c:47 ../build/parseReqs.c:56
#, c-format
-msgid "line %d: No file names in Conflicts: %s"
+msgid "line %d: File name not permitted: %s"
msgstr ""
-#: ../build/parseReqs.c:79
+#: ../build/parseReqs.c:115
#, c-format
-msgid "line %d: No versions on file names in %s: %s"
+msgid "line %d: Versioned file name not permitted: %s"
msgstr ""
-#: ../build/parseReqs.c:85
+#: ../build/parseReqs.c:123
#, c-format
-msgid "line %d: No versions in PreReq: %s"
+msgid "line %d: Version not permitted: %s"
msgstr ""
-#: ../build/parseReqs.c:97
+#: ../build/parseReqs.c:143
#, c-format
-msgid "line %d: Version required in %s: %s"
+msgid "line %d: Version required: %s"
msgstr ""
-#: ../build/parseReqs.c:126
+#: ../build/parseReqs.c:179
#, c-format
msgid "line %d: No file names in Obsoletes: %s"
msgstr ""
-#: ../build/parseReqs.c:133
+#: ../build/parseReqs.c:186
#, c-format
-msgid "line %d: %s: tokens must begin with alpha-numeric: %s"
+msgid "line %d: tokens must begin with alpha-numeric: %s"
msgstr ""
#: ../build/parseScript.c:138
msgid "missing ':' at %s:%d"
msgstr ""
-#: ../lib/rpmrc.c:656 ../lib/rpmrc.c:729
+#: ../lib/rpmrc.c:656 ../lib/rpmrc.c:730
#, c-format
msgid "missing argument for %s at %s:%d"
msgstr ""
msgid "cannot open %s at %s:%d"
msgstr ""
-#: ../lib/rpmrc.c:721
+#: ../lib/rpmrc.c:722
#, c-format
msgid "missing architecture for %s at %s:%d"
msgstr ""
-#: ../lib/rpmrc.c:788
+#: ../lib/rpmrc.c:789
#, c-format
msgid "bad option '%s' at %s:%d"
msgstr ""
-#: ../lib/rpmrc.c:1124
+#: ../lib/rpmrc.c:1125
#, c-format
msgid "Unknown system: %s\n"
msgstr ""
-#: ../lib/rpmrc.c:1125
+#: ../lib/rpmrc.c:1126
msgid "Please contact rpm-list@redhat.com\n"
msgstr ""