Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] factoring miscellaneous shell code and logic out of ebuild.sh (into doebuild)
Date: Mon, 06 Mar 2006 23:36:24
Message-Id: 440CC72E.1000100@gentoo.org
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Hi everyone,
5
6 The current state of ebuild.sh is that it's been abused to perform miscellaneous shell tasks that are triggered before or after various ebuild phases. In order to rectify the situation, I propose that we factor out any logic and shell code that is not directly needed for the execution of legitimate ebuild phases that are documented in the ebuild.5 man page. Anything that we factor out can be triggered from the doebuild function of the portage module instead.
7
8 In order to facilitate the migration of miscellaneous shell tasks out of ebuild.sh, I've created a shell script called misc-functions.sh which can be used instead of ebuild.sh for shell tasks that use the ebuild.sh environment. This script actually sources ebuild.sh in order to inherit the ebuild.sh environment, without polluting ebuild.sh itself.
9
10 I've written a patch [1] that migrates several shell tasks out of the ebuild.sh dyn_preinst() function and into misc-functions.sh. Those functions are then triggered inside of the doebuild function of the portage module. The install_mask function came from solar's patch for bug 81025 [2].
11
12 When migrating code out of ebuild.sh, it's important that the environment variables and functions that are expected by ebuilds remain intact. However, a large amount of code an logic that currently resides in ebuild.sh can safely be migrated to misc-functions.sh (or elsewhere) and triggered from the doebuild function of the portage module instead.
13
14 My hope is that, eventually, all of the shell code and logic that is not needed for the execution of legitimate ebuild phases (documented in ebuild.5) will be migrated out of ebuild.sh. This will make ebuild.sh easier to maintain by reducing bloat and will lead to better organization of code and logic that is triggered from doebuild.
15
16 If you would like to try the patch, I've provided a current svn snapshot and an ebuild [3] that automatically applies the patch. Your feedback would be appreciated.
17
18 Zac
19
20 [1] http://dev.gentoo.org/~zmedico/portage/branches/2.1/patches/doebuild_refactoring.patch
21 [2] http://bugs.gentoo.org/show_bug.cgi?id=81025
22 [3] http://dev.gentoo.org/~zmedico/overlay/sys-apps/portage/portage-2.1_pre20060306.ebuild
23
24 -----BEGIN PGP SIGNATURE-----
25 Version: GnuPG v1.4.2.1 (GNU/Linux)
26
27 iD8DBQFEDMcs/ejvha5XGaMRArsvAKC+JnDrjsEb6mjleLfBZ1qjZfOmVwCfQumH
28 FTOUOdIHOmDnueniXhITtXs=
29 =dT1k
30 -----END PGP SIGNATURE-----
31 --
32 gentoo-portage-dev@g.o mailing list

Replies