Hello,

Following the late discussion, I have updated GLEP-62. It no longer is
designed to be 'backwards compatible' and instead it was suited for
addition in a new EAPI.

Thus, IUSE_RUNTIME is now independent of IUSE, and runtime dependencies
can be expressed in SDEPEND only.

There's still a case of REQUIRED_USE. I'm not really convinced to
create a REQUIRED_RUNTIME_USE especially for it. Also, it may be
actually better to put all IUSE_RUNTIME flags to IUSE as well -- since
the package manager will after all be required to concatenate them
anyway.

-- 
Best regards,
Michał Górny
GLEP: 62
Title: Optional runtime dependencies via runtime-switchable USE flags
Version: $Revision: 1.2 $
Last-Modified: $Date: 2012/07/11 20:24:37 $
Author: Michał Górny <[email protected]>
Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 17 Jun 2012
Post-History: 11 Jul 2012, 29 Sep 2012


Abstract
========

This GLEP addresses the issue of referencing optional runtime
dependencies in Gentoo packages and ebuilds. It does introduce
a concept of runtime-switchable USE flags to achieve that goal.


Motivation
==========

Optional runtime dependencies are often found in packages installing
various scripts (shell, python, perl). These dependencies are not
strictly required for the particular package to work but installing them
enables additional functionality.

Unlike in compiled programs, enabling or disabling those features
(dependencies) does not affect the files installed by the package.
They can be installed and uninstalled independently of the package,
resulting in changes of functionality without a need to rebuild
the package.

Currently such dependencies are usually expressed only through
``pkg_postinst()`` messages. This forces user to manually install
the necessary dependencies, and uninstall them when they are no longer
necessary.

An another solution is to use regular USE flags. Those flags do not
strictly follow the principles of USE flags. They do not affect files
installed by the package and are not entirely effective to the package
(a disabled feature will still be available if necessary dependency is
installed). Additionally, it requires unnecessary rebuilds
of the package in order to change the dependencies.


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

The ebuilds aiming to provide features enabled through optional runtime
dependencies should:

1. list the USE flags used for optional runtime dependencies
   in ``IUSE_RUNTIME`` (and not ``IUSE``);
2. list the necessary runtime dependencies in the ``SDEPEND`` variable.

Additionally, the ebuilds must obey the following rules:

1. flags listed in ``IUSE_RUNTIME`` must not be listed in ``IUSE``,
2. flags listed in ``IUSE_RUNTIME`` can be referenced in ``SDEPEND``
   and ``REQUIRED_USE`` variables,
3. flags listed in ``IUSE_RUNTIME`` must not be referenced in phase
   functions, other dependency variables, ``LICENSE`` or ``SRC_URI``,
4. flags listed in ``IUSE_RUNTIME`` can be referenced through USE
   dependencies by other packages' ``DEPEND``, ``RDEPEND``
   and ``PDEPEND``. However, it is not allowed to request disabling those
   flags (only ``[flag]`` and ``[flag?]`` forms are allowed),
5. flags listed in ``IUSE_RUNTIME`` can be referenced through
   ``has_version`` and ``best_version`` yet the caller must not rely
   upon those flags being disabled.

The package manager should treat flags listed in ``IUSE_RUNTIME``
as regular USE flags, except for the following:

1. enabling or disabling any of the flags must not involve rebuilding
   the package,
2. it should be possible for a package manager to change those flags
   on a installed package without using the original ebuild [1]_,
3. when queried on a installed package, the package manager must
   consider a particular flag enabled only if its dependencies
   are satisfied already [2]_,
4. the flags may be listed in the visual output in a distinct way
   to inform the user that they affect runtime dependencies only.

.. [1] The package manager has to ensure that all relevant information
       is stored in the installed package metadata.
.. [2] The result of this check can be cached when updating the metadata
       of installed package, and it is not strictly required that
       a package manager must ensure that the dependency graph is still
       consistent afterwards.


Rationale
=========

The proposed solution tries to solve the issue of handling runtime
dependencies while reusing the existing infrastructure. Most
importantly, users will be able to reuse the existing tools
and configuration files to enable and disable optional runtime
and build-time dependencies alike.

The remaining reused features include:

- dependency syntax (USE-conditionals),
- ability to use ``REQUIRED_USE``, USE dependencies,
- ability to describe flags in `metadata.xml`,
- global flag names (and descriptions).

Alternative proposed solution involved creating a flag-less ``SDEPEND``
variable. That proposition had the following disadvantages:

- being package-oriented rather than feature-oriented,
- lack of ability to express multiple packages required by a single
  feature,
- lack of ability to express cross-feature dependencies,
- lack of ability to describe features provided by enabled packages,
- necessity of implementing a new user interface parts to control
  the dependencies.

Those disadvantages could be fixed only through extending dependency
syntax alike Exherbo (grouping, annotations).


Reference implementation
========================

