} else if (flags & RPMSENSE_CONFLICTS) {
rpmMessage(RPMMESS_DEBUG, "Adding conflict: %s\n", name);
p->numConflict++;
- } else {
+ } else if (flags & RPMSENSE_PREREQ) {
+ rpmMessage(RPMMESS_DEBUG, "Adding prereq: %s\n", name);
+ p->numPreReq++;
+ } else {
rpmMessage(RPMMESS_DEBUG, "Adding require: %s\n", name);
p->numReq++;
}
char **nameArray, **namePtr;
char **versionArray, **versionPtr;
int_32 *flagArray, *flagPtr;
-
+ int x;
if (p->numProv) {
rd = p->reqprov;
free(flagArray);
}
- if (p->numReq) {
+ x = p->numReq + p->numPreReq;
+ if (x) {
rd = p->reqprov;
- nameArray = namePtr = malloc(p->numReq * sizeof(*nameArray));
- versionArray = versionPtr = malloc(p->numReq * sizeof(*versionArray));
- flagArray = flagPtr = malloc(p->numReq * sizeof(*flagArray));
- rpmMessage(RPMMESS_VERBOSE, "Requires (%d):", p->numReq);
+ nameArray = namePtr = malloc(x * sizeof(*nameArray));
+ versionArray = versionPtr = malloc(x * sizeof(*versionArray));
+ flagArray = flagPtr = malloc(x * sizeof(*flagArray));
+ rpmMessage(RPMMESS_VERBOSE, "[Pre]Requires (%d):", x);
while (rd) {
if (! ((rd->flags & RPMSENSE_PROVIDES) ||
(rd->flags & RPMSENSE_CONFLICTS))) {
- rpmMessage(RPMMESS_VERBOSE, " %s", rd->name);
+ if (rd->flags & RPMSENSE_PREREQ) {
+ rpmMessage(RPMMESS_VERBOSE, " [%s]", rd->name);
+ } else {
+ rpmMessage(RPMMESS_VERBOSE, " %s", rd->name);
+ }
*namePtr++ = rd->name;
*versionPtr++ = rd->version ? rd->version : "";
- *flagPtr++ = rd->flags & RPMSENSE_SENSEMASK;
+ *flagPtr++ = (rd->flags & RPMSENSE_SENSEMASK) |
+ (rd->flags & RPMSENSE_PREREQ);
}
rd = rd->next;
}
rpmMessage(RPMMESS_VERBOSE, "\n");
headerAddEntry(h, RPMTAG_REQUIRENAME, RPM_STRING_ARRAY_TYPE,
- nameArray, p->numReq);
+ nameArray, x);
headerAddEntry(h, RPMTAG_REQUIREVERSION, RPM_STRING_ARRAY_TYPE,
- versionArray, p->numReq);
+ versionArray, x);
headerAddEntry(h, RPMTAG_REQUIREFLAGS, RPM_INT32_TYPE,
- flagArray, p->numReq);
+ flagArray, x);
free(nameArray);
free(versionArray);
struct ReqComp *rc;
while (req || (req = strtok(line, " ,\t\n"))) {
- flags = (flag == RPMTAG_CONFLICTFLAGS) ?
- RPMSENSE_CONFLICTS : RPMSENSE_ANY;
+ switch (flag) {
+ case RPMTAG_CONFLICTFLAGS:
+ flags = RPMSENSE_CONFLICTS;
+ break;
+ case RPMTAG_PREREQ:
+ flags = RPMSENSE_PREREQ;
+ addReqProv(p, RPMSENSE_ANY, "/bin/sh", NULL);
+ break;
+ default:
+ flags = RPMSENSE_ANY;
+ break;
+ }
if (flag == RPMTAG_CONFLICTFLAGS && req[0] == '/') {
rpmError(RPMERR_BADSPEC,
"No file names in Conflicts: %s", req);
p->numReq = 0;
p->numProv = 0;
p->numConflict = 0;
+ p->numPreReq = 0;
p->trigger.alloced = 0;
p->trigger.used = 0;
p->trigger.triggerScripts = NULL;
{RPMTAG_ICON, 0, "icon"},
{RPMTAG_PROVIDES, 0, "provides"},
{RPMTAG_REQUIREFLAGS, 0, "requires"},
+ {RPMTAG_PREREQ, 0, "prereq"},
{RPMTAG_CONFLICTFLAGS, 0, "conflicts"},
{RPMTAG_DEFAULTPREFIX, 0, "prefix"},
{RPMTAG_BUILDROOT, 0, "buildroot"},
break;
case RPMTAG_REQUIREFLAGS:
case RPMTAG_CONFLICTFLAGS:
+ case RPMTAG_PREREQ:
if (parseRequiresConflicts(cur_package, s, tag)) {
return NULL;
}
StringBuf filelist;
StringBuf doc; /* Used to buffer up %doc lines until fully parsed */
int numReq;
+ int numPreReq;
int numProv;
int numConflict;
struct ReqProv *reqprov;
#define RPMTAG_CHANGELOGNAME 1081
#define RPMTAG_CHANGELOGTEXT 1082
#define RPMTAG_BROKENMD5 1083 /* internal */
+#define RPMTAG_PREREQ 1084 /* internal */
#define RPMTAG_EXTERNAL_TAG 1000000
#define RPMSENSE_EQUAL (1 << 3)
#define RPMSENSE_PROVIDES (1 << 4) /* only used internally by builds */
#define RPMSENSE_CONFLICTS (1 << 5) /* only used internally by builds */
-#define RPMSENSE_SENSEMASK 15 /* Mask to get senses */
+#define RPMSENSE_PREREQ (1 << 6)
+#define RPMSENSE_SENSEMASK 15 /* Mask to get senses, ie serial, */
+ /* less, greater, equal. */
#define RPMSENSE_TRIGGER_IN (1 << 16)
#define RPMSENSE_TRIGGER_UN (1 << 17)