[Apt-Rpm] Aptness -- a simplified interface for libapt-pkg

Gary L. Greene Jr. greeneg at tolharadys.net
Mon Sep 17 19:57:41 PDT 2007


On Monday 17 September 2007 07:07:32 pm João Abecasis wrote:
> Gary L. Greene Jr. wrote:
> > Is this built to work with Apt-RPM's variant of libapt-pkg or Debian's?
> > There are large incompatible differences between the two.
>
> Currently it only works with Apt-RPM. Supporting both is part of the plan.
>
> Part of the path we're going is to completely hide libapt-pkg behind
> our interface. Given that, we could either support Debian's Apt with
> recourse to #ifdef's, as long as the differences are reconcilable.
> Otherwise, it could be a completely different backend.
>
> I'll have to look further into it, though.

Using #ifdefs everywhere is going to make your code VERY difficult to 
maintain....

The big problem with libapt-pkg is that it's API knows _far_ too much about 
the capabilities of the underlying container format and it's installer 
engine. This is coupled very deep in libapt-pkg. When Gustavo initially 
ported APT to RPM, he had to rip out the stuff in it that was intimately tied 
to dpkg.

Thus until either the new libept takes over the duties that libapt-pkg does 
(which has a clean API compared to libapt-pkg and has rudimentary read 
support for RPM), your best option at this point is to have two separate 
class implementations that are used by a main class that #ifdefs to the 
different backends. This will lower the sheer amount of code branching in 
your main library API and allow you to isolate the differences within the 
separate class implementations.

Weee fun, the joys of good OO encapsulation. :D

-- 
Gary L. Greene, Jr.
Sent from: peorth.tolharadys.net
 19:44:15 up 8 days, 21:09,  1 user,  load average: 1.29, 1.70, 1.75
=========================================================================
Developer and Project Lead for the AltimatOS open source project
Volunteer Developer for the KDE open source project
 See www.tolharadys.net and www.kde.org for more information
=========================================================================

Please avoid sending me Word or PowerPoint attachments.



More information about the Apt-Rpm mailing list