summaryrefslogtreecommitdiff
path: root/python/header-py.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-08-05 21:46:50 +0000
committerjbj <devnull@localhost>2002-08-05 21:46:50 +0000
commit5211039a20762b4a50c006ccf79666bff34967c2 (patch)
tree2e001628b1b88572c14d0b5975535985ef1b01ff /python/header-py.c
parentbd5ee7affaa5f350c03fba20952b7a16e1311c4e (diff)
downloadrpm-5211039a20762b4a50c006ccf79666bff34967c2.tar.gz
rpm-5211039a20762b4a50c006ccf79666bff34967c2.tar.bz2
rpm-5211039a20762b4a50c006ccf79666bff34967c2.zip
- python: the death of rpmdb-py.[ch], use ts.fooDB() methods instead.
- python: the death of rpm.headerFromPackage(), use ts.hdrFromFdno(). - python: permit direct ts.dbMatch() python iterations. - python: the death of rpm.checksig(), use ts.hdrFromFdno() instead. CVS patchset: 5603 CVS date: 2002/08/05 21:46:50
Diffstat (limited to 'python/header-py.c')
-rw-r--r--python/header-py.c60
1 files changed, 11 insertions, 49 deletions
diff --git a/python/header-py.c b/python/header-py.c
index 978fbc1a8..422bc36e7 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -33,16 +33,21 @@
* Header objects can be returned by database queries or loaded from a
* binary package on disk.
*
- * The headerFromPackage function returns the package header from a
- * package on disk.
+ * The ts.hdrFromFdno() function returns the package header from a
+ * package on disk, verifying package signatures and digests of the
+ * package while reading.
+ *
+ * Note: The older method rpm.headerFromPackage() which has been replaced
+ * by ts.hdrFromFdno() used to return a (hdr, isSource) tuple.
*
- * Note: rpm.headerFromPackage() used to return a (hdr, isSource) tuple.
* If you need to distinguish source/binary headers, do:
* \code
* import os, rpm
*
- * fd = os.open("/tmp/foo-1.0-1.i386.rpm", os.O_RDONLY)
- * hdr = rpm.headerFromPackage(fd)
+ * ts = rpm.TranssactionSet()
+ * fdno = os.open("/tmp/foo-1.0-1.i386.rpm", os.O_RDONLY)
+ * hdr = ts.hdrFromFdno(fdno)
+ * os.close(fdno)
* if hdr[rpm.RPMTAG_SOURCEPACKAGE]:
* print "header is from a source package"
* else:
@@ -72,7 +77,7 @@
* print hdr['release']
* \endcode
*
- * This method of access is a bit slower because the name must be
+ * This method of access is a teensy bit slower because the name must be
* translated into the tag number dynamically. You also must make sure
* the strings in header lookups don't get translated, or the lookups
* will fail.
@@ -866,49 +871,6 @@ Header hdrGetHeader(hdrObject * s)
}
/**
- * @deprecated Use ts.hdrFromFdno() instead.
- */
-PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args)
-{
- hdrObject * hdr;
- Header h;
- FD_t fd;
- int rawFd;
- rpmRC rc;
-
- if (!PyArg_ParseTuple(args, "i", &rawFd)) return NULL;
-
- fd = fdDup(rawFd);
- { rpmts ts;
- ts = rpmtsCreate();
- rc = rpmReadPackageFile(ts, fd, "rpmHeaderFromPackage", &h);
- rpmtsFree(ts);
- }
- Fclose(fd);
-
- switch (rc) {
- case RPMRC_BADSIZE:
- case RPMRC_OK:
- hdr = hdr_Wrap(h);
- h = headerFree(h); /* XXX ref held by hdr */
- break;
-
- case RPMRC_NOTFOUND:
- Py_INCREF(Py_None);
- hdr = (hdrObject *) Py_None;
- break;
-
- case RPMRC_FAIL:
- case RPMRC_SHORTREAD:
- default:
- PyErr_SetString(pyrpmError, "error reading package");
- return NULL;
- }
-
- return Py_BuildValue("N", hdr);
-}
-
-/**
*/
PyObject * hdrLoad(PyObject * self, PyObject * args)
{