blob: 7a473db1adba5719d2b3a5526e56cf21a4dbd5df [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001Fix an issue where the PACKAGEORIGIN is not properly stored.
2
3Restore the rpmtsCallback fdSetOpen call and related code.
4
5Upstream-Status: Submitted [RPM5 maintainer]
6
7Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
8
9Index: rpm/python/rpmts-py.c
10===================================================================
11--- rpm.orig/python/rpmts-py.c
12+++ rpm/python/rpmts-py.c
13@@ -672,6 +672,8 @@ rpmtsCallback(const void * hd, const rpm
14 Header h = (Header) hd;
15 struct rpmtsCallbackType_s * cbInfo = data;
16 PyObject * pkgObj = (PyObject *) pkgKey;
17+ PyObject * oh = NULL;
18+ const char * origin = NULL;
19 PyObject * args, * result;
20 static FD_t fd;
21
22@@ -693,8 +695,16 @@ rpmtsCallback(const void * hd, const rpm
23 pkgObj = Py_None;
24 Py_INCREF(pkgObj);
25 }
26- } else
27+ } else {
28 Py_INCREF(pkgObj);
29+ /* XXX yum has (h, rpmloc) tuple as pkgKey. Extract the path. */
30+ if (!(PyTuple_Check(pkgObj) && PyArg_ParseTuple(pkgObj, "|Os", &oh, &origin)))
31+ origin = NULL;
32+ /* XXX clean up the path, yum paths start "//..." */
33+ if (origin && origin[0] == '/' && origin[1] == '/')
34+ origin++;
35+ }
36+
37
38 PyEval_RestoreThread(cbInfo->_save);
39
40@@ -723,6 +733,9 @@ SPEW((stderr, "\t%p = fdDup(%d)\n", fd,
41
42 fcntl(Fileno(fd), F_SETFD, FD_CLOEXEC);
43
44+ if (origin != NULL)
45+ (void) fdSetOpen(fd, origin, 0, 0);
46+
47 return fd;
48 } else
49 if (what == RPMCALLBACK_INST_CLOSE_FILE) {