diff options
author | root <devnull@localhost> | 1996-06-07 18:31:08 +0000 |
---|---|---|
committer | root <devnull@localhost> | 1996-06-07 18:31:08 +0000 |
commit | cab11b049002d17022f64d03f55d1f1229cd4391 (patch) | |
tree | a7baef78068b18d92992fec174711ca3f82b4e94 /build | |
parent | 081d340a210fb263b19f9cd8df42f92eaf5043ab (diff) | |
download | rpm-cab11b049002d17022f64d03f55d1f1229cd4391.tar.gz rpm-cab11b049002d17022f64d03f55d1f1229cd4391.tar.bz2 rpm-cab11b049002d17022f64d03f55d1f1229cd4391.zip |
wrap up req/dep
CVS patchset: 618
CVS date: 1996/06/07 18:31:08
Diffstat (limited to 'build')
-rw-r--r-- | build/spec.c | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/build/spec.c b/build/spec.c index 636a6a0dc..a83b35f79 100644 --- a/build/spec.c +++ b/build/spec.c @@ -26,6 +26,7 @@ TODO: #include "rpmlib.h" #include "stringbuf.h" #include "misc.h" +#include "reqprov.h" #define LINE_BUF_SIZE 1024 #define FREE(x) { if (x) free(x); } @@ -44,9 +45,10 @@ static int lookup_package(Spec s, struct PackageRec **pr, static void dumpPackage(struct PackageRec *p, FILE *f); static void parseForDocFiles(struct PackageRec *package, char *line); + static int parseProvides(struct PackageRec *p, char *line); static int parseRequires(struct PackageRec *p, char *line); -void free_reqprov(struct ReqProv *p); +static void free_reqprov(struct ReqProv *p); /**********************************************************************/ /* */ @@ -191,42 +193,20 @@ char *getFullSource(Spec s, int ispatch, int num) /* */ /**********************************************************************/ -int addReqProv(struct PackageRec *p, int flags, - char *name, char *version) -{ - struct ReqProv *rd; - - rd = (struct ReqProv *)malloc(sizeof(*rd)); - rd->flags = flags; - rd->name = strdup(name); - rd->version = version ? strdup(version) : NULL; - rd->next = p->reqprov; - p->reqprov = rd; - - if (flags & REQUIRE_PROVIDES) { - message(MESS_DEBUG, "Adding provide: %s\n", name); - p->numProv++; - } else { - message(MESS_DEBUG, "Adding require: %s\n", name); - p->numReq++; - } - - return 0; -} - -static int parseProvides(struct PackageRec *p, char *line) +static void free_reqprov(struct ReqProv *p) { - char *prov; - int flags = REQUIRE_PROVIDES; + struct ReqProv *s; - while ((prov = strtok(line, " ,\t\n"))) { - addReqProv(p, flags, prov, NULL); - line = NULL; + while (p) { + s = p; + p = p->next; + FREE(s->name); + FREE(s->version); + free(s); } - return 0; } -struct ReqComp { +static struct ReqComp { char *token; int flags; } ReqComparisons[] = { @@ -257,7 +237,7 @@ static int parseRequires(struct PackageRec *p, char *line) struct ReqComp *rc; while (req || (req = strtok(line, " ,\t\n"))) { - flags = 0; + flags = REQUIRE_ANY; if ((version = strtok(NULL, " ,\t\n"))) { rc = ReqComparisons; while (rc->token && strcmp(version, rc->token)) { @@ -287,22 +267,15 @@ static int parseRequires(struct PackageRec *p, char *line) return 0; } -void free_reqprov(struct ReqProv *p) +static int parseProvides(struct PackageRec *p, char *line) { - struct ReqProv *s; + char *prov; + int flags = REQUIRE_PROVIDES; - while (p) { - s = p; - p = p->next; - FREE(s->name); - FREE(s->version); - free(s); + while ((prov = strtok(line, " ,\t\n"))) { + addReqProv(p, flags, prov, NULL); + line = NULL; } -} - -int addReqProvHeaderEntry(Header h, struct PackageRec *p) -{ - message(MESS_DEBUG, "provides: %d\nrequires: %d\n", p->numProv, p->numReq); return 0; } |