Gentoo Archives: gentoo-dev

From: Drake Wyrm <wyrm@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Ebuild interactivity
Date: Sat, 01 May 2004 18:44:15
Message-Id: 20040501185302.GA27598@phaenix.haell.com
In Reply to: Re: [gentoo-dev] Ebuild interactivity by Joshua Brindle
1 On Sat, 2004-05-01, 05:11:55 -0500, in <409377EB.2050707@g.o>,
2 Joshua Brindle <method@g.o> wrote:
3 > If this must be done (and it seems like there is pressure to do so) I
4 > believe the best way is to expand the profile/global/conf language to
5 > support such choices. For example, if an app needs a mysql host and db
6 > that can have a 'default' value in the profile (ugh) or the
7 > make.global file, like MYSQL_HOST, MYSQL_DB. These would be defaults
8 > just like all other aspects of gentoo (like default CFLAGS, default
9 > USE vars, etc) and would be overridden by the user in make.conf.
10 >
11 > Ebuilds that use such variables could add a warning:
12 >
13 > *WARNING: Current MYSQL_HOST is localhost (default) *WARNING: Change
14 > this in make.conf if you need to
15 >
16 > then you get rid of the interactivity problem.. the only problem with
17 > this is a bloated make.global that has variables for probably every
18 > database type available, etc but it's still a more elegant way than
19 > asking for input when the ebuild is used.
20
21 A while back, I suggested adding a new function, pkg_depend(), to the
22 ebuild engine. The context was handling complicated dependencies, but
23 I've given this some additional thought. Such a function could solve a
24 number of other problems mentioned in the last month or so.
25
26 pkg_depend() would either report the prerequisites for a package to
27 Portage, or check for them, depending on whether the ebuild was
28 currently being scanned for metadata, or actually being built.
29
30 This function would call a number of need_* functions. The first were
31 need_dep() and need_rdep(), to specify package dependencies. Just as an
32 example of what I'm thinking:
33
34 pkg_depend() {
35 need_rdep '>=net-www/apache-2*' || die
36 need_dep '|| ( virtual/aspell-dict app-text/ispell
37 app-text/hspell )' || die
38 need_dep 'sys-devel/gcc' || die
39 }
40
41 need_dep() {
42 newdepend "$1"
43 if [ "${EBUILD_PHASE}" != "depend" ]
44 then
45 has_version "$1"
46 return $?
47 fi
48 return 0
49 }
50
51 The `need_dep()` function returns success during the depend phase, but
52 when `pkg_depend()` is called from dyn_setup, for example, it can raise
53 an error.
54
55 Problems:
56 * portageq can't handle dynamic dependencies; `has_version '|| (
57 foo bar) always returns failure
58 * this conficts with the noauto feature
59
60 Remember the discussion about three weeks ago, regarding better ways to
61 handle adding system users. The conversation was dropped, because there
62 is little chance that Portage will ever be able to, for example, add
63 users to an LDAP server. Still, we need a way to specify that a package
64 requires a particular user to be available.
65
66 need_user apache || die "User 'apache' not available"
67
68 Problems:
69 * I don't know of any easy way to ask the system to resolve,
70 from the command line, a username. Grepping the passwd file
71 works when users are authenticated locally, but that's not the
72 situation this is supposed to solve.
73
74 Now for optional and required configuration options:
75
76 need_config MYSQL_HOST || die "must define MYSQL_HOST"
77 need_config MYSQL_DB || die "must define MYSQL_DB"
78 use_config THISPACKAGE_PORT # defaults to tcp:42
79
80 Problems:
81 * namespace issues
82 * when to inform the sysadmin? `emerge -pv`, perhaps?
83 * I really need to apply to be a developer, instead of just
84 making random suggestions now and then.
85
86
87 --
88 Batou: Hey, Major... You ever hear of "human rights"?
89 Kusanagi: I understand the concept, but I've never seen it in action.
90 --Ghost in the Shell