public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] new glep draft: Portage as a secondary package manager
@ 2005-05-02 12:22 Michael Haubenwallner
  2005-05-02 14:13 ` Ciaran McCreesh
                   ` (3 more replies)
  0 siblings, 4 replies; 53+ messages in thread
From: Michael Haubenwallner @ 2005-05-02 12:22 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 406 bytes --]

Hi ebuild devs,

Here's a glep draft now for (a part of) the long-term portage-goal
"act as a secondary package manager" ...

Comments welcome,
  haubi
-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html


[-- Attachment #2: glep-87877.txt --]
[-- Type: text/plain, Size: 5128 bytes --]

GLEP: XXX
Title: Portage as a secondary package manager
Version: $Revision: 1.5 $
Last Modified: $Date: 2005/04/27 09:29:06 $
Author: Michael Haubenwallner <michael.haubenwallner@salomon.at>
Status: Draft
Type: Standard Track
Content-Type: text/x-rst
Created: 25 Apr 2005
Post-History:


Abstract
========

When administrators have to compile and install third party packages on their
unix systems, most of the time they want to install them in a prefix other than
``/usr``. The common example is ``/usr/local``.

This document is intended to describe how to write ebuilds to work with both
primary (prefix ``/usr``) and secondary (other prefixes) portage instances,
and how portage has to be modified to get able to act as a secondary package
manager too.


Motivation
==========

Right now, many of the administrators do maintain their self-compiled packages
even manually or with their own scripts.

As portage is already a package manager for a source-based Linux distribution,
the idea is to use it also as a secondary package manager for prefixes other
than ``/usr``.


Rationale
=========

Currently, ``/usr`` is used hardcoded as the prefix in the ebuild-tree,
unless the portage provided functions econf/emake and the like are used.
If so, the prefix setting is delegated to those functions.

To get a prefix under portage's control, a portage instance has to be installed
into this prefix. To perform this install, just have recent python and bash
installed somewhere in PATH (they need not to be installed in destination
prefix) and install portage like most of other open source packages::

 $ bunzip2 < portage-XXX.tar.gz | tar xf -
 $ cd portage-XXX
 $ ./configure --prefix=/new/prefix
 $ make
 $ make install

Portage will create its own database there [#vdb]_.
This document prefers a filesystem hierarchy under this prefix as close as
possible to the current filesystem hierarchy used in Gentoo Linux [#FHS]_.

After setting up an ebuild-tree there and tweaking the parameters in
``/new/prefix/etc/make.conf``, ebuilds supporting such an installation can be
proceeded with this just installed portage. The ebuilds will install their
packages into the same prefix as portage is installed.


Changes for ebuilds
===================

Portage will provide an environment variable ``PREFIX``, containing ``/usr``
when acting as the primary package manager (as in Gentoo Linux), or the prefix
it is installed to when acting as the secondary package manager for that prefix.

There are some difference between prefix ``/usr`` and other prefixes:
``/usr`` has its configuration-files, state-dirs and others in ``/``
(as ``/etc``, ``/var``, ``/other``) while ``/new/prefix`` has them directly in
``/new/prefix`` (as ``/new/prefix/etc``, ``/new/prefix/var``,
``/new/prefix/other``).

So there is one more variable needed to be set by portage to get the pathes
right for those dirs residing in ``/`` for prefix ``/usr``. This variable is
called ``AFFIX``, and is empty for prefix ``/usr``, but set to ``new/prefix/``
for prefix ``/new/prefix``, and to ``usr/local/`` for prefix ``/usr/local``.

The difference for the ebuild now is to use ``${PREFIX}`` and ``/${AFFIX}``
instead of hardcoded ``/usr`` and ``/``, like this::

   src_compile() {
 -     ${S}/configure --prefix=/usr --sysconfdir=/etc
 +     ${S}/configure --prefix=${PREFIX} --sysconfdir=/${AFFIX}etc
       make
   }

And of course, a new keyword [#keyword-glep]_ has to be added to the ebuild
to get a package unmasked for a platform where portage acts as a secondary
package manager.


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

To keep ebuilds working with old portage versions not setting PREFIX and AFFIX,
the default value for ``PREFIX`` can be set within the ebuild-tree in
``profiles/base/profile.bashrc`` like this::

 [[ -z $PREFIX ]] && PREFIX=/usr
 export PREFIX

The default value for ``AFFIX`` is empty and needs not to be set explicitly.


Implementation
==============

A patch for portage to set ``PREFIX`` and ``AFFIX`` can already be found in
gentoo bugzilla [#bgo87877]_.


References
==========

.. [#vdb] ``${PREFIX}/var/db/pkg``, for example ``/new/prefix/var/db/pkg``.

.. [#FHS] http://www.pathname.com/fhs/ with one exception:

    FHS-2.3 says the variable data dir for ``/usr/local`` resides in
    ``/var/local``, and in ``/var/opt`` for prefix ``/opt`` while this
    document will install them to ``/usr/local/var``, ``/opt/var`` or even
    ``/new/prefix/var``.

    But there's also a possibility in FHS-2.3 to have ``/var/local`` and
    ``/var/opt`` as softlinks somewhere to ``/usr/local/var`` and ``/opt/var``,
    and it's not defined if one installs a tree in ``/new/prefix``
    that the variable data should go to ``/var/new/prefix`` instead of
    ``/new/prefix/var``.

    Maybe this is what Gentoo developers call "pathspec" ?

.. [#keyword-glep] GLEP 22, New ``keyword`` system to incorporate various
   userlands/kernels/archs (http://glep.gentoo.org/glep-0022.html)

.. [#bgo87877] http://bugs.gentoo.org/show_bug.cgi?id=87877


Copyright
=========

This document has been placed in the public domain.



^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2005-05-24 12:10 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-02 12:22 [gentoo-dev] new glep draft: Portage as a secondary package manager Michael Haubenwallner
2005-05-02 14:13 ` Ciaran McCreesh
2005-05-03  0:02   ` Brian Harring
2005-05-03 12:53     ` Michael Haubenwallner
2005-05-03 14:12     ` Ciaran McCreesh
2005-05-05  8:48       ` Brian Harring
2005-05-05  8:55         ` Brian Harring
2005-05-05 14:01         ` Ciaran McCreesh
2005-05-06  5:09           ` Brian Harring
2005-05-06 13:12             ` Brian Jackson
2005-05-07  1:07               ` Brian Harring
2005-05-06 13:28             ` Ciaran McCreesh
2005-05-07  1:05               ` Brian Harring
2005-05-07  1:39                 ` Ciaran McCreesh
2005-05-07  7:08                   ` Brian Harring
2005-05-07 14:49                     ` Ciaran McCreesh
2005-05-07 15:31                       ` Kito
2005-05-07 15:51                         ` Ciaran McCreesh
2005-05-08  7:58                           ` [gentoo-dev] new glep draft: Portage as a secondary package manager OT Brian Harring
2005-05-08 15:22                             ` Ciaran McCreesh
2005-05-07 15:47                       ` [gentoo-dev] new glep draft: Portage as a secondary package manager Jason Stubbs
2005-05-07 20:02                         ` Ciaran McCreesh
2005-05-08  8:33                         ` Brian Harring
2005-05-09  0:46                           ` [gentoo-dev] new glep draft: Portage as a secondary package manager, [gentoo-dev] Marius Mauch
2005-05-09 10:54                             ` [gentoo-dev] new glep draft: Portage as a secondary package manager Brian Harring
2005-05-19  8:18                         ` Michael Haubenwallner
2005-05-19  8:30                           ` Ciaran McCreesh
2005-05-19 11:05                             ` Michael Haubenwallner
2005-05-19 11:19                               ` Ciaran McCreesh
2005-05-19 12:46                                 ` Michael Haubenwallner
2005-05-19 19:42                                   ` Ciaran McCreesh
2005-05-19 13:01                           ` Jason Stubbs
2005-05-20 12:30                             ` Michael Haubenwallner
2005-05-21  1:22                               ` Jason Stubbs
2005-05-23  7:11                                 ` Michael Haubenwallner
2005-05-07  9:58                   ` Marius Mauch
2005-05-12  7:56                     ` Michael Haubenwallner
2005-05-12 23:44                       ` Marius Mauch
2005-05-03 12:54   ` Michael Haubenwallner
2005-05-02 19:15 ` Brian Jackson
2005-05-03  0:58   ` Alec Warner
2005-05-03  2:11     ` Brian Jackson
2005-05-03  2:48       ` Brian Harring
2005-05-03  3:16         ` Brian Jackson
2005-05-03  6:05         ` Marius Mauch
2005-05-03 12:54         ` Michael Haubenwallner
2005-05-03 12:54     ` Michael Haubenwallner
2005-05-03 13:22 ` Jason Stubbs
2005-05-07 11:18   ` Michael Haubenwallner
2005-05-24  9:53 ` Michael Haubenwallner
2005-05-24 10:07   ` Ciaran McCreesh
2005-05-24 10:43     ` Brian Harring
2005-05-24 12:21     ` Michael Haubenwallner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox