Panu Matilainen [Mon, 5 Oct 2009 14:23:34 +0000 (17:23 +0300)]
Dont leak memory from rpm.fi() methods
- Py_BuildValue() always copies the data mallocing here is just wrong
Panu Matilainen [Mon, 5 Oct 2009 13:42:52 +0000 (16:42 +0300)]
Handle all rpmds variants in its constructor
- either it takes a header + tag, or (name, flags, version) tuple + tag
to generate a single dep
- push rpm.dsSingle() compatibility out to python side
- hdr.dsFromHeader() and hdr.dsOfHeader() no longer need to be in rpmds-py.c
Panu Matilainen [Mon, 5 Oct 2009 12:38:45 +0000 (15:38 +0300)]
rpmdb open failing is certainly an rpm error, not TypeError
Panu Matilainen [Mon, 5 Oct 2009 12:36:54 +0000 (15:36 +0300)]
Dead code removal
Panu Matilainen [Mon, 5 Oct 2009 12:25:59 +0000 (15:25 +0300)]
Permit threads during rpmReadPackageFile()
Panu Matilainen [Mon, 5 Oct 2009 12:22:12 +0000 (15:22 +0300)]
Type mismatch is TypeError, not rpm.error
Panu Matilainen [Mon, 5 Oct 2009 12:19:01 +0000 (15:19 +0300)]
Push hdrFromFdno() error code handling over to python side
- return (rpmrc, header) tuple from C to let python do whatever it
wishes with the information
- let python side worry about generating backwards compatible returns
Panu Matilainen [Mon, 5 Oct 2009 11:55:37 +0000 (14:55 +0300)]
Push hdrCheck() error code handling over to python side
- return (rpmrc, message) tuple from C to let python do whatever it
wishes with the information
- let python side worry about generating backwards compatible returns
Panu Matilainen [Mon, 5 Oct 2009 11:30:27 +0000 (14:30 +0300)]
Teach python about the lowlevel RPMRC codes
Panu Matilainen [Mon, 5 Oct 2009 11:25:43 +0000 (14:25 +0300)]
Push ts.check() return tuple-o-doom generation over to python side
Panu Matilainen [Mon, 5 Oct 2009 11:08:48 +0000 (14:08 +0300)]
Teach python about RPMSENSE_ANY
Panu Matilainen [Mon, 5 Oct 2009 10:12:05 +0000 (13:12 +0300)]
Enable retrieving problem key from python too
Panu Matilainen [Mon, 5 Oct 2009 09:16:26 +0000 (12:16 +0300)]
Push transaction problem filter to python side
- make C-level ts.run() require ignoreSet just like the real one does
and keep the value on python side of things
Panu Matilainen [Mon, 5 Oct 2009 09:09:26 +0000 (12:09 +0300)]
Push the interpretation of ts.run() result code to python side
- at least this lets sub-typers override the hysterical return values
Panu Matilainen [Mon, 5 Oct 2009 08:09:05 +0000 (11:09 +0300)]
Add minimal python wrapping for rpmProblem objects
- for now, only expose the basic attributes and return problem string
representation on %s
- return problem objects on rpmps iteration
Panu Matilainen [Mon, 5 Oct 2009 06:26:43 +0000 (09:26 +0300)]
Ugh, forgot to add the new _rpmb module to git
- should've been in commit
8169bbde6934637ed7be58e18103330c1d5e4546
Panu Matilainen [Fri, 2 Oct 2009 19:48:03 +0000 (22:48 +0300)]
Push most work of ts.addErase() over to python
- minimize the stuff done in C: rpmtsAddEraseElement() only cares about
header, so that's what we accept on C-level bindings
- on python side, handle db recno's and labels like we've always done,
additionally accept match iterators and plain headers too
Panu Matilainen [Fri, 2 Oct 2009 19:15:51 +0000 (22:15 +0300)]
Return error code from rpmtsAddEraseElement() failure
- trying to remove non-installed header counts as an error
Panu Matilainen [Fri, 2 Oct 2009 18:41:41 +0000 (21:41 +0300)]
Permit file objects and file names to ts.addInstall()
- largely removes the need for the klunky ts.hdrFromFdno()
Panu Matilainen [Fri, 2 Oct 2009 18:18:27 +0000 (21:18 +0300)]
Push most work of ts.addInstall() over to python
- minimize the stuff done in C: require all arguments in final format
and report status back with a boolean, handle everything else including
keylist refcounting hack over to python side
Panu Matilainen [Fri, 2 Oct 2009 18:14:19 +0000 (21:14 +0300)]
Oops, missing self in bunch of calls... been too long since writing Python ;)
Panu Matilainen [Fri, 2 Oct 2009 17:35:20 +0000 (20:35 +0300)]
Push the rpmtsGetKeys() stuff over to python completely
- trivially implemented in python by iterating over transaction element
keys, we dont need no stinking extra librpm APIs for this
Panu Matilainen [Fri, 2 Oct 2009 16:19:31 +0000 (19:19 +0300)]
Add rpmlog() wrapper to python bindings
Panu Matilainen [Fri, 2 Oct 2009 15:55:16 +0000 (18:55 +0300)]
Teach python about RPMDBI_LABEL
Panu Matilainen [Fri, 2 Oct 2009 15:31:32 +0000 (18:31 +0300)]
Split rpmbuild dependencies to separate _rpmb module
- installers and the like dont need the pile of poo called librpmbuild for
anything, avoid dragging it in needlessly
- import _rpmb into rpm namespace if available but dont complain if
its not there
- arrange ts.parseSpec() compatibility on python side by dynamically
importing _rpmb if possible
Panu Matilainen [Fri, 2 Oct 2009 13:36:53 +0000 (16:36 +0300)]
Move ts flag & color setting to python side
Panu Matilainen [Fri, 2 Oct 2009 13:18:59 +0000 (16:18 +0300)]
Add a dummy python-level transaction set class, use it always
- move the rpm.ts() vs rpm.TransactionSet() compatibility to python
- this will enable doing only the lowest level stuff in C and rest
in python
Panu Matilainen [Thu, 1 Oct 2009 12:25:01 +0000 (15:25 +0300)]
Add python method for retrieving header "instance" (db recno) number
Panu Matilainen [Thu, 1 Oct 2009 12:12:06 +0000 (15:12 +0300)]
Deprecation tweaks
- use PyErr_WarnEx() for better control and leave the tracking up to python
- use PendingDeprecationWarning for now
- document the replacing functionality in the deprecation messages
- make hdr.sprintf() just an alias to hdr.format() without deprecating,
at least for now it'd be only a gratuitous incompatible change on python side
Panu Matilainen [Thu, 1 Oct 2009 11:55:55 +0000 (14:55 +0300)]
Oops, these are mappings, not dicts...
Panu Matilainen [Thu, 1 Oct 2009 11:27:42 +0000 (14:27 +0300)]
Generalize python ts flags and colors set/get foo
- make flags, vsflags, color, prefcolor (previously not available)
and probFilter appear as internal attributes of ts objects, each
with their own setter/getter methods
- make the old custom set/get methods access the internal attributes instead
- keeping them "internal only" leaves room for adding further sanity
checking and nicer interface on python side while giving direct access
bits for those who want it
- not deprecating the old get/set methods at least yet...
Panu Matilainen [Thu, 1 Oct 2009 11:06:41 +0000 (14:06 +0300)]
Fix couple of recently introduced compiler warnings
Panu Matilainen [Thu, 1 Oct 2009 10:21:44 +0000 (13:21 +0300)]
Include structmembers.h centrally from rpmsystem-py.h
- pretty much everything might need this...
Panu Matilainen [Thu, 1 Oct 2009 08:37:45 +0000 (11:37 +0300)]
Add API for setting preferred transaction file color
- not strictly needed as it gets its default from a macro but .. shrug
Panu Matilainen [Thu, 1 Oct 2009 08:21:58 +0000 (11:21 +0300)]
Make python ts rootDir appear as a read-only attribute
- there's no need to change the rootdir after object creation, better
not permit at all
Panu Matilainen [Thu, 1 Oct 2009 08:17:38 +0000 (11:17 +0300)]
Add python getter for transaction id
Panu Matilainen [Thu, 1 Oct 2009 07:59:53 +0000 (10:59 +0300)]
Eliminate python ts scriptFd kludgery
- make the scriptFd appear as regular attribute by providing a setter
method for it, permit any file object to be used and allow disabling too
- readonly for now as we dont have rpmfd wrapped yet
- remove now unnecessary custom get/setattr functions
Panu Matilainen [Wed, 30 Sep 2009 13:45:46 +0000 (16:45 +0300)]
Deprecate custom foo.count() methods, support len() instead
Panu Matilainen [Wed, 30 Sep 2009 13:10:24 +0000 (16:10 +0300)]
Eliminate unused python ts iterator filter stuff
- iterators dont take arguments so there's no convenient way to filter
while iterating, let python users filter themselves (like they've
always been doing)
Panu Matilainen [Wed, 30 Sep 2009 12:04:39 +0000 (15:04 +0300)]
Take advantage of headerNextTag() in python hdr.keys()
- avoids whole lotta unnecessary copying of data, we're only interested
in tag numbers here
- dont filter out stuff - python consumers can look at i18n data too
Panu Matilainen [Wed, 30 Sep 2009 11:51:33 +0000 (14:51 +0300)]
Add iterator support to python header objects
Panu Matilainen [Wed, 30 Sep 2009 11:48:19 +0000 (14:48 +0300)]
Add alternative header iterator method
- we dont always want the actual contents of the tag to be copied
on iteration, so add an interface that returns the next tag in the
header
- this lets callers to decide what to do with the tag and how to
retrieve it
Panu Matilainen [Wed, 30 Sep 2009 10:05:24 +0000 (13:05 +0300)]
Add some flags to rpmtd creation
- permit disabling extension retrieval and "raw" (untranslated i18n) tags
- always use HEADERGET_ALLOC for data availability sanity
Panu Matilainen [Wed, 30 Sep 2009 09:45:07 +0000 (12:45 +0300)]
Add beginnings of rpmtd wrappings to python
- unlike other types, store the C-level td structure directly in the
python object, this lets us selectively expose some members directly,
avoids having to deal with rpmtd allocation separately and as leaves
the reference counting to python as rpmtd's aren't refcounted on C-level
Panu Matilainen [Wed, 30 Sep 2009 09:11:43 +0000 (12:11 +0300)]
Turn hdrGetHeader() into argument parsing converter interface
Panu Matilainen [Wed, 30 Sep 2009 07:33:52 +0000 (10:33 +0300)]
Sanitize getattr behavior of header objects
- when generic getattr fails, only try retrieving header tag as attribute
if it's a valid tag
- clear any python errors if generic getattr failed
- split generating a python object from header + tag to an internal helper
Panu Matilainen [Mon, 28 Sep 2009 15:22:14 +0000 (18:22 +0300)]
Require expected type in PyArg_ParseTupleAndKeywords() already
Panu Matilainen [Mon, 28 Sep 2009 14:23:28 +0000 (17:23 +0300)]
Support numeric expansion in rpm.expandMacro()
Panu Matilainen [Mon, 28 Sep 2009 13:37:14 +0000 (16:37 +0300)]
Push rpm.signalsCaught() to python level
- only implement the bare minimum in C by adding a thin wrapper for
rpmsqIsCaught(), the rest can easily be done in python
Panu Matilainen [Mon, 28 Sep 2009 13:19:22 +0000 (16:19 +0300)]
Implement rpm.readHeaderFromFD() in python instead of C
Panu Matilainen [Mon, 28 Sep 2009 13:07:09 +0000 (16:07 +0300)]
Implement rpm.readHeaderListFromFD() in python instead of C
Panu Matilainen [Mon, 28 Sep 2009 11:50:33 +0000 (14:50 +0300)]
Implement rpmreadHeaderListFromFile() in python instead of C
Panu Matilainen [Mon, 28 Sep 2009 10:48:19 +0000 (13:48 +0300)]
A few cases of Py_RETURN_NONE missed on the first round
Panu Matilainen [Mon, 28 Sep 2009 10:30:28 +0000 (13:30 +0300)]
Arrange rpm.headerLoad() compatibility on python level
Panu Matilainen [Mon, 28 Sep 2009 08:09:32 +0000 (11:09 +0300)]
OSGi dependency generator fixes from Alphonse Van Assche (ticket #101)
- This patch fix some minor bug, remove unused code and increase drastically
the perf by threading execution of tasks and using zip command instead of
jar to get meta-data
Panu Matilainen [Thu, 24 Sep 2009 10:57:55 +0000 (13:57 +0300)]
Enable subtyping on the rest of our type-objects
- not very useful atm as various places return hard-wired built-in types
Panu Matilainen [Thu, 24 Sep 2009 10:40:44 +0000 (13:40 +0300)]
Eliminate all custom tp_free() type methods
- tp_free()'s purpose is only to free up the memory used by the python
object structure, cleaning up our own allocations belongs to tp_dealloc()
Panu Matilainen [Thu, 24 Sep 2009 10:19:20 +0000 (13:19 +0300)]
Enable subtyping on rpm.ts class
Panu Matilainen [Thu, 24 Sep 2009 10:05:36 +0000 (13:05 +0300)]
Call generic python setattr if not scriptFd
- yet more preliminaries for subtyping
Panu Matilainen [Thu, 24 Sep 2009 10:04:34 +0000 (13:04 +0300)]
tp_setattro() is supposed to return -1 on errors
Panu Matilainen [Thu, 24 Sep 2009 09:52:32 +0000 (12:52 +0300)]
Call (sub)type tp_free from destructors
- more preliminaries for subtyping
- remove pointless NULL checks
Panu Matilainen [Thu, 24 Sep 2009 08:42:17 +0000 (11:42 +0300)]
Make object allocation type agnostic
- pass (sub)type down to wrappers
- call subtype tp_alloc() instead of PyObject_New()
- preliminaries for allowing subtyping
Panu Matilainen [Wed, 23 Sep 2009 14:44:07 +0000 (17:44 +0300)]
Remove unnecessary header type checking
- the type is already validated by PyArg_ParseTupleAndKeywords(),
no need to doublecheck
Panu Matilainen [Wed, 23 Sep 2009 11:41:30 +0000 (14:41 +0300)]
Remove the broken tp_print method from spec
Panu Matilainen [Wed, 23 Sep 2009 11:21:13 +0000 (14:21 +0300)]
Decouple python spec objects from transaction objects
- ts structure is only necessary for hysterically passing back the
parse result from parseSpec(), hide this in the bindings
- deprecate ts.parseSpec() for later ripping
Panu Matilainen [Wed, 23 Sep 2009 10:12:43 +0000 (13:12 +0300)]
Oops, binary data can and should be presented as python strings
Panu Matilainen [Wed, 23 Sep 2009 09:49:15 +0000 (12:49 +0300)]
Add rpmtd to python object converter, change header code to use that
- vastly simpler than the former goo in hdr_subscribe
Panu Matilainen [Wed, 23 Sep 2009 09:28:47 +0000 (12:28 +0300)]
Turn tagNumFromPyObject() into an object converter interface
- permits direct validation and conversion from arg parsing
Panu Matilainen [Wed, 23 Sep 2009 09:05:02 +0000 (12:05 +0300)]
Turn rpmFdFromPyObject() into an object converter interface
- permits direct validation and conversion from arg parsing
Panu Matilainen [Wed, 23 Sep 2009 08:51:55 +0000 (11:51 +0300)]
Permit any file object in rpm.readHeaderListFromFD()
Panu Matilainen [Wed, 23 Sep 2009 08:42:59 +0000 (11:42 +0300)]
Permit file objects in python header constructor
Panu Matilainen [Wed, 23 Sep 2009 08:41:20 +0000 (11:41 +0300)]
Add write() method to python headers
Panu Matilainen [Wed, 23 Sep 2009 08:10:38 +0000 (11:10 +0300)]
Accept any file object in ts.hdrFromFdno()
Panu Matilainen [Wed, 23 Sep 2009 08:09:19 +0000 (11:09 +0300)]
Add helper to convert python file objects to rpmio FD_t type
Panu Matilainen [Wed, 23 Sep 2009 07:49:47 +0000 (10:49 +0300)]
Add te.NEVRA() method, adjust docs
Panu Matilainen [Wed, 23 Sep 2009 07:44:41 +0000 (10:44 +0300)]
Remove tp_print methods from all rpm-python objects
- these violate the intended use of tp_print, python docs state
"A type should never implement tp_print in a way that produces
different output than tp_repr or tp_str would."
Panu Matilainen [Wed, 23 Sep 2009 07:39:40 +0000 (10:39 +0300)]
Lose the debug junk from python bindings
Panu Matilainen [Wed, 23 Sep 2009 07:31:46 +0000 (10:31 +0300)]
Add hdr.format(), deprecate hdr.sprintf()
- sprintf() is a C'ism and format() is closer to current librpm anyway
Panu Matilainen [Wed, 23 Sep 2009 07:19:46 +0000 (10:19 +0300)]
Make fiFromHeader() static inside header-py, deprecate
Panu Matilainen [Wed, 23 Sep 2009 07:11:45 +0000 (10:11 +0300)]
Deprecate rpm.headerLoad()
- this is not needed now, just call rpm.hdr(<blob) to load
Panu Matilainen [Wed, 23 Sep 2009 06:56:08 +0000 (09:56 +0300)]
Deprecate header filelist munging methods
- hdr.convert() is the generic way, the old stuff is not needed anymore
- macro to issue warnings just once
Panu Matilainen [Wed, 23 Sep 2009 06:27:47 +0000 (09:27 +0300)]
Eliminate unnecessary function
Panu Matilainen [Wed, 23 Sep 2009 06:24:23 +0000 (09:24 +0300)]
Permit headerConvert() from python
Panu Matilainen [Wed, 23 Sep 2009 06:03:25 +0000 (09:03 +0300)]
Add has_key() method to header object
Panu Matilainen [Wed, 23 Sep 2009 05:51:12 +0000 (08:51 +0300)]
Add support for creating new header objects
- without arguments, rpm.hdr() creates an empty header
- with another header as argument, make a copy
- string argument is considered an unloaded header blob and copy-loaded
Panu Matilainen [Wed, 23 Sep 2009 05:41:03 +0000 (08:41 +0300)]
Rpm's allocators dont return on OOM, remove unnecessary check
Panu Matilainen [Tue, 22 Sep 2009 21:06:13 +0000 (00:06 +0300)]
Add type checking macros for all rpm python type objects
Panu Matilainen [Tue, 22 Sep 2009 20:02:47 +0000 (23:02 +0300)]
Rename python system.h for disambiguation
Panu Matilainen [Tue, 22 Sep 2009 19:42:06 +0000 (22:42 +0300)]
Lose the empty doxygen markers
- nothing wrong with comments but empty comment placeholders
are not exactly useful
Panu Matilainen [Tue, 22 Sep 2009 18:53:21 +0000 (21:53 +0300)]
Put some consistency to python object creation
- all type object creation goes through foo_Wrap() which handle OOM
and all type specific initialization
Panu Matilainen [Tue, 22 Sep 2009 18:24:55 +0000 (21:24 +0300)]
Make all python object creation wrappers return PyObject pointers
- this way the only place where casts are needed are in the wrapper itself
Panu Matilainen [Tue, 22 Sep 2009 18:01:01 +0000 (21:01 +0300)]
Dont leak memory on rpm.ds iteration
Panu Matilainen [Tue, 22 Sep 2009 17:50:41 +0000 (20:50 +0300)]
Lose unnecessary next() methods
- python adds next() methods for objects supporting iterators
Panu Matilainen [Tue, 22 Sep 2009 17:20:07 +0000 (20:20 +0300)]
All rpm-python iterators are self-iterators, just use PyObject_SelfIter
Panu Matilainen [Tue, 22 Sep 2009 16:55:34 +0000 (19:55 +0300)]
Dont leak memory from rpm.dsSingle()
Panu Matilainen [Tue, 22 Sep 2009 16:44:59 +0000 (19:44 +0300)]
Simplify fiFromHeader()
- just call the fi object, no need to manually redo all this stuff
Panu Matilainen [Tue, 22 Sep 2009 16:42:53 +0000 (19:42 +0300)]
Simplify dsFromHeader()
- just call the ds object, no need to manually redo all this stuff
Panu Matilainen [Tue, 22 Sep 2009 16:19:02 +0000 (19:19 +0300)]
Sanitize python object -> tag number exception handling
- raise exception in tagNumFromPyObject(), not in 12 different callers
- check against RPMTAG_NOT_FOUND consistently instead of -1 and whatnot
- unknown tags are value, not key or type errors
Panu Matilainen [Tue, 22 Sep 2009 15:55:09 +0000 (18:55 +0300)]
Move allocations out of rpmps object init method
- tp_init can be called several times, allocating from there leaks memory
- tp_init gets called automatically on object creation, dont call manually
- nothing to initialize for rpmps...
Panu Matilainen [Tue, 22 Sep 2009 15:53:15 +0000 (18:53 +0300)]
Move allocations out of rpmds object init method
- tp_init can be called several times, allocating from there leaks memory
- tp_init gets called automatically on object creation, dont call manually