Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-dev@l.g.o
Subject: Re: "Environement categories" (was Re: [gentoo-dev] fix binary debug support, part elevenity billion 1/2)
Date: Tue, 24 Jan 2006 06:49:05
Message-Id: 20060124064433.GA31519@nightcrawler.had1.or.comcast.net
In Reply to: "Environement categories" (was Re: [gentoo-dev] fix binary debug support, part elevenity billion 1/2) by Danny van Dyk
1 On Mon, Jan 23, 2006 at 07:28:05PM +0100, Danny van Dyk wrote:
2 > Donnie Berkholz schrieb:
3 > | Marius Mauch wrote:
4 > |>I meant the option is redundant if it just triggers a feature setting,
5 > |>as it's the same as `FEATURES=debug-build emerge foo`
6 > |
7 > | OK, where's my package.features and packages.cflags files then? I can do
8 > | what I want through Mike's proposal, which is to build a specific
9 > | collection of packages with debugging. I also don't need to duplicate
10 > | the same list of packages in one file with FEATURES=nostrip and in
11 > | another with debugging CFLAGS.
12 >
13 > I'd love to have one package.env (or similarly named) file that can set
14 > environmental options on a per-package-base. This is just a proposal,
15 > but i personally would like it this way:
16 >
17 > # First define a category of environmental options:
18 > stable=( \
19 > "ACCEPT_KEYWORDS=\"arch\"" \
20 > "CFLAGS=\"-pipe -O -march=foo\"" \
21 > )
22
23 We've already got package.keywords...
24 Not saying it's the best, but muddying up the existing configuration
25 with N ways of saying the same thing imo isn't the sanest.
26
27 > debug=( \
28 > "FEATURES=\"debug-build keepwork\"" \
29
30 And there is the kicker. Portage has globals, which are in various
31 states of use- most of the features you're looking to tweak *are*
32 effectively globals already.
33
34 So... you need seperate configuration instances. This gets ugly since
35 not all code uses a passed in config instance, some falls back to
36 global access (just the same as not all code uses passed in dbapi's,
37 they use the global portage.db).
38
39 The config representation does a nasty little dance where it pushes
40 changes on, then pops them (moreso it just flat out regenerates the
41 settings)- extending usage of that really isn't a good thing imo,
42 since it's fundamentally the wrong design. Hell, such an approach
43 won't fly anyways for any real possibility of threaded execution
44 (parallel-fetch doesn't count, it's a fork for exactly this reason).
45
46 See where I'm going with this, and why the portage crew occasionally
47 make reference to design flaws? :)
48
49 Might I suggest this one just get shelved for a while? I'm not much
50 for spanky's proposal from an implementation side of things, but it
51 skirts the areas I'm concerned about (thus I'm mostly neutral on it),
52 but varying all configuration data per node is a whole different beast
53 from spanky's proposal- it's not skirting the areas that are icky.
54
55 Realistically, need to design the bugger so configuration data is
56 pushed down to each level/abstraction rather then a global obj; do
57 that, and it's easy to vary settings per node; rewrite is designed
58 this way, just not finished.
59
60 Personally, I'd rather revisit this a few months down the line- right
61 now it's too nasty of a hack to even consider it in stable.
62
63
64 > This proposed format could even be more easily parsed when split into to
65 > files. One file to define the categories and one to define the
66 > package-to-category bindings. The first file would be pure bash and
67 > could be loaded like this:
68 >
69 > mycat=$(
70 > . ${CATEGORY_FILE}
71 > cat=${!cat}
72 > for i in $(seq 0 $(( ${#cat[@]} - 1)) ) ; do
73 > echo -e "${cat[${i}]}"
74 > done
75 > )
76
77 Bash side overrides are a no go; either the resolver would have to
78 spawn a shell instance for processing each node, or portage would have
79 to know how to parse and execute shell (hard... very hard).
80
81 So... at least the bash side of it, not really doable imo. Same
82 reason you can't use bashrc to affect features (for the most part),
83 by the time that code is executed it's too late in the game.
84
85 ~harring

Replies