From 91a2f856c8c428993d80e1fe24ae9656dc5596a1 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 21 Sep 2007 09:58:46 +0300 Subject: [PATCH] Remove unused proof-of-concept arch-filtering of dependencies --- build/rpmfc.c | 4 +- lib/rpmds.c | 147 ---------------------------------------------------------- lib/rpmds.h | 2 +- 3 files changed, 3 insertions(+), 150 deletions(-) diff --git a/build/rpmfc.c b/build/rpmfc.c index 5b33b91..06f914a 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -1363,7 +1363,7 @@ static void printDeps(Header h) { DepMsg_t dm; rpmds ds = NULL; - int flags = 0x2; /* XXX no filtering, !scareMem */ + int flags = 0; /* XXX !scareMem */ const char * DNEVR; int_32 Flags; int bingo = 0; @@ -1482,7 +1482,7 @@ int rpmfcGenerateDepends(const Spec spec, Package pkg) rpmfi fi = pkg->cpioList; rpmfc fc = NULL; rpmds ds; - int flags = 0x2; /* XXX no filtering, !scareMem */ + int flags = 0; /* XXX !scareMem */ ARGV_t av; int_16 * fmode; int ac = rpmfiFC(fi); diff --git a/lib/rpmds.c b/lib/rpmds.c index e903ec2..18a6d7f 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -94,153 +94,9 @@ fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count); return NULL; } -static const char * beehiveToken = "redhatbuilddependency"; - -/** - * Return archScore filter boolean. - * @param arch beehive arch score token - * @returns 0 == false, 1 == true - */ -static int archFilter(const char * arch) -{ - static int oneshot = 0; - int negate = 0; /* assume no negation. */ - int rc = 0; /* assume arch does not apply */ - - if (*arch == '!') { - negate = 1; - arch++; - } - if (*arch == '=') { - const char * myarch = NULL; - arch++; - - if (oneshot <= 0) { - rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS); - rpmSetMachine(NULL, NULL); - oneshot++; - } - rpmGetMachine(&myarch, NULL); - if (myarch != NULL) { - if (negate) - rc = (!strcmp(arch, myarch) ? 0 : 1); - else - rc = (!strcmp(arch, myarch) ? 1 : 0); -if (_rpmds_debug < 0) -fprintf(stderr, "=== strcmp(\"%s\", \"%s\") negate %d rc %d\n", arch, myarch, negate, rc); - } - } else { - int archScore = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch); - if (negate) - rc = (archScore > 0 ? 0 : 1); - else - rc = (archScore > 0 ? 1 : 0); -if (_rpmds_debug < 0) -fprintf(stderr, "=== archScore(\"%s\") %d negate %d rc %d\n", arch, archScore, negate, rc); - } - return rc; -} - -/** - * Filter dependency set, removing "foo(bar,i386,=s390,!sparcv8)" wrapper. - * @param ds dependency set - * @param token namespace string - * @returns filtered dependency set - */ -static rpmds rpmdsFilter(rpmds ds, - const char * token) -{ - size_t toklen; - rpmds fds; - int i; - - if (ds == NULL || token == NULL || *token == '\0') - goto exit; - - toklen = strlen(token); - fds = rpmdsLink(ds, ds->Type); - fds = rpmdsInit(ds); - if (fds != NULL) - while ((i = rpmdsNext(fds)) >= 0) { - const char * N = rpmdsN(fds); - const char * gN; - const char * f, * fe; - const char * g, * ge; - size_t len; - int ignore; - int state; - char buf[1024+1]; - int nb; - - if (N == NULL) - continue; - len = strlen(N); - if (len < (toklen + (sizeof("()")-1))) - continue; - if (strncmp(N, token, toklen)) - continue; - if (*(f = N + toklen) != '(') - continue; - if (*(fe = N + len - 1) != ')') - continue; -if (_rpmds_debug < 0) -fprintf(stderr, "*** f \"%s\"\n", f); - g = f + 1; - state = 0; - gN = NULL; - ignore = 1; /* assume depedency will be skipped. */ - for (ge = (char *) g; ge < fe; g = ++ge) { - while (ge < fe && *ge != ':') - ge++; - - nb = (ge - g); - if (nb < 0 || nb > (sizeof(buf)-1)) - nb = sizeof(buf) - 1; - (void) strncpy(buf, g, nb); - buf[nb] = '\0'; - switch (state) { - case 0: /* g is unwrapped N */ - gN = xstrdup(buf); - break; - default: /* g is next arch score token. */ - /* arch score tokens are compared assuming || */ - if (archFilter(buf)) - ignore = 0; - break; - } - state++; - } - if (ignore) { - int Count = rpmdsCount(fds); -if (_rpmds_debug < 0) -fprintf(stderr, "*** deleting N[%d:%d] = \"%s\"\n", i, Count, N); - if (i < (Count - 1)) { - memmove((fds->N + i), (fds->N + i + 1), (Count - (i+1)) * sizeof(*fds->N)); - if (fds->EVR != NULL) - memmove((fds->EVR + i), (fds->EVR + i + 1), (Count - (i+1)) * sizeof(*fds->EVR)); - if (fds->Flags != NULL) - memmove((fds->Flags + i), (fds->Flags + i + 1), (Count - (i+1)) * sizeof(*fds->Flags)); - fds->i--; - } - fds->Count--; - } else if (gN != NULL) { - char * t = (char *) N; - (void) strcpy(t, gN); -if (_rpmds_debug < 0) -fprintf(stderr, "*** unwrapping N[%d] = \"%s\"\n", i, N); - } - gN = _free(gN); - } - fds = rpmdsFree(fds); - -exit: - return ds; -} - rpmds rpmdsNew(Header h, rpmTag tagN, int flags) { int scareMem = (flags & 0x1); - int nofilter = (flags & 0x2); HGE_t hge = (scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry); rpmTag tagBT = RPMTAG_BUILDTIME; @@ -315,9 +171,6 @@ exit: /* FIX: ds->Flags may be NULL */ ds = rpmdsLink(ds, (ds ? ds->Type : NULL)); - if (!nofilter) - ds = rpmdsFilter(ds, beehiveToken); - return ds; } diff --git a/lib/rpmds.h b/lib/rpmds.h index c0c7dc1..e4b251b 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -83,7 +83,7 @@ rpmds rpmdsFree(rpmds ds); * @deprecated Only scareMem = 0 will be permitted. * @param h header * @param tagN type of dependency - * @param flags scareMem(0x1), nofilter(0x2) + * @param flags scareMem(0x1) * @return new dependency set */ rpmds rpmdsNew(Header h, rpmTag tagN, int flags); -- 2.7.4