Carrying on this conversation: http://lists.tartarus.org/pipermail/xapian-discuss/2007-March/003513.html void TermGenerator::set_stopper(stopper) Stopper * stopper CODE: // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better than // a SEGV! SvREFCNT_inc(ST(1)); THIS->set_stopper(stopper); It would be good to fix these FIXMEs. A class-level HASH could be maintained of contained objects. Any other solutions? /Tim.
On Wed, Sep 01, 2010 at 06:21:28PM +0100, Tim Brody wrote:> Carrying on this conversation: > http://lists.tartarus.org/pipermail/xapian-discuss/2007-March/003513.html > > void > TermGenerator::set_stopper(stopper) > Stopper * stopper > CODE: > // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better > than > // a SEGV! > SvREFCNT_inc(ST(1)); > THIS->set_stopper(stopper); > > It would be good to fix these FIXMEs. > > A class-level HASH could be maintained of contained objects. > > Any other solutions?This is what we do for Python. Perhaps now is a good time to switch to the SWIG-generated Python bindings though, rather than working on code we're intending to replace. These were done for GSoC last year by Kosei Moriyama on a branch. He expressed interest in doing the merging and integration work himself, but I think he's been busy with his academic work since. I've Cc:-ed him on this mail in case he wants to get involved. I've just performed a merge from current trunk to the branch, which was pretty painless, and the tests all still pass, so I've committed that. I think the best next step is just to merge the branch to trunk, where it can be an optional new language in xapian-bindings, and sort out the remaining issues there. But currently it is branches/gsoc2009-kosei in SVN. Cheers, Olly
On Fri, 2010-09-03 at 11:49 +0100, Olly Betts wrote:> On Wed, Sep 01, 2010 at 06:21:28PM +0100, Tim Brody wrote: > > Carrying on this conversation: > > http://lists.tartarus.org/pipermail/xapian-discuss/2007-March/003513.html > > > > void > > TermGenerator::set_stopper(stopper) > > Stopper * stopper > > CODE: > > // FIXME: no corresponding SvREFCNT_dec(), but a leak seems better > > than > > // a SEGV! > > SvREFCNT_inc(ST(1)); > > THIS->set_stopper(stopper); > > > > It would be good to fix these FIXMEs. > > > > A class-level HASH could be maintained of contained objects. > > > > Any other solutions? > > This is what we do for Python. > > Perhaps now is a good time to switch to the SWIG-generated Python bindings > though, rather than working on code we're intending to replace. > > These were done for GSoC last year by Kosei Moriyama on a branch. He > expressed interest in doing the merging and integration work himself, > but I think he's been busy with his academic work since. I've Cc:-ed > him on this mail in case he wants to get involved. > > I've just performed a merge from current trunk to the branch, which was > pretty painless, and the tests all still pass, so I've committed that.I'll admit to being totally lost in the SWIG bindings. According to the GSoC "director"-based callbacks aren't implemented in SWIG? Can SWIG Perl-space callbacks be implemented by hand? (e.g. PerlStopper) Cheers, Tim.
On Sun, 2010-09-05 at 15:57 +0100, Olly Betts wrote:> On Fri, Sep 03, 2010 at 05:55:41PM +0100, Tim Brody wrote: > > On Fri, 2010-09-03 at 11:49 +0100, Olly Betts wrote: > > > These were done for GSoC last year by Kosei Moriyama on a branch. He > > > expressed interest in doing the merging and integration work himself, > > > but I think he's been busy with his academic work since. I've Cc:-ed > > > him on this mail in case he wants to get involved. > > > > > > I've just performed a merge from current trunk to the branch, which was > > > pretty painless, and the tests all still pass, so I've committed that. > > > > I'll admit to being totally lost in the SWIG bindings. > > Conceptually, it's pretty easy - it just generates XS stuff by parsing the > C++ headers and using rules called "typemaps" (some are built-in, some are > custom).Could you add this to HACKING: autoreconf --force; automake --add-missing && autoreconf --force && ./configure --with-perl --enable-maintainer-mode Which are the steps necessary to build the perl bindings from an SVN checkout. Might save someone else a few hours of head-scratching :-) How do you build a distributable tarball from the SWIG bindings? (Or .rpm) /Tim.
On Fri, 2010-09-10 at 20:50 +0100, Olly Betts wrote:> On Fri, Sep 10, 2010 at 05:12:10PM +0100, Tim Brody wrote: > > Could you add this to HACKING: > > autoreconf --force; automake --add-missing && autoreconf --force > > && ./configure --with-perl --enable-maintainer-mode > > > > Which are the steps necessary to build the perl bindings from an SVN > > checkout. Might save someone else a few hours of head-scratching :-) > > If you run the top level bootstrap script in a checked out tree, then you just > need to run configure --with-perl (just adding it when you run the top-level > configure is simplest - other modules will ignore it with a warning). > > HACKING already documents using bootstrap. > > I'll add a note about perl not being auto-enabled currently.>From a clean copy of SVN:./bootstrap ./configure --with-perl make make dist ... /bin/bash: ./doxy2swig.py: Permission denied chmod a+x xapian-bindings/python/doxy2swig.py make dist ... make[2]: *** No rule to make target `php/xapian_wrap.cc', needed by `distdir'. Stop. cd xapian-bindings ./configure --with-php swig -I../xapian-core/include -Iphp/ -c++ -php -o php/xapian_wrap.cc xapian.i ... make[1]: *** No rule to make target `php5/xapian_wrap.cc', needed by `distdir'. Stop. Any hints?> > How do you build a distributable tarball from the SWIG bindings? > > (Or .rpm) > > make dist > > Or you can use the ones here if you want trunk as in SVN: > > http://oligarchy.co.uk/xapian/trunk/Those don't appear to include Perl in xapian-bindings. /Tim.
On Mon, 2010-09-27 at 14:08 +0100, Olly Betts wrote:> On Mon, Sep 27, 2010 at 11:18:24AM +0100, Tim Brody wrote: > > On Fri, 2010-09-10 at 20:50 +0100, Olly Betts wrote: > > > If you run the top level bootstrap script in a checked out tree, then you just > > > need to run configure --with-perl (just adding it when you run the top-level > > > configure is simplest - other modules will ignore it with a warning). > > > > > > HACKING already documents using bootstrap. > > > > > > I'll add a note about perl not being auto-enabled currently. > > > > From a clean copy of SVN: > > ./bootstrap > > ./configure --with-perl > > make > > make dist > > ... /bin/bash: ./doxy2swig.py: Permission denied > > The problem is that Python is needed to run this file, but configure isn't > checking for Python because you said "--with-perl". So PYTHON is unset and > $(PYTHON) ./doxy2swig.py expands to ./doxy2swig.py in make. > > I've checked in a fix to check for Python in maintainer mode which should > fix this.I got there eventually by installing all the other bindings dependencies.> > ... make[2]: *** No rule to make target `php/xapian_wrap.cc', needed by > > `distdir'. Stop. > > This is a bug in php/Makefile.am, which is masked when the PHP bindings are > enabled. I've committed a fix for that too. > > > > http://oligarchy.co.uk/xapian/trunk/ > > > > Those don't appear to include Perl in xapian-bindings. > > It does for me - I checked svn15008.It needs adding to the .spec file - attached is a first attempt. Would I be correct in thinking the Database factory methods haven't been implemented in Perl SWIG? /Tim. -------------- next part -------------- A non-text attachment was scrubbed... Name: xapian-bindings.spec.in.diff Type: text/x-patch Size: 2821 bytes Desc: not available URL: <http://lists.xapian.org/pipermail/xapian-discuss/attachments/20100927/51dfa597/attachment.bin>
On Mon, 2010-09-27 at 15:28 +0100, Tim Brody wrote:> Would I be correct in thinking the Database factory methods haven't been > implemented in Perl SWIG?Search::Xapian::{brass,chert,remote,...}_open( ... ) /Tim.
On Tue, 2010-09-28 at 05:43 +0100, Olly Betts wrote:> On Mon, Sep 27, 2010 at 03:28:52PM +0100, Tim Brody wrote: > > It needs adding to the .spec file - attached is a first attempt. > > This looks wrong (cut-and-paste errors - s/csharp/perl/ and the minimum > version is clearly wrong too - the XS Search::Xapian seems to need > Perl >= 5.6, though that may be different for the SWIG-based version): > > +%if 0%{?!_without_csharp:1} > +BuildRequires: perl-devel >= 1.1 > +%endif > > http://fedoraproject.org/wiki/Packaging/Perl suggests you shouldn't put > perl-devel in BuildRequires anyway, but rather list the modules you > needed. I'm not sure where the Perl XS/API headers come from though.subversion-perl requires perl-devel but perl-devel appears to only exist on Fedora so I've fudged it by requiring ExtUtils::MakeMaker. Attached is a fixed .spec.in.diff. Should it obsolete perl-Search-Xapian or should we change the name to perl-Search-Xapian? I've built xapian 1.2.3 RHEL 5 RPMs here: http://rpm.eprints.org/ I created a virtual libuuid-devel package to fulfil the BuildRequires in xapian-core. And finally actually using ... There's something odd in perl/util.i: if ( ref( $item ) eq 'Search::Xapian::Query' ) { push(@arr, ref($item)); } else { push(@arr, $item); } Calling newN directly segfaults: my $query = Search::Xapian::Query->new( "foo" ); $query = Search::Xapian::newN( Search::Xapian::OP_AND, 2, [ $query, "bar" ] ); All the best, Tim. -------------- next part -------------- A non-text attachment was scrubbed... Name: xapian-bindings.spec.in.diff Type: text/x-patch Size: 3068 bytes Desc: not available URL: <http://lists.xapian.org/pipermail/xapian-discuss/attachments/20100928/8ed0feea/attachment.bin>
On Tue, 2010-09-28 at 15:51 +0100, Tim Brody wrote:> There's something odd in perl/util.i: > if ( ref( $item ) eq 'Search::Xapian::Query' ) { > push(@arr, ref($item)); > } else { > push(@arr, $item); > } > > Calling newN directly segfaults: > my $query = Search::Xapian::Query->new( "foo" ); > $query = Search::Xapian::newN( > Search::Xapian::OP_AND, > 2, > [ > $query, > "bar" > ] > );After much faffing I've worked up a patch for the above segfault. The minimal change is to replace the XS typemap with the correct (?) SWIG typemap ... but I also simplified the code structure by passing an ARRAY rather than ** + len. Is there a list of SWIG macros c.f. perlapi? Cheers, Tim. -------------- next part -------------- A non-text attachment was scrubbed... Name: perl_query_fix.diff Type: text/x-patch Size: 2669 bytes Desc: not available URL: <http://lists.xapian.org/pipermail/xapian-discuss/attachments/20100928/480c67e5/attachment.bin>