Gentoo Archives: gentoo-dev

From: Marius Mauch <genone@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: auto-detection of unpack dependencies
Date: Sun, 20 Jul 2008 15:31:18
Message-Id: 20080720172958.c7caf004.genone@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: auto-detection of unpack dependencies by Peter Volkov
1 On Sun, 20 Jul 2008 17:41:58 +0400
2 Peter Volkov <pva@g.o> wrote:
3
4 > В Чтв, 17/07/2008 в 04:51 +0200, Marius Mauch пишет:
5 > > At dev.gentoo.org/~genone/unpack.eclass is the draft for an eclass
6 > > to implement this feature.
7 >
8 > Marius, although it's possible to do this things in eclass why is
9 > eclass better? As I see portage's unpack() already has extension <->
10 > "program to unpack" relation. Basically unpack() in ebuild.sh has the
11 > following code:
12 >
13 > unpack() {
14 > [snip]
15 > case "${x##*.}" in
16 > tar)
17 > tar xof "${srcdir}${x}" ${tar_opts} || die "$myfail"
18 > ;;
19 > tgz)
20 > tar xozf "${srcdir}${x}" ${tar_opts} || die "$myfail"
21 > [snip and so on...]
22 >
23 > This means that every ebuild which uses 'unpack ${A}' should have in
24 > DEPEND a program which is selected by filename extension of sources.
25 > So as I understood your initial suggestion was to make this happen
26 > automatically. And this is very logical as makes ebuilds cleaner and
27 > more terse. So why did you changed your mind and try to write another
28 > eclass (which then should sit in the tree forever), to create
29 > duplicate unpack function instead of just making step you suggested
30 > initially? Is there any intension to remove unpack logic from package
31 > manager? And if yes, why?
32
33 The eclass is provided as a proof-of-concept implementation that can be
34 used without adding additional infrastructure and implementing and
35 defining a new EAPI version. PM-based solutions would be nicer
36 long-term, but are also more tricky to "get right" (mainly a question
37 of where to inject the deps). Also the eclass approach has the benefit
38 that the whole unpack logic can be maintained in one location vs. being
39 split between multiple places in the package manager and the tree, and
40 is easier to extend (no need for an EAPI change just to add a new unpack
41 format).
42 And as you ask, there have been plans to move quite a bit of
43 the bash code from portage into the tree (transparently to ebuilds
44 though) as that's the better place to maintain many helper functions
45 like do* or new* that are only used by ebuilds/eclasses and not portage.
46 But those plans have already existed for years (long before EAPI
47 existed) without anything happening, and they've never been very
48 specific wrt what exactly could be moved.
49 Even with a PM-based solution it might be useful, depending on the
50 actual implementation, to have the unpack() funtion in the tree, for
51 the reasons outlined in the first paragraph.
52
53 Marius