Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   GLEP-0062: updated version for review (http://www.linux-archive.org/gentoo-development/708289-glep-0062-updated-version-review.html)

Michał Górny 09-29-2012 09:42 AM

GLEP-0062: updated version for review
 
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 <mgorny@gentoo.org>
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.

Zac Medico 09-29-2012 04:12 PM

GLEP-0062: updated version for review
 
On 09/29/2012 02:42 AM, Michał Górny wrote:
> 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.

Thanks, these changes make it much more manageable. Trying to do
something like this retroactively for existing EAPIs is just a mess.

> 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.

Will runtime flags be able to interact with buildtime flags then? It
seems like it could be useful, so it we should probably allow it. Sure,
people could write some expressions that don't make sense, but that's
already the case with REQUIRED_USE.
--
Thanks,
Zac

Ciaran McCreesh 09-29-2012 04:13 PM

GLEP-0062: updated version for review
 
On Sat, 29 Sep 2012 11:42:19 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> 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.

You've still not addressed the UI side of it in any way.

You've also still not provided any kind of reference implementation,
and your "reference implementation" section is still written with a
complete lack of awareness of how dependency resolution is actually
done.

--
Ciaran McCreesh

Michał Górny 09-29-2012 06:41 PM

GLEP-0062: updated version for review
 
On Sat, 29 Sep 2012 09:12:38 -0700
Zac Medico <zmedico@gentoo.org> wrote:

> On 09/29/2012 02:42 AM, Michał Górny wrote:
> > 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.
>
> Thanks, these changes make it much more manageable. Trying to do
> something like this retroactively for existing EAPIs is just a mess.
>
> > 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.
>
> Will runtime flags be able to interact with buildtime flags then? It
> seems like it could be useful, so it we should probably allow it. Sure,
> people could write some expressions that don't make sense, but that's
> already the case with REQUIRED_USE.

Yes, that's the intent, e.g. when a particular runtime feature requires
another build-time feature.

--
Best regards,
Michał Górny

Michał Górny 09-29-2012 06:43 PM

GLEP-0062: updated version for review
 
On Sat, 29 Sep 2012 17:13:14 +0100
Ciaran McCreesh <ciaran.mccreesh@googlemail.com> wrote:

> On Sat, 29 Sep 2012 11:42:19 +0200
> Michał Górny <mgorny@gentoo.org> wrote:
> > 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.
>
> You've still not addressed the UI side of it in any way.

Haven't I? Maybe you should read it more carefully.

> You've also still not provided any kind of reference implementation,
> and your "reference implementation" section is still written with a
> complete lack of awareness of how dependency resolution is actually
> done.

I'm sorry I haven't got time yet to write a package manager. I promise
I will do it as soon as I have time to do so. Thank you for your
patience.

--
Best regards,
Michał Górny


All times are GMT. The time now is 06:01 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.