Age | Commit message (Collapse) | Author | Files | Lines |
|
Change-Id: I2ae5a781db427a02c3622cb6d098eba65c889d5d
|
|
Change-Id: I0b2d02a582dfc2aecb95d4c0b817250fdd303ff0
|
|
Change-Id: Ifd629ba679a11ede4d831195c6aea2245efc3300
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
|
|
|
|
In order to make them modifiable by autotools.
|
|
A) use RPMTAG_SUGGESTS and RPMTAG_ENHANCES to store them.
This is different to upstream, which uses RPMSENSE_MISSINGOK
and RPMTAG_REQUIRES/RPMTAG_PROVIDES instead. I chose different
tags because I wanted to be compatible. The point is that
applications that don't know about the new MISSINGOK semantics
will mis-interpret the provides/requires otherwise, which
I deemed to risky.
B) use RPMSENSE_STRONG to support a "strong" version, "Recommends"
instead of "Suggests" and "Supplements" instead of "Enhances".
|
|
- RPMFILE_EXCLUDE only exists during spec parse, and doesn't "leak"
into headers only because the file is, well, excluded to start with.
Unexport the internal-only bit and explicitly strip out any excess
bits from data going to header. The current 16/16 split is artificial
of course, RPMTAG_FILEATTRS is 32bit so there's plenty of room
for growing new file attributes, with internal-only adjustments
required.
- Eliminate RPMFILE_UNPATCHED while at it, this is a leftover
from Suse patch rpms which are no longer used anywhere.
|
|
- The number of entries is well know, allocate the entire list at
once and set instead of appending one by one. Also cures a leak from
created tuples not being decref'ed before - list set steals the
reference whereas append requires an additional decref to transfer
the ownership to the list.
|
|
- We know the array size beforehand, allocate the entire array
at once and set the elements instead of appending one by one.
This is (an obvious) and well-measurable, if not a huge, win.
|
|
|
|
- Add NULL checks and add/adjust comments where appropriate.
- The remaining callers should handle NULL fi gracefully if not
entirely correctly: rpmfiFC() returns 0 on NULL fi, so these
callers just see the erronous file info set as "no files" case.
Something to fine-tune later...
|
|
- Ehm, this has been broken in the python bindings since the start,
nobody noticed. Of course the parent value isn't particularly
useful in normal usage but still...
|
|
- Fix misleading indentation, initialize Key on declaration.
No functional changes.
|
|
- Unused atm but we'll be adding this shortly
|
|
- Adds two new transaction callbacks: RPMCALLBACK_SCRIPT_START and
RPMCALLBACK_SCRIPT_STOP which get issued for every scriptlet we run.
- On script start, callback can optionally return an FD which will
override transaction-wide script fd to make it easier to accurately
collect per-scriptlet output (eg per-scriptlet temporary file).
Callback is also responsible for closing the fd if it returns one.
- For both callbacks, "amount" holds the script tag number. On stop
callback, "total" holds the scriptlet exit status mapped into
OK/NOTFOUND/FAIL for success/non-fatal/fatal errors. Abusing "notfound"
for warning result is ugly but differentiating it from the other
cases allows callers to ignore SCRIPT_ERROR if they choose to
implement stop and start.
|
|
Various Python method callbacks have signatures of the form:
static PyObject *
foo(some_object_subclass *obj)
and are registered within the PyMethodDef tables with the METH_NOARGS
flag [1], with a cast to (PyCFunction) due to the PyObject/subclass
mismatch.
However, such callbacks do receive two arguments: they are invoked with
a signature of this form:
static PyObject *
foo(some_object_subclass *obj, PyObject *ignored)
The CPython interpreter only uses METH_NOARGS to allow it to pass NULL as the
second parameter: there are still two parameters. The dispatch code is in
Python's Python/ceval.c:call_function:
if (flags & METH_NOARGS && na == 0) {
C_TRACE(x, (*meth)(self,NULL));
}
The fact that this has ever worked may be a coincidence of the
platform/compiler's calling conventions, and I don't think it's guaranteed to
keep working.
[1] http://docs.python.org/c-api/structures.html#METH_NOARGS
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
|
|
These lines within python/rpmfd-py.c: rpmfdFromPyObject
are the wrong way around:
Py_DECREF(fdo);
PyErr_SetString(PyExc_IOError, Fstrerror(fdo->fd));
If fdo was allocated by the call above to PyObject_CallFunctionObjArgs,
it may have an ob_refcnt == 1, and thus the Py_DECREF() frees it, so
fdo->fd is reading from deallocated memory.
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
|
|
- Various places within the bindings use PyArg_ParseTuple[AndKeywords] to
extract (char*) string arguments. These are pointers to the internal
representation of a PyStringObject, and shouldn't be modified, hence
it's safest to explicitly mark these values as (const char*), rather
than just (char*).
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
|
|
|
|
- Various functions in the Python bindings construct lists of objects, but
assume that all calls succeed. Each of these could segfault under
low-memory conditions: if the PyList_New() call fails,
PyList_Append(NULL, item ) will segfault. Similarly, although
Py_List_Append(list, NULL) is safe, Py_DECREF(NULL) will segfault.
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
|
|
- Various functions in the Python bindings have expressions of the form:
PyObject_Call(callable,
Py_BuildValue(fmtstring, ...), NULL);
This leaks memory for the case when Py_BuildValue succeeds (it returns a
new reference, which is never freed; PyObject_Call doesn't steal the
reference): the argument tuple and all of its components will not be
freed (until the process exits).
Signed-off-by: Ales Kozumplik <akozumpl@redhat.com>
|
|
|
|
- thanks zpavlas for pointing this out.
|
|
- rpm.header.new() will still keep accepting PyCObject for now in case a
client library depends on this.
- involves macro trickery to make rpm buildable against python 2.6 still.
|
|
|
|
|
|
- This should've been in commit f07ab5c1afa9b0b7105082a8617ec6a7657fc27e
|
|
|
|
|
|
- RPMDBI_BASENAMES (ugh) returns all headers with matching filenames,
whether the files are actually installed or not, which can be
rather misleading when dealing with file dependencies. The new
RPMDBI_INSTFILENAMES only returns headers with matching filenames
whose state indicates they are actually present on the system.
|
|
- Why the heck hasn't this been exported before, duh?
- Method name clear() chosen as this appears to be emerging as a
standard of sorts for this kind of operation: dictionaries and
sets have it and list will get it in some python 3.x version.
Additionally foo.empty() could easily be mistaken for "test whether
container foo is empty or not" (especially those with c++ background...)
|
|
- If fn to rpmReadPackageFile() is NULL, use Fdescr() value to give
more meaningful errors
- Change a couple of places where we haven't got a clue of the file
name to take advantage of the above
|
|
- Similarly to python file object having o.name, export Fdescr()
as fd.name. Python uses <foo> for non-paths but [foo] seems like
a safer choice wrt accidental redirections.
- Also add a basic testcase for fd.name
|
|
- Tags as header attributes seemed like a nice idea at the time... but
has been a PITA due to side-effects it causes, such as breaking
getattr() use for "capability testing", eg:
>>> h2 = copy.deepcopy(h)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/copy.py", line 172, in deepcopy
copier = getattr(x, "__deepcopy__", None)
ValueError: unknown header tag
- Since we can't really go removing the brainded feature (somebody might
actually be using it) try harder to fix it: if its not an actual
attribute, save the exception we got from PyObject_GenericGetAttr()
and if its not a valid tag either, restore the original exception.
This allows cases like the above __deepcopy__ to work properly.
|
|
- This allows header objects to be pickled and also copied correctly
with python's copy.copy()
- Split the header to string-conversion into a separate helper function,
used by the now largely unnecessary unload() method and __reduce__().
|
|
- Hasty push-finger syndrom, while its not exactly plain wrong to
do things this way, it doesn't really make sense for these types
either. Python's own file object permits reinitialization though,
so leaving rpm.fd() the way it is now.
- This reverts the following commits:
d056df28c38e602d82b4f9b527c686037074e660
3f77c3146da46a49f44b17fa66139fbe2dd9e45c
7214b2e0a271b7a7b3df312c58593878cbf56504
dc50fb2863c81159fb4cc8b25ce3862720c0cce5
|
|
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for tp_new.
|
|
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for tp_new.
|
|
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for
tp_new, eliminate internal rpmfi_Wrap() use.
There's one user for rpmfi_Wrap() in rpmte-py.c which needs fixing
later...
- Remove unused fiFromFi() helper function
|
|
- Specs are not really immutable, move the initialization work into
tp_init and use PyType_GenericNew for tp_new since we're not
doing anything special there.
- Eliminate the stupid spec_Wrap() thing and hide specPkg_Wrap()
out of side (TODO later...)
|
|
- FD's are not really immutable, move the initialization work into
tp_init and use PyType_GenericNew for tp_new since we're not
doing anything special there.
- Remove half a dozen different unnecessary exit points
|
|
|
|
- Kinda related to RhBug:661962, yum relies on callbacks to catch
install/erase errors but this is not accurate: on erase the
element can be ambiguous as the callback only gives a name (sigh).
In addition, elements can be skipped entirely if "parent" element
fails, in which case no callbacks are issued so these cases would go
completely unnoticed when relying on callbacks alone. te.Failed()
gives users such as yum a chance to have a look at the real status
of elements (after the transaction).
|
|
- ...means its been broken all along, sigh
|
|
|
|
- Oops. Quite obviously nobody has even tried to build this with
python < 2.6. Whether it'd actually work is another question...
|
|
- PyString is gone, use PyBytes instead
- Add compatibility defines to paper over
PyInt/PyLong_JustHowLongFunctionNamesYouCanComeUpWith()
|
|
- Steps towards separating rpm-python from the main rpm tarball even
though developed within the rpm repository.
- Having the bindings in a separate tarball makes it simpler to build
them for different python versions, notably python 3 (RhBug:531543)
|
|
- Include what little we need from standard headers instead
of relying on rpm source tree system.h for anything.
- Remove non-public includes from python binding include paths
|
|
|