In order to support runtime-switchable USE flag changes on installed
packages, a package manager should store the following information
in the installed package metadata:

1. a list of runtime-switchable flags (``IUSE_RUNTIME``),
2. a list of runtime dependencies conditional to runtime-switchable
   flags, not subjected to USE expansion (unexpanded ``SDEPEND``),
3. a list of ``REQUIRED_USE`` constraints relevant to runtime-switchable
   USE flags.

The package manager should be also able to update the list of effective
USE flags in installed package metadata (``USE``) without rebuilding
the package.

The following procedure should apply when a dependency atom is
considered (either as a package dependency or user-requested atom):

1. if the dependency is not satisfied with an installed package,
   perform the dependency resolution on ebuilds as usual (in order to
   install a new package);
2. if runtime-switchable USE updates are disabled, continue to
   the next dependency (with this one satisfied);
3. ``current_use`` = installed package metadata . ``USE``;
4. ``effective_use`` = requested ``USE`` for the package;
5. ``use_changes`` = ``current_use`` xor ``effective_use``;
6. if ``use_changes`` is empty, continue to the next dependency;
7. ``iuse_runtime`` = installed package metadata . ``IUSE_RUNTIME``;
8. ``reg_use_changes`` = ``use_changes`` and not ``iuse_runtime``;
9. if ``reg_use_changes`` is not empty and regular USE updates
   are enabled, perform the dependency resolution on ebuilds (in order
   to rebuild the package);
10. ``run_use_changes`` = ``use_changes`` and ``iuse_runtime``;
11. if ``run_use_changes`` is empty, continue to the next dependency;
12. ``required_use`` = installed package metadata . ``REQUIRED_USE``;
13. perform a check for ``required_use`` constraints being satisfied
    by ``effective_use``;
14. ``sdepend`` = installed package metadata . ``SDEPEND`` (with
    unexpanded ``IUSE_RUNTIME`` conditionals);
15. perform the dependency resolution for ``sdepend`` with
    ``effective_use``,
16. queue the package for runtime-switchable USE update.

Furthermore, after installing all dependencies introduced by the above
procedure (``sdepend`` resolution), if a package was queued for
runtime-switchable USE update, the package manager should write a new
value for ``USE`` key in installed package metadata.


Backwards compatibility
=======================

The feature is to be implemented in a new EAPI. Earlier package manager
versions will not support the packages using it.


Copyright
=========

This document has been placed in the public domain.
From 4a690f440adc65c0d268cc0dbf864eaac457c68b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
Date: Sat, 29 Sep 2012 11:35:18 +0200
Subject: [PATCH] Update to make it 'new EAPI' kind.

This effectively removes the backwards compatibility but makes the
implementation simpler and clearer.
---
 gentoo/xml/htdocs/proj/en/glep/glep-0062.txt | 59 ++++++++++++----------------
 1 file changed, 25 insertions(+), 34 deletions(-)

diff --git a/gentoo/xml/htdocs/proj/en/glep/glep-0062.txt b/gentoo/xml/htdocs/proj/en/glep/glep-0062.txt
index 0e90d30..91dcee1 100644
--- a/gentoo/xml/htdocs/proj/en/glep/glep-0062.txt
+++ b/gentoo/xml/htdocs/proj/en/glep/glep-0062.txt
@@ -7,7 +7,7 @@ Status: Draft
 Type: Standards Track
 Content-Type: text/x-rst
 Created: 17 Jun 2012
-Post-History: 11 Jul 2012
+Post-History: 11 Jul 2012, 29 Sep 2012
 
 
 Abstract
@@ -22,9 +22,9 @@ Motivation
 ==========
 
 Optional runtime dependencies are often found in packages installing
-various scripts (shell, python, perl). These are not strictly required
-for the particular package to work but installing them enables
-additional functionality.
+various scripts (shell, python, perl). These dependencies are not
+strictly required for the particular package to work but installing them
+enables additional functionality.
 
 Unlike in compiled programs, enabling or disabling those features
 (dependencies) does not affect the files installed by the package.
@@ -37,8 +37,8 @@ Currently such dependencies are usually expressed only through
 the necessary dependencies, and uninstall them when they are no longer
 necessary.
 
-Another solution is to use regular USE flags. Those flags do not strictly
-follow the principles of USE flags because they do not affect files
+An another solution is to use regular USE flags. Those flags do not
+strictly follow the principles of USE flags. They do not affect files
 installed by the package and are not entirely effective to the package
 (a disabled feature will still be available if necessary dependency is
 installed). Additionally, it requires unnecessary rebuilds
@@ -51,25 +51,21 @@ Specification
 The ebuilds aiming to provide features enabled through optional runtime
 dependencies should:
 
