Gentoo Archives: gentoo-dev

From: Steven J Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: Re: Re: stacking profile.bashrc?
Date: Tue, 18 Aug 2009 00:54:10
Message-Id: 2958418.yPlfznfc1f@news.friendly-coders.info
In Reply to: Re: [gentoo-dev] Re: Re: Re: stacking profile.bashrc? by Zac Medico
1 Zac Medico wrote:
2
3 > Steven J Long wrote:
4 >> Zac Medico wrote:
5 >>
6 >>> Steven J Long wrote:
7 >>>> Yeah sounds right. Perhaps a per-category bashrc split (both for
8 >>>> usual /etc/portage case and for overlays) might also be useful?
9 >>>> (Overlay admin can always test PN should the need arise.)
10 >>> Maybe that's more in the domain of eclasses (or some sort of elibs
11 >>> is they don't need to change metadata), in cases when it's easy
12 >>> enough to inherit whichever ones are needed.
13 >>>
14 >> Well the directory-based approach is for network/overlay admins or
15 >> downstream distros to tweak stuff without needing to edit and digest
16 >> ebuilds in a local overlay. JavaJake wanted to split the actual phases,
17 >> so we have a directory per-phase, which can ofc easily be done with a bit
18 >> of BASH or shell-script from the existing bashrc. This seems more useful
19 >> for end-user admins (whether local or network.)
20 >
21 > That seems like a reasonable use-case for per-phase sourcing.
22 >
23 Yeah, not something I see myself using a lot but I can see the attraction
24 for an end-user. (Standard technique is to only run scripts/include config
25 if they are marked executable.) OFC the utility is limited, as ferringb
26 outlined many moons ago [1], since the only variables available for an
27 external as opposed to source'd scriptlet are those exposed in the process
28 environment.
29 I guess that argues for just sourcing those? Dunno, some input from javaJake
30 would be good here, eh? ;)
31
32 [1] recommended for anyone who wants more insight into why we have bashrc
33 the way we do:
34 http://www.mail-archive.com/gentoo-portage-dev%40lists.gentoo.org/msg00544.html
35
36 >> For an overlay, from what I've seen in my limited exposure to the issue,
37 >> there is more of a need for influencing metadata, eg IUSE. .. That ties
38 >> in more with the next point; although as you say it could be done by
39 >> inheritance from an eclass, again that potentially involves editing the
40 >> ebuild.
41 >
42 > Note that any changes to ebuild metadata generation mean changes in
43 > metadata cache validation. For example, if you want to modify ebuild
44 > metadata from profile.bashrc, then you have to make sure to
45 > invalidate metadata cache any time the profile.bashrc is modified.
46
47 Is there some sort of issue with mtime checks that isn't dealt with via
48 git's technique of a config-flag for coarser-grained checks?
49 (I'm all for stricter digest based checking as well, but it seems odd we
50 can't use the mtime to key off, at least by default.)
51
52 > If such a change affects all ebuilds in the repo, it can be time
53 > consuming to regenerate all of the metadata cache. Also, if the
54 > cache validation mechanism isn't robust enough, users will
55 > experience annoying issues with stale cache.
56 <snip>
57
58 Certainly seems to be room to play with cache generation, or better to allow
59 overlay to distribute a per-repo cache. That could be rsync'ed alongside
60 the standard vcs-managed files, to avoid the hit of storing it in the vcs.
61 Might be worth considering a git digest as one of the types?
62
63 >> With the existing bashrc capability end-users can do all this ourselves;
64 >> it'd just be nice to be able to do it in overlays, and for what we
65 >> already have to be specified since it applies to both pkgcore and
66 >> portage, and has done for several years.
67 >
68 > We might want to have two separate bashrcs. One that's per-phase,
69 > and another one that's only sourced once. If it's only sourced once
70 > then it might allow you to make more radical changes that you
71 > couldn't otherwise make without breaking uninstall phases in some way.
72 >
73 That sounds nice; we have clear exemplars of use-case for each one. We're
74 really looking at two types: metadata-only and user (use latest version
75 whenever we're called, and don't save in binpkg) with policy enforced for
76 tree or overlay.
77
78 >>>> You mentioned in #-portage that per-phase execution is no longer used,
79 >>>> wrt how overlays would only be executing bashrc at start. I take it we
80 >>>> can still test $EBUILD_PHASE? (Sorry if I've misunderstood what you
81 >>>> were saying.)
82 >>> Current portage bashrc support allows $EBUILD_PHASE conditionals,
83 >>> but I think in the long term we may want to drop that in favor of
84 >>> function hooks that are sourced only once. The $EBUILD_PHASE
85 >>> conditional approach just seems somewhat clumsy in comparison
86 >>> (sourcing the bashrc during every phase might also be considered
87 >>> inefficient/ugly).
88 >>
89 >> My only concern here is that changes the admin makes, eg in
90 >> post_pkg_postinst, won't be reflected in uninstalling a package which was
91 >
92 > I assume you mean post_pkg_postrm, since post_pkg_postinst is never
93 > executed during uninstall.
94
95 Er yeah, sorry was tired and tidying up before holiday.
96
97 > Well, it is for the replacing package, if
98 > there is one, but that should have the latest environment anyway (at
99 > least, assuming it's not a binary package).
100 >
101 Yeah binary packages were the other concern.
102
103 >> installed before the change. For the DEPEND phase, as in IUSE
104 >> modification, that's not so much a problem afaict, since a) it's not
105 >> typically what network admins want to tweak, and b) it's right at the
106 >> start of the whole process. Any clarity you want to add will be
107 >> gratefully received ;)
108 >
109 > Again, metadata changes introduce cache validation issues that need
110 > to be carefully considered.
111 >
112 Hmm is this where we get into eclass digests? (again;)
113
114 --
115 #friendly-coders -- We're friendly but we're not /that/ friendly ;-)