#define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
-int parseRCPOT(Spec spec, Package pkg, const char *field, int tag,
+int parseRCPOT(Spec spec, Package pkg, const char *field, rpmTag tagN,
int index, rpmsenseFlags tagflags)
{
const char *r, *re, *v, *ve;
- char * req, * version;
+ char * N, * EVR;
+ rpmsenseFlags Flags;
Header h;
- rpmsenseFlags flags;
- switch (tag) {
+ switch (tagN) {
case RPMTAG_PROVIDEFLAGS:
tagflags |= RPMSENSE_PROVIDES;
h = pkg->header;
if (*r == '\0')
break;
- flags = (tagflags & ~RPMSENSE_SENSEMASK);
+ Flags = (tagflags & ~RPMSENSE_SENSEMASK);
/* Tokens must begin with alphanumeric, _, or / */
if (!(xisalnum(r[0]) || r[0] == '_' || r[0] == '/')) {
}
/* Don't permit file names as args for certain tags */
- switch (tag) {
+ switch (tagN) {
case RPMTAG_OBSOLETEFLAGS:
case RPMTAG_CONFLICTFLAGS:
case RPMTAG_BUILDCONFLICTS:
re = r;
SKIPNONWHITE(re);
- req = xmalloc((re-r) + 1);
- strncpy(req, r, (re-r));
- req[re-r] = '\0';
+ N = xmalloc((re-r) + 1);
+ strncpy(N, r, (re-r));
+ N[re-r] = '\0';
- /* Parse version */
+ /* Parse EVR */
v = re;
SKIPWHITE(v);
ve = v;
SKIPNONWHITE(ve);
- re = v; /* ==> next token (if no version found) starts here */
+ re = v; /* ==> next token (if no EVR found) starts here */
/* Check for possible logical operator */
if (ve > v) {
return RPMERR_BADSPEC;
}
- switch(tag) {
+ switch(tagN) {
case RPMTAG_BUILDPREREQ:
case RPMTAG_PREREQ:
case RPMTAG_PROVIDEFLAGS:
default:
/*@switchbreak@*/ break;
}
- flags |= rc->sense;
+ Flags |= rc->sense;
- /* now parse version */
+ /* now parse EVR */
v = ve;
SKIPWHITE(v);
ve = v;
}
/*@-branchstate@*/
- if (flags & RPMSENSE_SENSEMASK) {
+ if (Flags & RPMSENSE_SENSEMASK) {
if (*v == '\0' || ve == v) {
rpmError(RPMERR_BADSPEC, _("line %d: Version required: %s\n"),
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
- version = xmalloc((ve-v) + 1);
- strncpy(version, v, (ve-v));
- version[ve-v] = '\0';
- re = ve; /* ==> next token after version string starts here */
+ EVR = xmalloc((ve-v) + 1);
+ strncpy(EVR, v, (ve-v));
+ EVR[ve-v] = '\0';
+ re = ve; /* ==> next token after EVR string starts here */
} else
- version = NULL;
+ EVR = NULL;
/*@=branchstate@*/
- (void) addReqProv(spec, h, flags, req, version, index);
+ (void) addReqProv(spec, h, tagN, N, EVR, Flags, index);
- req = _free(req);
- version = _free(version);
+ N = _free(N);
+ EVR = _free(EVR);
}
/*@=boundsread@*/
const char **progArgv = NULL;
int progArgc;
char *partname = NULL;
- int reqtag = 0;
- int tag = 0;
+ rpmTag reqtag = 0;
+ rpmTag tag = 0;
int tagflags = 0;
- int progtag = 0;
+ rpmTag progtag = 0;
int flag = PART_SUBNAME;
Package pkg;
StringBuf sb = NULL;
rc = RPMERR_BADSPEC;
goto exit;
} else {
- (void) addReqProv(spec, pkg->header, (tagflags | RPMSENSE_INTERP), progArgv[0], NULL, 0);
+ (void) addReqProv(spec, pkg->header, RPMTAG_REQUIRENAME,
+ progArgv[0], NULL, (tagflags | RPMSENSE_INTERP), 0);
}
/* Trigger script insertion is always delayed in order to */
ch = ' ';
while (*from && ch != '\n')
ch = *to++ = *from++;
+/*@-mods@*/
spec->lbufPtr = to;
+/*@=mods@*/
*to++ = '\0';
ofi->readPtr = from;
switch (*p) {
case '\\':
switch (*(p+1)) {
- case '\n': p++, nc = 1; break;
- case '\0': break;
- default: p++; break;
+ case '\n': p++, nc = 1; /*@innerbreak@*/ break;
+ case '\0': /*@innerbreak@*/ break;
+ default: p++; /*@innerbreak@*/ break;
}
- break;
- case '\n': nc = 0; break;
+ /*@switchbreak@*/ break;
+ case '\n': nc = 0; /*@switchbreak@*/ break;
case '%':
switch (*(p+1)) {
- case '{': p++, bc++; break;
- case '(': p++, pc++; break;
- case '%': p++; break;
+ case '{': p++, bc++; /*@innerbreak@*/ break;
+ case '(': p++, pc++; /*@innerbreak@*/ break;
+ case '%': p++; /*@innerbreak@*/ break;
}
- break;
- case '{': if (bc > 0) bc++; break;
- case '}': if (bc > 0) bc--; break;
- case '(': if (pc > 0) pc++; break;
- case ')': if (pc > 0) pc--; break;
+ /*@switchbreak@*/ break;
+ case '{': if (bc > 0) bc++; /*@switchbreak@*/ break;
+ case '}': if (bc > 0) bc--; /*@switchbreak@*/ break;
+ case '(': if (pc > 0) pc++; /*@switchbreak@*/ break;
+ case ')': if (pc > 0) pc--; /*@switchbreak@*/ break;
}
}
/* If it doesn't, ask for one more line. We need a better
* error code for this. */
if (pc || bc || nc ) {
+/*@-observertrans -readonlytrans@*/
spec->nextline = "";
+/*@=observertrans =readonlytrans@*/
return RPMERR_UNMATCHEDIF;
}
+/*@-mods@*/
spec->lbufPtr = spec->lbuf;
+/*@=mods@*/
/* Don't expand macros (eg. %define) in false branch of %if clause */
if (spec->readStack->reading &&
#include "rpmbuild.h"
#include "debug.h"
-int addReqProv(/*@unused@*/ Spec spec, Header h,
- rpmsenseFlags depFlags, const char *depName, const char *depEVR,
+int addReqProv(/*@unused@*/ Spec spec, Header h, /*@unused@*/ rpmTag tagN,
+ const char * N, const char * EVR, rpmsenseFlags Flags,
int index)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
rpmsenseFlags extra = RPMSENSE_ANY;
int xx;
- if (depFlags & RPMSENSE_PROVIDES) {
+ if (Flags & RPMSENSE_PROVIDES) {
nametag = RPMTAG_PROVIDENAME;
versiontag = RPMTAG_PROVIDEVERSION;
flagtag = RPMTAG_PROVIDEFLAGS;
- extra = depFlags & RPMSENSE_FIND_PROVIDES;
- } else if (depFlags & RPMSENSE_OBSOLETES) {
+ extra = Flags & RPMSENSE_FIND_PROVIDES;
+ } else if (Flags & RPMSENSE_OBSOLETES) {
nametag = RPMTAG_OBSOLETENAME;
versiontag = RPMTAG_OBSOLETEVERSION;
flagtag = RPMTAG_OBSOLETEFLAGS;
- } else if (depFlags & RPMSENSE_CONFLICTS) {
+ } else if (Flags & RPMSENSE_CONFLICTS) {
nametag = RPMTAG_CONFLICTNAME;
versiontag = RPMTAG_CONFLICTVERSION;
flagtag = RPMTAG_CONFLICTFLAGS;
- } else if (depFlags & RPMSENSE_PREREQ) {
+ } else if (Flags & RPMSENSE_PREREQ) {
nametag = RPMTAG_REQUIRENAME;
versiontag = RPMTAG_REQUIREVERSION;
flagtag = RPMTAG_REQUIREFLAGS;
- extra = depFlags & _ALL_REQUIRES_MASK;
- } else if (depFlags & RPMSENSE_TRIGGER) {
+ extra = Flags & _ALL_REQUIRES_MASK;
+ } else if (Flags & RPMSENSE_TRIGGER) {
nametag = RPMTAG_TRIGGERNAME;
versiontag = RPMTAG_TRIGGERVERSION;
flagtag = RPMTAG_TRIGGERFLAGS;
indextag = RPMTAG_TRIGGERINDEX;
- extra = depFlags & RPMSENSE_TRIGGER;
+ extra = Flags & RPMSENSE_TRIGGER;
} else {
nametag = RPMTAG_REQUIRENAME;
versiontag = RPMTAG_REQUIREVERSION;
flagtag = RPMTAG_REQUIREFLAGS;
- extra = depFlags & _ALL_REQUIRES_MASK;
+ extra = Flags & _ALL_REQUIRES_MASK;
}
- depFlags = (depFlags & RPMSENSE_SENSEMASK) | extra;
+ Flags = (Flags & RPMSENSE_SENSEMASK) | extra;
/*@-branchstate@*/
- if (depEVR == NULL)
- depEVR = "";
+ if (EVR == NULL)
+ EVR = "";
/*@=branchstate@*/
/* Check for duplicate dependencies. */
/*@-boundsread@*/
while (len > 0) {
len--;
- if (strcmp(names[len], depName))
+ if (strcmp(names[len], N))
continue;
if (flagtag && versions != NULL &&
- (strcmp(versions[len], depEVR) || flags[len] != depFlags))
+ (strcmp(versions[len], EVR) || flags[len] != Flags))
continue;
if (indextag && indexes != NULL && indexes[len] != index)
continue;
}
/* Add this dependency. */
- xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &depName, 1);
+ xx = headerAddOrAppendEntry(h, nametag, RPM_STRING_ARRAY_TYPE, &N, 1);
if (flagtag) {
xx = headerAddOrAppendEntry(h, versiontag,
- RPM_STRING_ARRAY_TYPE, &depEVR, 1);
+ RPM_STRING_ARRAY_TYPE, &EVR, 1);
xx = headerAddOrAppendEntry(h, flagtag,
- RPM_INT32_TYPE, &depFlags, 1);
+ RPM_INT32_TYPE, &Flags, 1);
}
if (indextag)
xx = headerAddOrAppendEntry(h, indextag, RPM_INT32_TYPE, &index, 1);
(void) stpcpy( stpcpy( stpcpy(reqname, "rpmlib("), feature), ")");
/* XXX 1st arg is unused */
- return addReqProv(NULL, h, RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL),
- reqname, featureEVR, 0);
+ return addReqProv(NULL, h, RPMTAG_REQUIRENAME, reqname, featureEVR,
+ RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL), 0);
}
/*@=boundswrite@*/
* @param tagflags dependency flags already known from context
* @return 0 on success, RPMERR_BADSPEC on failure
*/
-int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
- rpmsenseFlags tagflags)
+int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN,
+ int index, rpmsenseFlags tagflags)
/*@globals rpmGlobalMacroContext, h_errno @*/
/*@modifies rpmGlobalMacroContext @*/;
* Add dependency to header, filtering duplicates.
* @param spec spec file control structure
* @param h header
- * @param depFlags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<")
- * @param depName (e.g. Requires: foo < 0:1.2-3, "foo")
- * @param depEVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3")
+ * @param tagN tag, identifies type of dependency
+ * @param N (e.g. Requires: foo < 0:1.2-3, "foo")
+ * @param EVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3")
+ * @param Flags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<")
* @param index (0 always)
* @return 0 always
*/
-int addReqProv(/*@unused@*/Spec spec, Header h,
- rpmsenseFlags depFlags, const char * depName,
- const char * depEVR, int index)
+int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN,
+ const char * N, const char * EVR, rpmsenseFlags Flags,
+ int index)
/*@modifies h @*/;
/** \ingroup rpmbuild
/*@owned@*/
struct OpenFileInfo * fileStack;
char lbuf[10*BUFSIZ];
+/*@dependent@*/
char *lbufPtr;
char nextpeekc;
/*@dependent@*/