-1. create regular USE flags for all those features, following
-   appropriate specifications for Gentoo ebuilds, and including
-   the flags in the ``IUSE`` variable;
-2. introduce additional ``IUSE_RUNTIME`` variable listing names of USE
-   flags related to optional runtime dependencies (without prefixes
-   related to IUSE defaults).
+1. list the USE flags used for optional runtime dependencies
+   in ``IUSE_RUNTIME`` (and not ``IUSE``);
+2. list the necessary runtime dependencies in the ``SDEPEND`` variable.
 
 Additionally, the ebuilds must obey the following rules:
 
-1. all flags listed in ``IUSE_RUNTIME`` have to be listed in ``IUSE``
-   as well,
-2. flags listed in ``IUSE_RUNTIME`` can be referenced in ``RDEPEND``,
-   ``PDEPEND`` and ``REQUIRED_USE`` variables,
+1. flags listed in ``IUSE_RUNTIME`` must not be listed in ``IUSE``,
+2. flags listed in ``IUSE_RUNTIME`` can be referenced in ``SDEPEND``
+   and ``REQUIRED_USE`` variables,
 3. flags listed in ``IUSE_RUNTIME`` must not be referenced in phase
-   functions, ``DEPEND``, ``LICENSE`` or ``SRC_URI``,
+   functions, other dependency variables, ``LICENSE`` or ``SRC_URI``,
 4. flags listed in ``IUSE_RUNTIME`` can be referenced through USE
    dependencies by other packages' ``DEPEND``, ``RDEPEND``
-   and ``PDEPEND`` variables but it is unallowed to request disabling
-   those flags (only ``[flag]`` and ``[flag?]`` forms are allowed),
+   and ``PDEPEND``. However, it is not allowed to request disabling those
+   flags (only ``[flag]`` and ``[flag?]`` forms are allowed),
 5. flags listed in ``IUSE_RUNTIME`` can be referenced through
    ``has_version`` and ``best_version`` yet the caller must not rely
    upon those flags being disabled.
@@ -111,7 +107,7 @@ The remaining reused features include:
 - ability to describe flags in `metadata.xml`,
 - global flag names (and descriptions).
 
-Alternative proposed solution involved creating additional ``SDEPEND``
+Alternative proposed solution involved creating a flag-less ``SDEPEND``
 variable. That proposition had the following disadvantages:
 
 - being package-oriented rather than feature-oriented,
@@ -120,13 +116,10 @@ variable. That proposition had the following disadvantages:
 - lack of ability to express cross-feature dependencies,
 - lack of ability to describe features provided by enabled packages,
 - necessity of implementing a new user interface parts to control
-  the dependencies,
-- lack of backwards compatibility.
+  the dependencies.
 
-Those disadvantages could be fixed by either extending dependency
-syntax alike Exherbo (grouping, annotations) or using USE flags.
-The latter is practically equivalent to this solution yet introduces
-another variable unnecessarily.
+Those disadvantages could be fixed only through extending dependency
+syntax alike Exherbo (grouping, annotations).
 
 
 Reference implementation
@@ -138,7 +131,7 @@ in the installed package metadata:
 
 1. a list of runtime-switchable flags (``IUSE_RUNTIME``),
 2. a list of runtime dependencies conditional to runtime-switchable
-   flags, not subjected to USE expansion (relevant part of ``RDEPEND``),
+   flags, not subjected to USE expansion (unexpanded ``SDEPEND``),
 3. a list of ``REQUIRED_USE`` constraints relevant to runtime-switchable
    USE flags.
 
@@ -168,14 +161,14 @@ considered (either as a package dependency or user-requested atom):
 12. ``required_use`` = installed package metadata . ``REQUIRED_USE``;
 13. perform a check for ``required_use`` constraints being satisfied
     by ``effective_use``;
-14. ``run_rdepend`` = installed package metadata . ``RDEPEND`` (with
+14. ``sdepend`` = installed package metadata . ``SDEPEND`` (with
     unexpanded ``IUSE_RUNTIME`` conditionals);
-15. perform the dependency resolution for ``run_rdepend`` with
+15. perform the dependency resolution for ``sdepend`` with
     ``effective_use``,
 16. queue the package for runtime-switchable USE update.
 
 Furthermore, after installing all dependencies introduced by the above
-procedure (``run_rdepend`` resolution), if a package was queued for
+procedure (``sdepend`` resolution), if a package was queued for
 runtime-switchable USE update, the package manager should write a new
 value for ``USE`` key in installed package metadata.
 
@@ -183,10 +176,8 @@ value for ``USE`` key in installed package metadata.
 Backwards compatibility
 =======================
 
-Package managers not implementing this GLEP will consider
-the ``IUSE_RUNTIME`` variable as an irrelevant bash variable and treat
-runtime-switchable USE flags as regular USE flags. The dependency tree
-will still be consistent yet packages may be rebuilt unnecessarily.
+The feature is to be implemented in a new EAPI. Earlier package manager
+versions will not support the packages using it.
 
 
 Copyright
-- 
1.7.12

Attachment: signature.asc
Description: PGP signature

Reply via email to