- python: include instance in IDTXload, filename in IDTXglob, return
- python: argument to ts.addErase (if integer) deletes that instance. - python: rpmmi methods to return this instance, and number of members. CVS patchset: 5620 CVS date: 2002/08/09 23:14:10
This commit is contained in:
parent
7937158c01
commit
644401875d
3
CHANGES
3
CHANGES
|
@ -230,6 +230,9 @@
|
|||
- python: add return codes for rollbacks and fooDB methods.
|
||||
- avoid generating fingerprints for locale/zoneinfo sub-directories.
|
||||
- python: add (optional) ts.check() callback.
|
||||
- python: include instance in IDTXload, filename in IDTXglob, return
|
||||
- python: argument to ts.addErase (if integer) deletes that instance.
|
||||
- python: rpmmi methods to return this instance, and number of members.
|
||||
|
||||
4.0.3 -> 4.0.4:
|
||||
- solaris: translate i86pc to i386 (#57182).
|
||||
|
|
|
@ -119,6 +119,42 @@ rpmmi_Next(rpmmiObject * s, PyObject *args)
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static PyObject *
|
||||
rpmmi_Instance(rpmmiObject * s, PyObject * args)
|
||||
/*@globals _Py_NoneStruct @*/
|
||||
/*@modifies s, _Py_NoneStruct @*/
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ":Instance"))
|
||||
return NULL;
|
||||
|
||||
if (s->mi)
|
||||
rc = rpmdbGetIteratorOffset(s->mi);
|
||||
|
||||
return Py_BuildValue("i", rc);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static PyObject *
|
||||
rpmmi_Count(rpmmiObject * s, PyObject * args)
|
||||
/*@globals _Py_NoneStruct @*/
|
||||
/*@modifies s, _Py_NoneStruct @*/
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!PyArg_ParseTuple(args, ":Instance"))
|
||||
return NULL;
|
||||
|
||||
if (s->mi)
|
||||
rc = rpmdbGetIteratorCount(s->mi);
|
||||
|
||||
return Py_BuildValue("i", rc);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static PyObject *
|
||||
|
@ -154,6 +190,10 @@ static struct PyMethodDef rpmmi_methods[] = {
|
|||
{"next", (PyCFunction) rpmmi_Next, METH_VARARGS,
|
||||
"mi.next() -> hdr\n\
|
||||
- Retrieve next header that matches. Iterate directly in python if possible.\n" },
|
||||
{"instance", (PyCFunction) rpmmi_Instance, METH_VARARGS,
|
||||
NULL },
|
||||
{"count", (PyCFunction) rpmmi_Count, METH_VARARGS,
|
||||
NULL },
|
||||
{"pattern", (PyCFunction) rpmmi_Pattern, METH_VARARGS,
|
||||
"mi.pattern(TagN, mire_type, pattern)\n\
|
||||
- Set a secondary match pattern on tags from retrieved header.\n" },
|
||||
|
|
|
@ -246,30 +246,54 @@ rpmts_AddErase(rpmtsObject * s, PyObject * args)
|
|||
/*@globals _Py_NoneStruct @*/
|
||||
/*@modifies s, _Py_NoneStruct @*/
|
||||
{
|
||||
char * name;
|
||||
PyObject * o;
|
||||
int count;
|
||||
rpmdbMatchIterator mi;
|
||||
|
||||
if (_rpmts_debug)
|
||||
fprintf(stderr, "*** rpmts_AddErase(%p) ts %p\n", s, s->ts);
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:AddErase", &name))
|
||||
if (!PyArg_ParseTuple(args, "O:AddErase", &o))
|
||||
return NULL;
|
||||
|
||||
mi = rpmtsInitIterator(s->ts, RPMDBI_LABEL, name, 0);
|
||||
count = rpmdbGetIteratorCount(mi);
|
||||
if (count <= 0) {
|
||||
PyErr_SetString(pyrpmError, "package not installed");
|
||||
return NULL;
|
||||
} else { /* XXX: Note that we automatically choose to remove all matches */
|
||||
Header h;
|
||||
while ((h = rpmdbNextIterator(mi)) != NULL) {
|
||||
unsigned int recOffset = rpmdbGetIteratorOffset(mi);
|
||||
if (recOffset)
|
||||
rpmtsAddEraseElement(s->ts, h, recOffset);
|
||||
if (PyString_Check(o)) {
|
||||
char * name = PyString_AsString(o);
|
||||
|
||||
mi = rpmtsInitIterator(s->ts, RPMDBI_LABEL, name, 0);
|
||||
count = rpmdbGetIteratorCount(mi);
|
||||
if (count <= 0) {
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
PyErr_SetString(pyrpmError, "package not installed");
|
||||
return NULL;
|
||||
} else { /* XXX: Note that we automatically choose to remove all matches */
|
||||
Header h;
|
||||
while ((h = rpmdbNextIterator(mi)) != NULL) {
|
||||
unsigned int recOffset = rpmdbGetIteratorOffset(mi);
|
||||
if (recOffset)
|
||||
rpmtsAddEraseElement(s->ts, h, recOffset);
|
||||
}
|
||||
}
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
} else
|
||||
if (PyInt_Check(o)) {
|
||||
uint_32 instance = PyInt_AsLong(o);
|
||||
|
||||
mi = rpmtsInitIterator(s->ts, RPMDBI_PACKAGES, &instance, sizeof(instance));
|
||||
if (instance <= 0 || mi == NULL) {
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
PyErr_SetString(pyrpmError, "package not installed");
|
||||
return NULL;
|
||||
} else {
|
||||
Header h;
|
||||
while ((h = rpmdbNextIterator(mi)) != NULL) {
|
||||
uint_32 recOffset = rpmdbGetIteratorOffset(mi);
|
||||
if (recOffset)
|
||||
rpmtsAddEraseElement(s->ts, h, recOffset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
}
|
||||
rpmdbFreeIterator(mi);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
@ -326,7 +350,7 @@ rpmts_Check(rpmtsObject * s, PyObject * args)
|
|||
int i;
|
||||
int xx;
|
||||
|
||||
pemset(&cbInfo, 0, sizeof(cbInfo));
|
||||
memset(&cbInfo, 0, sizeof(cbInfo));
|
||||
if (!PyArg_ParseTuple(args, "|O:Check", &cbInfo.cb))
|
||||
return NULL;
|
||||
|
||||
|
@ -495,7 +519,7 @@ fprintf(stderr, "*** rpmts_IDTXload(%p) ts %p\n", s, s->ts);
|
|||
result = PyTuple_New(idtx->nidt);
|
||||
for (i = 0; i < idtx->nidt; i++) {
|
||||
idt = idtx->idt + i;
|
||||
tuple = Py_BuildValue("(iO)", idt->val.u32, hdr_Wrap(idt->h));
|
||||
tuple = Py_BuildValue("(iOi)", idt->val.u32, hdr_Wrap(idt->h), idt->instance);
|
||||
PyTuple_SET_ITEM(result, i, tuple);
|
||||
}
|
||||
}
|
||||
|
@ -539,7 +563,7 @@ fprintf(stderr, "*** rpmts_IDTXglob(%p) ts %p\n", s, s->ts);
|
|||
result = PyTuple_New(idtx->nidt);
|
||||
for (i = 0; i < idtx->nidt; i++) {
|
||||
idt = idtx->idt + i;
|
||||
tuple = Py_BuildValue("(iO)", idt->val.u32, hdr_Wrap(idt->h));
|
||||
tuple = Py_BuildValue("(iOs)", idt->val.u32, hdr_Wrap(idt->h), idt->key);
|
||||
PyTuple_SET_ITEM(result, i, tuple);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ Name: rpm
|
|||
%define version @VERSION@
|
||||
Version: %{version}
|
||||
%{expand: %%define rpm_version %{version}}
|
||||
Release: 0.76
|
||||
Release: 0.77
|
||||
Group: System Environment/Base
|
||||
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
|
||||
Copyright: GPL
|
||||
|
@ -517,10 +517,13 @@ fi
|
|||
%{__prefix}/include/popt.h
|
||||
|
||||
%changelog
|
||||
* Fri Aug 9 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.76
|
||||
* Fri Aug 9 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.77
|
||||
- python: add return codes for rollbacks and fooDB methods.
|
||||
- avoid generating fingerprints for locale/zoneinfo sub-directories.
|
||||
- python: add (optional) ts.check() callback.
|
||||
- python: include instance in IDTXload, filename in IDTXglob, return
|
||||
- python: argument to ts.addErase (if integer) deletes that instance.
|
||||
- python: rpmmi methods to return this instance, and number of members.
|
||||
|
||||
* Wed Aug 7 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.75
|
||||
- fix: src.rpm installs need fd pos at payload.
|
||||
|
|
Loading…
Reference in New Issue