Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] post_sync actions
Date: Sun, 30 Oct 2005 05:29:00
Message-Id: 20051030052750.GA6443@nightcrawler
In Reply to: Re: [gentoo-portage-dev] [PATCH] post_sync actions by Jason Stubbs
1 On Sun, Oct 30, 2005 at 01:02:43PM +0900, Jason Stubbs wrote:
2 > On Sunday 30 October 2005 09:32, Ned Ludd wrote:
3 > > On Sun, 2005-10-30 at 03:15 +0900, Jason Stubbs wrote:
4 > > > This really goes hand in hand with the pre/post phase hooks patch. That
5 > > > patch, however, implements hooks as bash functions rather than external
6 > > > executables. The discrepancy there should probably be worked out before
7 > > > either are included. Personally, I'm for the external executable method
8 > > > but I'm sure that there will be alternative opinions...
9 > >
10 > > The pre/post hooks the way it's being worked out seems pretty ideal for
11 > > it's purpose. Where this post_sync hook is an action hook vs a phased
12 > > hook and we cant really source any files in. I'm thinking both ways are
13 > > fitting for what they should do.
14 >
15 > The purpose of pre/post hooks is to allow user code to be run before/after a
16 > phase. What I'm asking is what benefits there are to requiring user hooks to
17 > be bash functions versus arbitrary executables.
18
19 They're stored in the env, easily accessible, and it replaces the
20 bashrc functionality that ebd removes- that is what pre/post phase
21 hooks do, and only that.
22
23 pre/post hooks as bash functions (inlined/sourced via bashrc) makes
24 sense for that particular role.
25
26 A) the code has access to the local env (there's a major
27 difference between exported and local, most of the
28 interesting knobs are local)
29 B) the hooks have no way to influence the ebuild.sh env. No, this is
30 not a pro, it detracts from what the hooks are intended for (direct
31 access into the env including the ability to blow your own foot
32 off).
33 C) user submission of bugs (especially when/if ebd hits) *will* include
34 the environment at some point. We can see what they've inserted
35 into the hooks, and see if/how they screwed it up. Doesn't work
36 that way for your proposed file approach, beyond telling them to
37 include the contents of their hooks directory.
38 Still need the env for debugging however.
39 D) If they want to do seperate files, they can _if_ it's bashrc based.
40 It doesn't work the other way if it's file based.
41 E) Bashrc is a single point of entry, in other words a single point to
42 reach out and pull the appropriate functions dependant on cat/pkg.
43 Split files == duplicated switching, which is not friendly to
44 users (keep it simple, less mistakes).
45
46 Hammering the point a bit further, the seperated file suggestion below
47 *still* leaves bashrc in use, due to the fact chunked out pre/post
48 phase hooks don't give you the ability to inspect/modify the env prior
49 to portage even sourcing half it's functions.
50
51 bashrc route for pre/post is the most flexible and powerful route, and
52 it should stay as it is.
53
54
55 > > He had also mentioned perhaps making the post sync a user definable
56 > > variable and then spwaning as POST_SYNC="exec1:exec2:exec3". He pointed
57 > > out that it would also open a hole in portage where it would look in
58 > > profile dirs.
59 >
60 > Something like:
61 > /etc/portage/hooks/post_sync
62 > /etc/portage/hooks/pre_src_unpack
63 > /etc/portage/hooks/post_src_compile
64 >
65 > seems more intuitive to me. The POST_SYNC variable would complicate portage
66 > code in the attempt to uncomplicate the user code (when more than one script
67 > is wanted to be ran). What I'm trying to figure out is why bashrc + post_sync
68 > is a better combination.
69
70 Not much for this obviously. Aside from reasons above, changing the
71 method people use for accessing the ebuild.sh env midstream without
72 significant gain isn't good, plus it'll force any eclasses that need
73 to do env resets (work around portage) to modify all of their ebuilds,
74 rather then the route java eclasses were intended to take so the 1.4
75 -> 1.5 could actually occur.
76
77 post sync has a limited shelf life; it's usable now for the following
78 1) rolling gensync functionality in
79 2) rolling glsa notices on sync in
80 3) rolling package watch lists of updates in
81 4) a method to trigger transfer of an rsync temp dir on a rsync proxy
82 for a lan to the actual directory rsyncd distributes from.
83
84 All of the above can be pulled off via aliasing/functions/custom
85 scripts; what solar's patch implements is a way to inline it so people
86 don't have to hack around missing functionality from portage, they can
87 insert work arounds in the meantime.
88
89 Assume their is no question of what post sync will be (a target),
90 unless you're advocating slipping that into the bashrc (which is a bad
91 idea beyond pollution of the ebuild.sh env).
92
93 Maybe I've missed your point/question, which case feel free to
94 disregard this email and clarify, but the question of how pre/post is
95 implemented and why it should be this way I think I've laid out pretty
96 well above.
97 ~harring

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] post_sync actions Jason Stubbs <jstubbs@g.o>