summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-05-23 10:27:15 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-05-23 10:27:15 +0300
commitff0620c3ea7caee6ed7a3d6420b932e546a0854c (patch)
tree46bd1e6fb51b661a05d35b1d885aace23092168e /python
parentd9281caad55627c7e9c33fa6ccdfb88a44bf78c6 (diff)
downloadrpm-ff0620c3ea7caee6ed7a3d6420b932e546a0854c.tar.gz
rpm-ff0620c3ea7caee6ed7a3d6420b932e546a0854c.tar.bz2
rpm-ff0620c3ea7caee6ed7a3d6420b932e546a0854c.zip
Raise an exception if adding an install/upgrade element to transaction fails.
Diffstat (limited to 'python')
-rw-r--r--python/rpmts-py.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index e697303cd..8f08868ba 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -224,6 +224,7 @@ rpmts_AddInstall(rpmtsObject * s, PyObject * args, PyObject * kwds)
char * how = "u"; /* XXX default to upgrade element if missing */
int isUpgrade = 0;
char * kwlist[] = {"header", "key", "how", NULL};
+ int rc = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O|s:AddInstall", kwlist,
&hdr_Type, &h, &key, &how))
@@ -248,7 +249,12 @@ fprintf(stderr, "*** rpmts_AddInstall(%p,%p,%p,%s) ts %p\n", s, h, key, how, s->
if (how && !strcmp(how, "a"))
rpmtsAddAvailableElement(s->ts, hdrGetHeader(h), key);
else
- rpmtsAddInstallElement(s->ts, hdrGetHeader(h), key, isUpgrade, NULL);
+ rc = rpmtsAddInstallElement(s->ts, hdrGetHeader(h), key, isUpgrade, NULL);
+ if (rc) {
+ PyErr_SetString(pyrpmError, "adding package to transaction failed");
+ return NULL;
+ }
+
/* This should increment the usage count for me */
if (key)