Patch: SRPM install nag me patch

Paul Nasrat <pauln-xGvoirzvwgBWk0Htik3J/[email protected]> Fri, 14 Nov 2003 21:18:21 +0000
Newsgroups gmane.linux.redhat.rpm.python
Message-ID <[email protected]>
This isn't the right fix but it's a nag me until I can I can fix properly.

Views? Feedback? Wrong type of PyError?

[[email protected] python]$ python rpm-inst.py
Traceback (most recent call last):
  File "rpm-inst.py", line 19, in ?
    ts.addInstall(hdr, (hdr,rpmloc), "i")
rpm.error: SRPM install not supported

Paul
rpm-4.2.1-python-srpm.patch (text/plain, 477 B)
--- rpm-4.2.1/python/rpmts-py.c.psn	2003-11-03 16:10:23.000000000 +0000
+++ rpm-4.2.1/python/rpmts-py.c	2003-11-03 16:10:29.000000000 +0000
@@ -239,6 +239,11 @@
     } else if (how && !strcmp(how, "u"))
     	isUpgrade = 1;
 
+    if (headerIsEntry(hdrGetHeader(h),RPMTAG_SOURCEPACKAGE)) {
+	PyErr_SetString(pyrpmError, "SRPM install not supported");
+	return NULL;
+    }
+
     if (how && !strcmp(how, "a"))
 	rpmtsAddAvailableElement(s->ts, hdrGetHeader(h), key);
     else