summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-09-21 09:58:46 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-09-21 09:58:46 +0300
commit91a2f856c8c428993d80e1fe24ae9656dc5596a1 (patch)
tree55b782f8eadba6eea628e3220e4bfe8bde95d667 /lib
parent97f6e790bbea6154fda27fcd733f1e2c8812f0c5 (diff)
downloadrpm-91a2f856c8c428993d80e1fe24ae9656dc5596a1.tar.gz
rpm-91a2f856c8c428993d80e1fe24ae9656dc5596a1.tar.bz2
rpm-91a2f856c8c428993d80e1fe24ae9656dc5596a1.zip
Remove unused proof-of-concept arch-filtering of dependencies
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmds.c147
-rw-r--r--lib/rpmds.h2
2 files changed, 1 insertions, 148 deletions
diff --git a/lib/rpmds.c b/lib/rpmds.c
index e903ec27b..18a6d7fb8 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 c0c7dc1da..e4b251b7c 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);