Gentoo Archives: gentoo-dev-announce

From: Fabio Erculiani <lxnay@g.o>
To: gentoo-dev-announce@l.g.o
Subject: [gentoo-dev-announce] pkg_setup checks misuse
Date: Thu, 01 Jul 2010 13:18:17
1 This is something I keep seeing from time to time in our ebuilds and I
2 think it should be covered (somehow) by QA rules inside repoman.
3 I also know that just a little percentage of us are using binary
4 package features brought by Portage.
5 Unfortunately mistakes in pkg_setup() cause binary packages to not
6 install properly, and this, as well as automagic dependencies, get
7 exponentially amplified in <--your_fav_gentoo_based_binary_distro-->.
9 I can summarize the issue as follows:
10 Doing compile time checks in pkg_setup() is just wrong, beside any
11 binpkg vs sourcepkg discussion. pkg_setup() is called for binary
12 packages too (read the prefix carefully: it's "pkg_" not "src_").
13 So, stuff like checking if a certain package (that could compromise
14 the pkg build output) is installed, or checking against a desired
15 kernel feature making the ebuild dying (die()), instead of just
16 raising warnings (in case warnings would be enough), makes binary
17 packages support go boom!.
19 The last misuse i reported to bugzilla, that brought me writing this,
20 is taken from bug #326179:
22 pkg_setup() {
23 if has_version '<=media-video/vlc-1.0.99999'; then
24 eerror "Please unmerge vlc-1.0.x first before installing ${P}"
25 eerror "If you don't do that, some plugins will get
26 linked against"
27 eerror "the old ${PN} version and will not work."
28 die "Unmerge vlc 1.0.x first"
29 fi
30 ...
31 }
33 So please, pay attention to that ;)
35 Cheers,
36 --
37 Fabio Erculiani