On Sat, 06 Sep 2014 13:00:03 -0400
"Anthony G. Basile" <bluen...@gentoo.org> wrote:
> On 09/06/14 12:18, Ciaran McCreesh wrote:
> > Well eix is buggy, PMS-violating and doesn't support EAPIs properly,
> > and the utilities in gentoolkit and portage-utils are better
> > implemented natively in a package manager. I don't know what elfix
> > does, but if it's anything like the other three, I'd rather
> > reimplement it in a PMS compliant manner for Paludis than to
> > provide flaky external APIs that encourage people to write broken
> > code...
> 
> elfix contains revdep-pax which does what revdep-rebuild does, except 
> that it migrates PaX flags from executables to libraries and vice
> versa.

There's a reason we reimplemented revdep-rebuild: doing it *properly*
requires passing special information to the dependency resolver telling
it not to reuse certain packages for breaking circular dependencies.

> These sorts of utilites pop up over and over again.

A lot of them are because Portage doesn't provide a decent API for
users...

> You cannot put  every utility that needs package information into a
> package manager.

No, just the ones that do anything fiddly, and that certainly includes
eix and most of gentoolkit.

> An API for interoperability between PM's and other
> tools is meaningful. Refusing to do so leads to the sort of comment
> you see in https://bugs.gentoo.org/show_bug.cgi?id=506276#c43.
> 
> Ironically, the very standards I seek in GLEP 64 would benefit the 
> paludis world most.

I'm not disagreeing with an API for interoperability, in principle. I
just think the way you're going about it is all wrong, and we're all
better not having an API at all than having a bad one that we'll have to
support for all eternity. Here's a quick lesson, starting with bad
design:

    for x in /var/db/pkg/*/* ; do
        cat $x/DESCRIPTION
        # etc

But what if VDB isn't there?

    for x in $(pmtool get_vdb_path)/*/* ; do
        cat $x/DESCRIPTION

But */* makes some strong assumptions about the filesystem layout. In
particular, it's going to be wrong if we ever do multi-slot. So:

    for x in $(pmtool get_vdb_package_directories) ; do
        cat $x/DESCRIPTION

But this is still very fragile. What if we switch to sqlite?

    for x in $(pmtool get_unique_ids_for_vdb_packages) ; do
        pmtool get_metadata_variable $x DESCRIPTION

But hang on... We don't really want VDB. We want installed packages.
(This is important, and it's not just a naming thing.)

    for x in $(pmtool get_unique_ids_for_installed_packages) ; do
        pmtool get_metadata_variable $x DESCRIPTION

What if descriptions move to metadata.xml?

    for x in $(pmtool get_unique_ids_for_installed_packages) ; do
        pmtool get_description $x

And finally, what if EAPI 7 changes things? It's probably best to error
out.

    export PMTOOL_BARF_ON_UNKNOWN_EAPIS="1 2 3 4 5 6"
    for x in $(pmtool get_unique_ids_for_installed_packages) ; do
        pmtool get_description $x

Now this is still fragile and makes all kinds of assumptions, and we
could argue eternally about the naming, but it's a heck of a lot better
than what we started off with. In particular, it's *very* high level,
and relies upon the package mangler for everything involving parsing.

-- 
Ciaran McCreesh

Attachment: signature.asc
Description: PGP signature

Reply via email to