Hi all,

Back in my quest to rid the tree of the evil virtuals and their plot to 
destroy my mind. I think I've covered all bases with this one - perhaps even 
enough to satisfy TGL. Take your best shot!

Regards,
Jason Stubbs
GLEP: XXX
Title: Virtuals Deprecation
Version: $Revision: 1.4 $
Last-Modified: $Date: 2003/07/19 12:09:20 $
Author: Jason Stubbs <[EMAIL PROTECTED]>
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 06-May-2005
Post-History: 07-May-2005


Credits
=======

Most ideas in this GLEP came out of discussion with Thomas de Grenier de
Latour.  Ciaran McCreesh, Brian Harring and Stephen Bennett have also provided
help in fleshing out the idea.


Abstract
========

This GLEP covers the pitfalls of the current virtuals system, the benefits of
using regular ebuilds to serve the purpose of virtuals and what needs to be
supported to make it viable.


Motivation
==========

The current virtuals system is decentralized; that is there is no way to find
information about a specific virtual other than to scan all packages for what
they provide.  There is also no way to tell whether an atom is a virtual or
not - yes, the "virtual/" prefix could have been used but it isn't which has
led to its abuse.

What this means is that portage must scan all installed packages for the
virtuals they provide, that profiles must provide a default for every single
virtual that portage might encounter and that every single atom that portage
processes must be checked against the list of virtuals.  Needless to say that
this causes quite a performance decrease.

The current virtuals system also has some other major shortcomings.  The most
well known case is virtual/jdk and kaffe.  Kaffe-1.1.4 implements the Java 1.4
API but can not satisfy a package that requires >=virtual/jdk-1.4 because
kaffe's versioning scheme differs.  (ED: Need to add some more here. ;)


Specification
=============

This GLEP recommends that virtuals become no different to regular packages.
Specifically, the standard virtual would include the DESCRIPTION, KEYWORDS,
IUSE, DEPEND and RDEPEND metadata.  However, there are some issues that have
been brought up with doing this.


Consistency
-----------

Presently, it is very easy to remove packages even if others are dependent
on them, which can lead to broken emerges when packages rely on indirect
dependencies.  For example, if kdelibs is merged bringing in qt and then
qt is unmerged, attempting to merge kdebase will likely fail.  This becomes
a much bigger problem with virtuals as packages because the dependencies
are always indirect.

The resolution for this issue will be to add full dependency tracking and
verification to portage.  The details of how it will be done are outside the
scope of this GLEP, but essentially this means that portage will need to be
forced to unmerge a package that is depended on by another and will also be
able to scan and fix any broken dependencies.


Overrides
---------

Profiles currently specify the default provider of each virtual and users are
able to override these defaults using /etc/portage/profile/virtuals.  If
virtuals are replaced by regular packages and thus able to have arbitrarily
complex DEPENDs, the current method of overriding default virtuals can not
be extended to support this.

Before looking at a solution, lets look at how the current system works.  When
portage initializes, it searches installed packages for available virtuals.
It then searches profiles and user overrides and adds them to the available
providers list and/or changes the order of the providers so that overrides are
listed earlier.  Portage then expands any virtual atom it finds into an OR
list using the order decided upon at initialization.

To keep this behaviour available, this GLEP proposes a new file named
package.prefer.  In its basic form, this is just a list of package names
ordered by preference.  Portage would use it by reordering the atoms of any
OR list it processes to fit the order given by package.prefer.  For example,
if package.prefer contained "dev-java/kaffe" then:

::
        
        || (
            dev-java/blackdown-jdk
            dev-java/sun-jdk
            dev-java/kaffe
           )

would be processed as:

::
        
        || (
            dev-java/kaffe
            dev-java/blackdown-jdk
            dev-java/sun-jdk
           )

In its basic form, package.prefer already covers profile and user overrides.
However, this GLEP proposes that any type of atom be usable.  This will be
accomplished by checking for intersections of the atoms in the OR list and
atoms in the preferred list.  When an intersection is found, both atoms
would be specified in a sublist, which would then be treated as a ranged dep.
For example, if package.prefer contained "<=dev-java/sun-jdk-1.4" then:

::
        
        || (
            >=dev-java/blackdown-jdk-1.3
            >=dev-java/sun-jdk-1.3
           )

would be processed as:

::
        
        || (
            (
              <=dev-java/sun-jdk-1.4
              >=dev-java/sun-jdk-1.3
            )
            >=dev-java/blackdown-jdk-1.3
            >=dev-java/sun-jdk-1.3
           )

Ranged deps are outside of the scope of this GLEP.


Rationale
=========

The number one advantage is that it offers more power to both the user and
the developer.  Flexibility of virtuals is far greater in this scheme and
fulfills requirements that exist already.  It also means that the maintainers
of profiles will not need to list a default for every virtual.  The user
benefits by being able to easily gather a list of providers of a virtual as
well as their control being extended to allow selection where there is a
choice within any package.

Portage code also benefits from this scheme as virtuals will no longer
require special handling or dual implementations of essentially the same
feature, for example USE-based PROVIDEs.  This scheme is also much easier to
optimize which will benefit the processing of all packages.  It also means
that any additions to the DEPEND vocabulary become available for use in the
definitions of virtuals.


Backwards Compatibility
=======================

As the virtuals would just become like any other package, existing portages
will be able to handle them already.  When the tree is stripped of PROVIDEs
and "virtuals" override files, the only virtuals that existing portages will
use are those that the user has specified and those gleaned from installed
packages.  Any unknown virtual will be treated like a regular package and
looked for in the tree.

The only "issue" is that consistency checking and support for overrides are
not available in current versions of portage.  However, before releasing a
version of portage that no longer supports virtuals, it is planned to release
a version that has support for consistency checking.

When the time comes to migrate, scripts can be easily be written to create
packages from the existing virtuals system as well as to create appropriate
package.prefer overrides within the profiles.


Copyright
=========

This document has been placed in the public domain.


Reply via email to