David Malcolm [Thu, 15 Oct 2009 19:14:56 +0000 (15:14 -0400)]
Generalize access to ob_type so that they work with both Python 2.* and Python 3.*
Python 2's various object structs use macros to implement common fields at the top of each
struct.
Python 3's objects instead embed a PyObject struct as the first member within the more refined
object structs.
Use the Py_TYPE() macro when accessing ob_type in order to encapsulate this difference.
Panu Matilainen [Mon, 19 Oct 2009 07:30:48 +0000 (10:30 +0300)]
Avoid using python's print for Python 3.x compatibility
- print chanced from statement to a function in python 3, for our
purposes sys.stdout.write() is sufficient and avoids dealing with
the incompatibilities between Python 2.x and 3.x
- suggested by David Malcolm / Ville Skyttä
Panu Matilainen [Sat, 17 Oct 2009 09:15:29 +0000 (12:15 +0300)]
Unbreak lzdio/xzdio
- revert part of
b0d1038190be5cb4b45e2c2c7c84ee7022164ba2 which broke
the split-personality lzdio/xzdio
Panu Matilainen [Sat, 17 Oct 2009 08:25:53 +0000 (11:25 +0300)]
Skip posttrans scripts of failed transaction elements
Panu Matilainen [Fri, 16 Oct 2009 10:36:39 +0000 (13:36 +0300)]
Since we really want a FILE* then get one in the first place
- this is visible in the librpmbuild exported goo, rename the member
to force build-breakage on the poor souls trying to use librpmbuild API
Panu Matilainen [Thu, 15 Oct 2009 11:51:28 +0000 (14:51 +0300)]
Use a helper function for finding fileno of specific io type
- also differentiate between lzdio and xzdio here
Panu Matilainen [Thu, 15 Oct 2009 11:33:45 +0000 (14:33 +0300)]
Lose unnecessary url type checking from fdSize()
- we're only dealing with local files once fd is opened
Panu Matilainen [Thu, 15 Oct 2009 11:23:20 +0000 (14:23 +0300)]
Lose unused leftover definitions
Panu Matilainen [Fri, 16 Oct 2009 09:49:08 +0000 (12:49 +0300)]
Eliminate ufdio-specific read, write, seek and close
- we dont do network IO anymore so ufdio only differs from fdio by
downloading the file on open if necessary, after that it's just fdio
Panu Matilainen [Thu, 15 Oct 2009 08:36:46 +0000 (11:36 +0300)]
Use fd.tell() instead of going around through os.lseek() with fdno
Panu Matilainen [Thu, 15 Oct 2009 08:34:26 +0000 (11:34 +0300)]
Add tell() method to rpm.fd class
Panu Matilainen [Thu, 15 Oct 2009 08:33:18 +0000 (11:33 +0300)]
Add ftell() clone to FD_t
Panu Matilainen [Thu, 15 Oct 2009 08:01:00 +0000 (11:01 +0300)]
Avoid unnecessary dup'ing of file descriptors on header list operations
- convert to rpm.fd on python side already add use internal helper
which only accepts rpm.fd type to avoid having to dup around on
every item
Panu Matilainen [Thu, 15 Oct 2009 07:11:37 +0000 (10:11 +0300)]
Accept rpm.fd() types file objects everywhere in python bindings
- turn rpmfdFromPyObject() into a python-level object converter, add
a separate C-level getter for the fd pointer itself
- take advantage of python refcounting to handle differences between
native vs converted rpm.fd in callers so we can simply decref the
rpmfdFromPyObject() result without having to worry whether it was
converted or not (ie should we close it or not)
Panu Matilainen [Wed, 14 Oct 2009 14:22:25 +0000 (17:22 +0300)]
Make fdUpdateDigests() static now that its possible
Panu Matilainen [Wed, 14 Oct 2009 14:19:09 +0000 (17:19 +0300)]
Make FD_t struct opaque, finally
Panu Matilainen [Wed, 14 Oct 2009 14:14:38 +0000 (17:14 +0300)]
Eliminate last remaining FD_t struct privacy violation
- add getter for fd digest bundle, uninline the setter
Panu Matilainen [Wed, 14 Oct 2009 14:03:14 +0000 (17:03 +0300)]
Remove cpio stuff from FD_t
- only the FSM cares about cpio position, move it there - there's only
ever one fd active inside FSM, no need to track it per-fd
Panu Matilainen [Wed, 14 Oct 2009 13:15:05 +0000 (16:15 +0300)]
Move debug goo defs to rpmio.c
Panu Matilainen [Wed, 14 Oct 2009 13:10:08 +0000 (16:10 +0300)]
Move pile of helpers from rpmio_internal.h to rpmio.c, remove unused stuff
- nothing outside rpmio.c needs these, make 'em static there
- uninlining reveals quite a few completely unused helpers...
Panu Matilainen [Wed, 14 Oct 2009 13:02:00 +0000 (16:02 +0300)]
Move fd statistics foo inside rpmio.c now that it can
Panu Matilainen [Wed, 14 Oct 2009 12:59:39 +0000 (15:59 +0300)]
Move fdDigest*() to rpmio.c where they better belong
Panu Matilainen [Wed, 14 Oct 2009 12:12:43 +0000 (15:12 +0300)]
Remove pointless inlining of stuff in rpmio
Panu Matilainen [Wed, 14 Oct 2009 11:45:54 +0000 (14:45 +0300)]
Use common "not implemented" implementation of Fseek()
Panu Matilainen [Wed, 14 Oct 2009 11:14:51 +0000 (14:14 +0300)]
Add first rough-cut python bindings for rpmio fd
- attempt to mimic python file object where possible, but nowhere near
all methods are supported, either just not yet done or due to
underlying limitations
Panu Matilainen [Mon, 12 Oct 2009 12:15:39 +0000 (15:15 +0300)]
Raise exception in the converter, not caller
Panu Matilainen [Mon, 12 Oct 2009 12:05:50 +0000 (15:05 +0300)]
Permit changing rpm.td tag from python
Panu Matilainen [Mon, 12 Oct 2009 11:43:44 +0000 (14:43 +0300)]
Add limited support for modifying headers to python
- for now we only support tag deletion and assigning rpmtd objects, limiting
this to copying data from other headers
Panu Matilainen [Mon, 12 Oct 2009 10:49:50 +0000 (13:49 +0300)]
Fix format extension memleak on empty strings
Panu Matilainen [Mon, 12 Oct 2009 08:03:14 +0000 (11:03 +0300)]
Output dependency type on --requires etc queries if verbose (RhBug:528342)
Panu Matilainen [Mon, 12 Oct 2009 08:02:56 +0000 (11:02 +0300)]
Add RPMTAG_VERBOSE extension
- hack to permit different query formatting based on rpm's verbosity level
Panu Matilainen [Mon, 12 Oct 2009 07:48:59 +0000 (10:48 +0300)]
Permit conditional query formats on not yet cached data too
Panu Matilainen [Sat, 10 Oct 2009 09:36:38 +0000 (12:36 +0300)]
Oops, configuring wrong ts in rpm.ts() initialization
Panu Matilainen [Fri, 9 Oct 2009 12:44:06 +0000 (15:44 +0300)]
Move further initialization from python ts tp_new to tp_init
- lose the unnecessary rpmts_Wrap(), it's not needed and just gets
in the way of things
Panu Matilainen [Fri, 9 Oct 2009 08:57:46 +0000 (11:57 +0300)]
Revert explicit PyErr_NoMemory() returns to just returning NULL
- tp_alloc failing is likely to be OOM but we dont know that for a fact,
and the failing method is responsible for setting the exception
Panu Matilainen [Fri, 9 Oct 2009 08:44:41 +0000 (11:44 +0300)]
Handle NULL in ts get/setKeyring as python None
Panu Matilainen [Fri, 9 Oct 2009 06:35:42 +0000 (09:35 +0300)]
Kill off _rpmb.error exception type
- import of _rpmb messes up rpm.error to point to _rpmb.error which we
do not want
- use ValueError for unparsable spec for now, need to figure something
saner there still
Panu Matilainen [Fri, 9 Oct 2009 06:30:37 +0000 (09:30 +0300)]
Permit setting and getting ts keyring from python
Panu Matilainen [Fri, 9 Oct 2009 06:02:19 +0000 (09:02 +0300)]
Add bindings for rpm keyring and pubkey types
Panu Matilainen [Fri, 9 Oct 2009 05:48:13 +0000 (08:48 +0300)]
Add an interface to parse armored OpenPGP from memory
- refactor the decoding part out of pgpReadPkts() to separate helper,
and add pgpParsePkts() around that
Panu Matilainen [Wed, 7 Oct 2009 09:09:00 +0000 (12:09 +0300)]
Support passing extra options to dep generator scripts
Panu Matilainen [Tue, 6 Oct 2009 12:05:06 +0000 (15:05 +0300)]
Lose unused python/perl/java stringbuffers from rpmfc
Panu Matilainen [Tue, 6 Oct 2009 10:22:22 +0000 (13:22 +0300)]
Bah, get the new ocaml-scripts into tarballs too
- should've been in commit
82e7dd702013d3679fda438333de30afdec17a4f
Panu Matilainen [Tue, 6 Oct 2009 10:13:23 +0000 (13:13 +0300)]
Python namespace import fiddling
- import rpm instead of _rpm for exception name compatibility
- import the lowlevel transaction class as _rpmts, makes it slightly
easier to see which is which
Panu Matilainen [Tue, 6 Oct 2009 09:34:44 +0000 (12:34 +0300)]
Teach the internal dep generator about OCaml
- OCaml seems to have fairly well detectable magic in its files, nice
- Dont call the regular find-requires from the scripts now that internal
is working
Panu Matilainen [Tue, 6 Oct 2009 09:29:37 +0000 (12:29 +0300)]
Add OCaml dependency generator scripts (Richard W.M. Jones)
Ville Skyttä [Mon, 3 Aug 2009 21:48:32 +0000 (00:48 +0300)]
Deprecate %__lzma, use %__xz in it.
Ville Skyttä [Mon, 3 Aug 2009 18:08:55 +0000 (21:08 +0300)]
Decompress lzma files with xz.
Ville Skyttä [Tue, 22 Sep 2009 18:11:20 +0000 (21:11 +0300)]
Improve perl.req here-doc skipping.
This version is stricter in finding the end identifier by using equality test
instead of a regex (as a side effect, fixes rhbz#524929) as well as parsing
quoted identifiers, and adds support for identifiers in backticks.
Panu Matilainen [Mon, 5 Oct 2009 15:23:55 +0000 (18:23 +0300)]
Delete ancient and defunc python test programs
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