Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 167000 - split off common stuff in gnat related eclasses/confs into a separate eclass?
Summary: split off common stuff in gnat related eclasses/confs into a separate eclass?
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement with 1 vote (vote)
Assignee: Gentoo Linux ADA team
URL:
Whiteboard:
Keywords:
Depends on: 192505
Blocks: 137268
  Show dependency tree
 
Reported: 2007-02-15 10:36 UTC by George Shapovalov (RETIRED)
Modified: 2019-03-22 06:56 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Shapovalov (RETIRED) gentoo-dev 2007-02-15 10:36:34 UTC
It looks like there are enough funcs and vars that are "cross-inherited" among gnatbuild.eclass, gnat.eclass and eselect-gnat to warrant a common "root" eclass holding these items, perhaps calling it gnat_common.eclass.

The shared parameters as of now (shared via ugly hack of adjusting/sourcing another eclass or module, some by duplicating var defines):

1. CONFIG_PATH in gnatbuild.eclass and SPECSDIR in gnat.eselect are the same items, should be joined.

2. check for MARKER and ENVDIR duplication

3. get_current_gnat is pulled into gnatbuild.eclass from gnat.eselect by sourcing.  
Likely will go away actually.

4. do_set is pulled from gnat.eselect into gnat.eclass. But can this be removed from gnat.eselect?

5. SPECSDIR is used in gnat.eclass

Well, so far common vars are the principal candidates. 3. will probably go away soon and 4 may not be transferable. In this case sourcing of gnat.eselect by gnat.eclass will not be avoidable and then only the vars could be moved, which may not warrant a whole another eclass. Will have to think more about this whole issue.

George
Comment 1 George Shapovalov (RETIRED) gentoo-dev 2007-02-15 10:51:12 UTC
Looks like for implementing proper unmerge cleanup logic I will need to move the unset function form gnat.eselect to common eclass too. So, I'll need to seriously look into doing this. Perhaps most of the eselect functionality will have to be moved to the common eclass and then the eselect module itself would be very simple.

George
Comment 2 George Shapovalov (RETIRED) gentoo-dev 2007-09-19 20:38:59 UTC
Ok, 90% done.
As per discussion with ciaranm in #192505 (why is that when I ask anything on -dev nobody answers? :)) the common code cannot reside in eclass nor anywhere in portage, as eselect module (or, for that matter, any other package not directly dealing with portage tree) cannot depend on portage tree being present. Nor would I accept duplication of code. 

The solution then is to have the core functions in a separate file belonging to eselect-gnat, (pure bash, no portage or eselect extensions). Everything gnat related depends on eselect-gnat directly or indirectly, therefore it can depend on this file being present at proper time. However it is better not to source that file at top level in any eclass (but this is Ok from within the eselect module).

Location of this code:
It only makes sence that it would go under /usr/share/gnat, I opted for keeping it inside the lib/ subdir, as this seems to make sense at the moment. Thus it became /usr/share/gnat/lib/gnat-common.bash.
I was somewhat hesitant whether this should be under /usr/share or, actually, /usr/lib (which seems to make a bit more sense), but went with the first one, since eselect and all its extra modules put all the scripts under /usr/share.

Just need to check what was that comment on the unset function about and then I should be able to close this bug.

George
Comment 3 George Shapovalov (RETIRED) gentoo-dev 2007-09-19 20:39:39 UTC
Actually this should block that reorg tracker..