1 |
I was bored yesterday, so i have updated and re-run an old script i had |
2 |
which tries to find ebuilds doing things like that: |
3 |
|
4 |
DEPEND="foo? ( cat-bar/libfoo )" |
5 |
src_compile() { |
6 |
econf || die |
7 |
emake || die |
8 |
} |
9 |
|
10 |
The problem here is that, if libfoo is installed, it will be linked to |
11 |
even when USE=-foo, because the "foo" flag is not used to affect the |
12 |
package configuration (no "$(use_enable foo)" or alike). |
13 |
|
14 |
The heuristic behind my script is that when a USE flag is used in DEPEND |
15 |
but is nowhere used in the ebuild code, there is something wrong. Sure, |
16 |
this doesn't apply to RDEPEND, where optionnal runtime deps are very |
17 |
welcome, and do not necessarily affect building of the package. |
18 |
|
19 |
A run on yesterday's Portage tree has found 2027 occurences [1], in 1065 |
20 |
ebuilds [2] of 454 different packages [3]. Among the affected ebuilds, |
21 |
367 were the best visible version of a package on ~x86 [4]. I've |
22 |
thought some people might be interested by this results, hence this |
23 |
email. |
24 |
|
25 |
From this lists, i had 73 packages installed [5], that i have reviewed |
26 |
[6] to see whether this results were complete crap or not. This analysis |
27 |
indicates that the heuristic is not bad, and that implementation is not |
28 |
as broken as i would have expected. Among the suspect conditionnal |
29 |
DEPEND of this packages: |
30 |
|
31 |
* 23 were actual automagic deps (what i was initialy after): |
32 |
- 5 could be fixed by using some existing ./configure options |
33 |
- 13 would need some autoconf patching (adding AC_ARG_ENABLE, etc.) |
34 |
- 5 would need patching some other build system (not autotools) |
35 |
* 40 were deps that should actually have been in RDEPEND only: |
36 |
- 9 that are selinux policies |
37 |
- 4 that are some extra gst-plugins |
38 |
- 3 that are other dlopened or alike stuffs (which do not affect |
39 |
the build time as far as i could see) |
40 |
- 11 that are executables for the runtime (like CD-R writing or FS |
41 |
formatting tools) |
42 |
- 6 that are interpreted languages modules (that were not checked |
43 |
or used at build-time sure) |
44 |
- 7 that are data files (doc, fonts, etc.) |
45 |
* 9 were useless deps (remainings of some older versions, doc-building |
46 |
tools that are never called, etc.) |
47 |
* 4 were false-positives: |
48 |
- in lirc, because the script doesn't understand $LIRC_DEVICES |
49 |
- in quake3, because the script missed the buildit() wrapper |
50 |
around use() |
51 |
- in pure-ftpd, because the script missed the enable_extension*() |
52 |
from confutils.eclass |
53 |
- in portage, because there is some "!build? ( ... )" deps |
54 |
That's the only case i've found where the heuristic is at fault |
55 |
on something legitimate. The 3 other false-positives are just |
56 |
implementation issues of the script. |
57 |
|
58 |
|
59 |
Now, the disclaimers: |
60 |
|
61 |
- I am sure my review of the 73 ebuilds i had installed do contains |
62 |
some mistakes. It was just a first pass to get a raw idea on the |
63 |
heuristic itself and the amount of false-positives. Don't worry, i will |
64 |
not go open 73 bug reports. Actually, i will only open some bug reports |
65 |
for cases i find important (in particular, that doesn't include the 40 |
66 |
"should be RDEPEND"), as i find time to write the patches. |
67 |
|
68 |
- If you look at the script [7,8], you will be horrified by how dumb |
69 |
it is. Yes, it will both miss lots of true-positives, and report some |
70 |
false-positive. It's not a static analyser for bash, but rather a stupid |
71 |
piece of grepping which happens to point a fair number of ebuild issues. |
72 |
|
73 |
[1]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/full-log.txt |
74 |
[2]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/catpkgver-flags.txt |
75 |
[3]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/catpkg.txt |
76 |
[4]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/best_visible-full.txt |
77 |
[5]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/installed-flags.txt |
78 |
[6]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/20070303/installed-ebuilds-analysis.txt |
79 |
[7]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/check_flags.sh |
80 |
[8]http://tdegreni.free.fr/gentoo/check_DEPEND_flags_usage/check_flags_with_logs.sh |
81 |
|
82 |
-- |
83 |
TGL. |
84 |
-- |
85 |
gentoo-dev@g.o mailing list |