I want to introduce a new mechanism (libsets) to supplement wantlib...
Note that the keyword already exists in pkg_add.

the story so far:

wantlib evolved from lib-depends

basically, you tell a given package that it requires some libs, (WANTLIB)
and pkg_create will register those libs in the package as a set of
@wantlib annotations, thus hardcoding the major/minor of each library.

There's some sanity check as well, both during building packages and
installing them, which is that all wantlib must be "reachable": looking
through all run dependencies (recursively) of the package
the libraries must actually exist in a dependency (recursively) of the
package or in base/x11.

Whenever you update, things must go strictly forward: if the package version
changes, that's enough.

Otherwise, we do look at version numbers of direct dependencies AND at wantlib
version: if things go backward, then we don't update. If things are the
same, we don't update either.

Altogether this is a "signature" for the package version:
- the package version itself
- the version of each direct dependency
- the version of each wantlib


The problem:

In case the set of wantlib changes, you have to bump the revision of all
dependent packages, otherwise register-plist (or pkg_add) will complain
that package signatures are non comparable.


This is a problem if a basic gnome package (say gnomeajasper) adds a 
libfoobar, because suddenly, all users (direct AND indirect) of that 
package MUST be updated to
- include foobar in their WANTLIB
- have their REVISION bumped.


The new design:

The idea behind "libset" is to be able to specify a "set" of wantlib that
corresponds to our package, AND to just write WANTLIB wrt that libset for
that specific set of libraries.

In practice:
- the basic package would get a libset declaration
@libset mylibset-1.0 liba,libb,libc

- direct and indirect users would have +mylibset   in their WANTLIB
(the specific character used is up for debate... (mylibset) would be nice as
well, but it would interfere with everything shell-quoting

this would have several effects:
- when making the package, pkg_create would scan dependent packages for
the libset declaration, and add the corresponding wantlib
- the resulting package signature would ALSO include +mylibset-.10 in their
signature.


For updates, things change slightly
- dependencies must be going forward
- libsets MUST be going forward (you still need to bump REVISION if you add
a whole libset to a package)
- wantlib MUST be going forward, BUT there is a bit of libset comparison:
if a wantlib is ONLY mentioned in a new version of the libset compared to the
old (or vice-versa), then it is no longer an error, and versions are STILL
comparable. (*)


This is more or less the basic principle.  Note that (*) is a bit tricky: this
only concerns wantlib which are exclusively part of a given libset... because
if the wantlib is also mentioned elsewhere, then it still has to be given
properly.


As for libset versions proper, we would go with the exact same version scheme
as for packages.


The reason for this would lie with bsd.port.mk: I think it's likely that
each package would declare ONE single libset at most, so there is zero issue
in naming the libset exactly like the package, so a libset declaration would
be
LIBSET = liba libb libc

in the case above, it would become
LIBSET = liba libb libc libfoobar

and lead to
@libset gnomeajaspec:liba,libb,libc,libfoobar

(note that I've written "lib" everywhere to make things obvious, but as
usual, this should rather be LIBSET = a b c foobar)

(semantics for multi-packages left up to the astute reader).

(even though it's currently redundant and matches pkgnames, I prefer to have 
a separate namespace for libset, just in case we eventually want to add
several libsets for a given package...)


I don't think we need to make libset recursive (e.g., have a libset include
another libset) and also, I have zero idea how to implement that.


As far as I can figure out, to change a libset, you would only need to 
bump the rev of the basic port and add to its LIBSET declaration.

If wanted, this could even be used for base/X11, we would mostly need to 
have a smallish libset declarations for (say) all the X11 libraries that 
are commonly used for something.

Reply via email to