Gentoo Archives: gentoo-portage-dev

From: Alec Warner <warnera6@×××××××.edu>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] the refactoring of emerge, continued... (was PATCH: refactor emerge spinner (#102073))
Date: Fri, 12 Aug 2005 12:36:08
Message-Id: 42FC97C9.7050301@egr.msu.edu
In Reply to: [gentoo-portage-dev] the refactoring of emerge, continued... (was PATCH: refactor emerge spinner (#102073)) by Zac Medico
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Zac Medico wrote:
5 > Hello All,
6 >
7 > The use of global scope code should be minimized in order to prevent
8 > confusion and thereby make code more understandable and maintainable.
9 > After some analysis of emerge's global scope code, I am confident that
10 > all of it can be refactored quite easily, with no regressions or changes
11 > in functionality (reorganization only).
12 >
13 > In order to accomplish this goal, I have categorized the global scope
14 > variables by which parts of code depend on them. The variables are
15 > listed in the following table, in the order that they occur in the
16 > source code:
17 >
18 > Variable Name Dependency
19 > -------------------------------------------------------
20 > spinner search.execute(),depgraph.create()
21 > merged unused
22 > params unused
23 > actions local
24 > options local
25 > shortmapping local
26 > myaction global
27 > myopts global
28 > myfiles global
29 > edebug global
30 > verbosity global
31 > tmpcmdline local
32 > cmdline local
33 > CLEAN_DELAY unmerge()
34 > EMERGE_WARNING_DELAY global
35 > myparams depgraph.create(),depgraph.xcreate()
36 > add local
37 > sub local
38 >
39 > Variables within a given category can be dealt with in a similar
40 > manner. For example, variables with "local" dependency should be
41 > enclosed within a function or method along with the code that depends on
42 > them. Variables with "global" dependency can either remain as global
43 > variables or become instance variables of an object.
44 >
45 > Based on this analysis, I believe that I can quickly create an emerge
46 > refactorization patch for portage-2.1 with no regressions or changes in
47 > functionality (reorganization only). If all (or some) of the portage
48 > developers agree that it is a good idea then I would be happy to create
49 > a patch for all to scrutinize. :-)
50 I have emerge rewritten ( somewhere ) for HEAD once all of Brian's
51 config/domain/crazy stuff goes in, unless someone wants to unlease
52 modular emerge now, in which case I can pull the code out of the cobwebs
53 of my ${HOME} and work on it again.
54
55 Basically the code allowed you to have a folder for modules that emerge
56 would detect at run-time, and load the proper ones depending on user
57 specification. The bonus to this was that some tools would be merged
58 into emerge instead of being seperate, which many users got upset about.
59 "emerge --rebuild" = revdep-rebuild -X for example. The main problem
60 with this is basically the same as above; emerge serves about 12
61 different functions with crappy code everywhere, I managed to replicate
62 about half the functionality by just copying and pasting important code
63 everywhere, but most of it still needs to be completely rewritten (
64 *stabs depgraph* ). I was going to wait for the new API to be done ( no
65 use rewriting emerge twice, IMHO ), but if you want it done now it
66 wouldn't be a big deal.
67
68 - -Alec Warner
69 -----BEGIN PGP SIGNATURE-----
70 Version: GnuPG v1.4.1 (GNU/Linux)
71 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
72
73 iQIVAwUBQvyXyWzglR5RwbyYAQK07A/+I25MWYwwdaKtNm89UVhgpBadaN+WpMxX
74 bjgiDFqqoSimNTlIUqWN10w6BM+AXIlvjwCOa8NofjWY5AhgzuM1ULlipSNQ8BrD
75 Ia20hmVYj2fCJHUx0oU4SZn49BTk1bxtGrDhHHowW3+ERtoo97uuI1ItlUG2gZ/7
76 Qs8yJs+mPx7dgJsplJOgvWytadNwc4rwiwV6kOq+nOSixY8FSQJwXiZd6YNkjhhE
77 2vOagT2XwP4MXcaAorlj7z+Nwk+ScW9+X84smMPApEgL0kulsvnVLGqJdNuWUFEa
78 CwMgv1MIZGGXmtC2/ctaPAKyE3ZQW7pxLzs1T/sjde5Wt7b7bHiXDYpDQfV6agVt
79 x0dIh36FLSzYYvqSu7wbzgkpJZyWGDDNInIOkRyHgDTwyUVJIoR0w28cTSzjo//G
80 leLGt5BgXPeHXGzKORRUBUOAaWRUQChL/naSn+I422XXTmoSgm/Fkc+ea7FPX7qr
81 f7WWARY9Hnx1NCrYJBPB9yTQyPkmAcBD5jf/jR/vEMykgVU49ldEwUVu+J8P57JZ
82 /YT4xwFw2sTLX4zLU5HxeWArh/m7LGILyt0FzDTzLGKko5WFtXLx2yN9aX6EXSHJ
83 kfBUQGO84Gkt3d77CIQUrXxjw5Gxxrz9WBOXIe2E6VaAdElRynXoQFLisoCrSs4a
84 YtRmsEiVJ6E=
85 =pw6K
86 -----END PGP SIGNATURE-----
87 --
88 gentoo-portage-dev@g.o mailing list

Replies