[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question on libapt-pkg-dev changes in 2.5.0



On 24 May 2022 at 22:46, David Kalnischkies wrote:
| On Tue, May 24, 2022 at 01:12:12PM -0500, Dirk Eddelbuettel wrote:
| Using apt-pkg/deb* files is usually a bad idea and most of the time not
| even possible as the methods/classes they contain have their symbols not
| exported in the library.
| 
| The deb files tend to contain implementation( detail)s for interfaces
| defined in more public headers – just like it is the case here:

Yes. Some of this may have been different in the past -- I wrote most of this a
few years, plus one update apt 1.9.0 / 2.0.0 API -- or it may just been a bad
case of me poking through headers lacking better doxygen browsing.

| > Is there a reference or test client which retrieves this info under the
| > updated API?  In essence I 'just' do (in R) something like this for a
| > function returning build-depends
| […]
| >    https://github.com/eddelbuettel/rcppapt/blob/master/src/buildDepends.cpp
| […]
| > I can switch from 'debsrcrecord.h' to 'srcrecords.h' but how I replace
| > debSrcRecordParser which only seems to be defined in debsrcrecords.h which I
| > can no longer include.
| 
| You don't use debSrcRecordParser – you couldn't, it is a hidden class
| and as such not exported – you are using debSrcRecordParser::Parser
| which refers¹ to the public pkgSrcRecords::Parser class you should be
| using instead and is the base class of the bad boy you were using.
| 
| So, to resolve your problem just replace the include of
| 'apt-pkg/debsrcrecords.h' with 'apt-pkg/srcrecords.h' and
| 'debSrcRecordParser' with 'pkgSrcRecords'.

I actually saw both the inheritance and about 'srcrecords.h' while I was
writing the earlier email and trying some fixes, so I guess I was close but
what I was missing was 'pkgSrcRecords' which is ...

| You don't need to version guard this in any way, as this is what you
| should have done all along and is available since ever. You are actually
| using this exact interface a few lines below in another block (which you
| have ifdef'ed out as well as you relied on debsrcrecords.h bringing in
| the srcrecords.h include implicitly I guess).

... doubly silly as I apparently used it once before!  (Maybe from the apt
2.0 cleanup a while back.)

Thanks so so much for prompt waving of the cluebat.  I can now take the
(double) conditioning out as I will no longer worry about apt pre 2.0
either.  So I'll have this updated in no time.

Thanks again. Maybe I should upload this to Debian after all as another
r-cran-* package just to know sooner when I need to get my act together :)

Cheers, Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd@debian.org


Reply to: