summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-12-30 00:03:53 +0000
committerjbj <devnull@localhost>2002-12-30 00:03:53 +0000
commit1b8508adc27371a944e730c218364eea110f8d9f (patch)
treea5eadf32f3716fb4e196289a59ea3f0635cfc3a8
parentcb4b0b8ce12baa3ec035f91e4bd5ad4c0cfa1886 (diff)
downloadlibrpm-tizen-1b8508adc27371a944e730c218364eea110f8d9f.tar.gz
librpm-tizen-1b8508adc27371a944e730c218364eea110f8d9f.tar.bz2
librpm-tizen-1b8508adc27371a944e730c218364eea110f8d9f.zip
- use rpmfiFDepends() underneath --fileprovide/--filerequire.
CVS patchset: 5986 CVS date: 2002/12/30 00:03:53
-rw-r--r--CHANGES3
-rw-r--r--lib/rpmfi.c133
-rw-r--r--python/rpmfi-py.c24
-rw-r--r--rpm.spec.in3
4 files changed, 88 insertions, 75 deletions
diff --git a/CHANGES b/CHANGES
index 37e90cca5..3ab58afd7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -87,7 +87,8 @@
- don't segfault with packages produced by rpm-2.93 (#80618).
- python: eliminate hash.[ch] and upgrade.[ch], methods too.
- fix :armor query extension, tgpg mktmp handling (#80684).
- - use rpmfiClass() underneath --fileclass.
+ - use rpmfiFClass() underneath --fileclass.
+ - use rpmfiFDepends() underneath --fileprovide/--filerequire.
4.0.4 -> 4.1:
- loosely wire beecrypt library into rpm.
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index ebe5eb7b5..79176fa90 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1103,7 +1103,7 @@ rpmfi rpmfiNew(rpmts ts, Header h, rpmTag tagN, int scareMem)
xx = hge(h, RPMTAG_DEPENDSDICT, NULL, (void **) &fi->ddict, &fi->nddict);
xx = hge(h, RPMTAG_FILEDEPENDSX, NULL, (void **) &fi->fddictx, NULL);
- xx = hge(h, RPMTAG_FILEDEPENDSN, NULL, (void **) &fi->fddictx, NULL);
+ xx = hge(h, RPMTAG_FILEDEPENDSN, NULL, (void **) &fi->fddictn, NULL);
xx = hge(h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
if (xx == 0 || fi->fstates == NULL)
@@ -1227,9 +1227,9 @@ void rpmfiBuildFClasses(Header h,
{
int scareMem = 1;
rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
- int ac;
- const char ** av;
const char * FClass;
+ const char ** av;
+ int ac;
size_t nb;
char * t;
@@ -1281,105 +1281,92 @@ void rpmfiBuildFDeps(Header h, rpmTag tagN,
/*@out@*/ const char *** fdepsp, /*@out@*/ int * fcp)
{
int scareMem = 1;
- HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- HFD_t hfd = headerFreeData;
+ rpmfi fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, scareMem);
+ rpmds ds = NULL;
+ const char ** av;
+ int ac;
+ size_t nb;
+ char * t;
char deptype = 'R';
char mydt;
- rpmds ds;
const char * DNEVR;
const int_32 * ddict;
- const int_32 * fddictx;
- const int_32 * fddictn;
- int_32 nddict, nfddictx, nfddictn;
- const char ** av;
- int_32 ac = 0;
- size_t nb;
- rpmTagType ddt, fxt, fnt;
- char * t;
unsigned ix;
- int dx, ndx, i, xx;
+ int ndx;
- if (!hge(h, RPMTAG_FILESIZES, NULL, (void **) NULL, &ac) || ac == 0) {
- if (fdepsp) *fdepsp = NULL;
- if (fcp) *fcp = 0;
- return; /* no file list */
+ if ((ac = rpmfiFC(fi)) <= 0) {
+ av = NULL;
+ ac = 0;
+ goto exit;
}
if (tagN == RPMTAG_PROVIDENAME)
deptype = 'P';
else if (tagN == RPMTAG_REQUIRENAME)
deptype = 'R';
- ds = rpmdsNew(h, tagN, scareMem);
- fddictn = NULL;
- nfddictn = 0;
- xx = hge(h, RPMTAG_FILEDEPENDSN, &fnt, (void **) &fddictn, &nfddictn);
- fddictx = NULL;
- nfddictx = 0;
- xx = hge(h, RPMTAG_FILEDEPENDSX, &fxt, (void **) &fddictx, &nfddictx);
- ddict = NULL;
- nddict = 0;
- xx = hge(h, RPMTAG_DEPENDSDICT, &ddt, (void **) &ddict, &nddict);
+ ds = rpmdsNew(h, tagN, scareMem);
+ /* Compute size of file depends argv array blob. */
nb = (ac + 1) * sizeof(*av);
- for (i = 0; i < ac; i++) {
- if (fddictx != NULL && fddictn != NULL) {
- dx = fddictx[i];
- ndx = fddictn[i];
- if (ddict != NULL)
- while (ndx-- > 0) {
- ix = ddict[dx++];
- mydt = ((ix >> 24) & 0xff);
- if (mydt != deptype)
- /*@innercontinue@*/ continue;
- ix &= 0x00ffffff;
- (void) rpmdsSetIx(ds, ix-1);
- if (rpmdsNext(ds) < 0)
- /*@innercontinue@*/ continue;
- DNEVR = rpmdsDNEVR(ds);
- if (DNEVR != NULL)
- nb += strlen(DNEVR+2) + 1;
- }
+ fi = rpmfiInit(fi, 0);
+ if (fi != NULL)
+ while (rpmfiNext(fi) >= 0) {
+ ddict = NULL;
+ ndx = rpmfiFDepends(fi, &ddict);
+ if (ddict != NULL)
+ while (ndx-- > 0) {
+ ix = *ddict++;
+ mydt = ((ix >> 24) & 0xff);
+ if (mydt != deptype)
+ /*@innercontinue@*/ continue;
+ ix &= 0x00ffffff;
+ (void) rpmdsSetIx(ds, ix-1);
+ if (rpmdsNext(ds) < 0)
+ /*@innercontinue@*/ continue;
+ DNEVR = rpmdsDNEVR(ds);
+ if (DNEVR != NULL)
+ nb += strlen(DNEVR+2) + 1;
}
nb += 1;
}
+ /* Create and load file depends argv array. */
av = xmalloc(nb);
t = ((char *) av) + ((ac + 1) * sizeof(*av));
+ ac = 0;
/*@-branchstate@*/
- for (i = 0; i < ac; i++) {
- av[i] = t;
- if (fddictx != NULL && fddictn != NULL) {
- dx = fddictx[i];
- ndx = fddictn[i];
- if (ddict != NULL)
- while (ndx-- > 0) {
- ix = ddict[dx++];
- mydt = ((ix >> 24) & 0xff);
- if (mydt != deptype)
- /*@innercontinue@*/ continue;
- ix &= 0x00ffffff;
- (void) rpmdsSetIx(ds, ix-1);
- if (rpmdsNext(ds) < 0)
- /*@innercontinue@*/ continue;
- DNEVR = rpmdsDNEVR(ds);
- if (DNEVR != NULL) {
- t = stpcpy(t, DNEVR+2);
- *t++ = ' ';
- *t = '\0';
- }
+ fi = rpmfiInit(fi, 0);
+ if (fi != NULL)
+ while (rpmfiNext(fi) >= 0) {
+ av[ac++] = t;
+ ddict = NULL;
+ ndx = rpmfiFDepends(fi, &ddict);
+ if (ddict != NULL)
+ while (ndx-- > 0) {
+ ix = *ddict++;
+ mydt = ((ix >> 24) & 0xff);
+ if (mydt != deptype)
+ /*@innercontinue@*/ continue;
+ ix &= 0x00ffffff;
+ (void) rpmdsSetIx(ds, ix-1);
+ if (rpmdsNext(ds) < 0)
+ /*@innercontinue@*/ continue;
+ DNEVR = rpmdsDNEVR(ds);
+ if (DNEVR != NULL) {
+ t = stpcpy(t, DNEVR+2);
+ *t++ = ' ';
+ *t = '\0';
}
}
*t++ = '\0';
}
- av[ac] = NULL;
/*@=branchstate@*/
+ av[ac] = NULL;
- ddict = hfd(ddict, ddt);
- fddictx = hfd(fddictx, fxt);
- fddictn = hfd(fddictn, fnt);
+exit:
+ fi = rpmfiFree(fi);
ds = rpmdsFree(ds);
-
/*@-branchstate@*/
if (fdepsp)
*fdepsp = av;
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index f1e4c42a2..5da279885 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -183,6 +183,26 @@ rpmfi_FGroup(rpmfiObject * s, PyObject * args)
return Py_BuildValue("s", xstrdup(rpmfiFGroup(s->fi)));
}
+static PyObject *
+rpmfi_FColor(rpmfiObject * s, PyObject * args)
+ /*@*/
+{
+ if (!PyArg_ParseTuple(args, ":FColor")) return NULL;
+ return Py_BuildValue("i", rpmfiFColor(s->fi));
+}
+
+static PyObject *
+rpmfi_FClass(rpmfiObject * s, PyObject * args)
+ /*@*/
+{
+ const char * FClass;
+
+ if (!PyArg_ParseTuple(args, ":FClass")) return NULL;
+ if ((FClass = rpmfiFClass(s->fi)) == NULL)
+ FClass = "";
+ return Py_BuildValue("s", xstrdup(FClass));
+}
+
#if Py_TPFLAGS_HAVE_ITER
static PyObject *
rpmfi_iter(rpmfiObject * s, /*@unused@*/ PyObject * args)
@@ -353,6 +373,10 @@ static struct PyMethodDef rpmfi_methods[] = {
NULL},
{"FGroup", (PyCFunction)rpmfi_FGroup, METH_VARARGS,
NULL},
+ {"FColor", (PyCFunction)rpmfi_FColor, METH_VARARGS,
+ NULL},
+ {"FClass", (PyCFunction)rpmfi_FClass, METH_VARARGS,
+ NULL},
{"next", (PyCFunction)rpmfi_Next, METH_VARARGS,
"fi.next() -> (FN, FSize, FMode, FMtime, FFlags, FRdev, FInode, FNlink, FState, VFlags, FUser, FGroup, FMD5))\n\
- Retrieve next file info tuple.\n" },
diff --git a/rpm.spec.in b/rpm.spec.in
index cb69b2eec..ee8e541c5 100644
--- a/rpm.spec.in
+++ b/rpm.spec.in
@@ -463,7 +463,8 @@ exit 0
- don't segfault with packages produced by rpm-2.93 (#80618).
- python: eliminate hash.[ch] and upgrade.[ch], methods too.
- fix :armor query extension, tgpg mktmp handling (#80684).
-- use rpmfiClass() underneath --fileclass.
+- use rpmfiFClass() underneath --fileclass.
+- use rpmfiFDepends() underneath --fileprovide/--filerequire.
* Sat Dec 28 2002 Jeff Johnson <jbj@redhat.com> 4.2-0.45
- error if querying with iterator on different sized arrays.