Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] conf: Enable to set rsync extra opts per repository
Date: Mon, 06 Jul 2015 18:28:49
Message-Id: 20150706112836.4e012276.dolsen@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] conf: Enable to set rsync extra opts per repository by "Étienne Buira"
1 On Thu, 18 Jun 2015 23:32:27 +0200
2 Étienne Buira <etienne.buira@×××××.com> wrote:
3
4 > Hi, thank you for reviewing
5 >
6 > On Wed, Jun 17, 2015 at 01:32:17PM -0700, Brian Dolbec wrote:
7 > > Be aware that I have not read over the diff very much yet.
8 > >
9 > > On Wed, 17 Jun 2015 20:40:30 +0200
10 > > Étienne Buira <etienne.buira@×××××.com> wrote:
11 > >
12 > > > diff --git a/pym/portage/package/ebuild/config.py
13 > > > b/pym/portage/package/ebuild/config.py index 3a4007b..08db363
14 > > > 100644 --- a/pym/portage/package/ebuild/config.py
15 > > > +++ b/pym/portage/package/ebuild/config.py
16 > > > @@ -515,6 +515,8 @@ class config(object):
17 > > > v = confs.get("SYNC")
18 > > > if v is not None:
19 > > > portdir_sync = v
20 > > > + if 'PORTAGE_RSYNC_EXTRA_OPTS' in
21 > > > confs:
22 > > > +
23 > > > self['PORTAGE_RSYNC_EXTRA_OPTS'] =
24 > > > confs['PORTAGE_RSYNC_EXTRA_OPTS'] self["PORTDIR"] = portdir
25 > > > self["PORTDIR_OVERLAY"] = portdir_overlay
26 > >
27 > > Not sure why ebuild/config.py needs changes... will look at it more
28 >
29 > For the same reason the same thing is done about ['SYNC']: forwarding
30 > its value to RepoConfigLoader.__init__ settings argument.
31 >
32 > > > diff --git a/pym/portage/repository/config.py
33 > > > b/pym/portage/repository/config.py index b7c969d..196b87a 100644
34 > > > --- a/pym/portage/repository/config.py
35 > > > +++ b/pym/portage/repository/config.py
36 > >
37 > >
38 > > This approach is not wanted, it means hard coding any sync module
39 > > options in the main loader that might be sync-type specific.
40 > >
41 > > We want to make it generic so any arbitrary sync-type options (more
42 > > than the base required options) can be added for any module without
43 > > the need to change this. Those options are not used anywhere else
44 > > other than the sync module.
45 >
46 > Ok, patchset follows.
47
48 Sorry, it's taken so long to review these ones. There has been a lot
49 going on recently.
50
51
52
53 This is much better, I like the way you've added them for the most
54 part. But, you added them to the actual sync module class. By doing
55 that, it forces portage to load the sync module even if it is not going
56 to perform any sync action.
57
58 Portage's code requires that the configs be loaded for all operations,
59 so it reads them on initialization. That is the reason I put the
60 config validation code handling in the sync module's module_spec. It
61 is small, lightweight, and only provides the info needed.
62
63
64 Each sync module's __init__.py contains only the information about the
65 sync module for the plugin system to use and any config validation code
66 needed. The module_specific_options should be defined here. That way
67 none of the actual sync code is loaded until a sync operation is
68 performed. This both speeds up initialization of portage and reduces
69 it's memory needs slightly.
70
71
72 hmm, this is the cvs module's module_spec, I was thinking we might be
73 able to add the module_specific_opts there after the validate_config
74 definition, like so:
75
76 module_spec = {
77 'name': 'cvs',
78 'description': doc,
79 'provides':{
80 'cvs-module': {
81 'name': "cvs",
82 'class': "CVSSync",
83 'description': doc,
84 'functions': ['sync', 'new', 'exists'],
85 'func_desc': {
86 'sync': 'Performs a cvs up on the
87 repository', 'new': 'Creates the new repository at the specified
88 location', 'exists': 'Returns a boolean of whether the specified dir ' +
89 'exists and is a valid CVS
90 repository', },
91 'validate_config': CheckCVSConfig,
92 'module_specific_opts': None,
93 }
94 }
95 }
96
97
98 Also, the config validation code should probably be exteneded for any
99 module specific options as well.
100
101 I'll look into whether that will work.
102 I'll add your patch and see about moving things around.
103
104
105 >
106 > > One method might be to replace the copying of the configparser
107 > > options into python variables. Instead change it to look for the
108 > > option in the configparser instance. And only maintain some base
109 > > options or functions which pull from the config instance.
110 >
111 > Not sure i understood what you meant, nor how that would look like,
112 > please explain if patchset is not oked.
113 >
114 > Regards.
115 >
116 >
117
118 Don't worry about this, this change will require a complete re-do of
119 the portage/repository/config code. I like your approach to handle
120 this for the most part. It will be the easiest to do with the code
121 that is in place now.
122
123
124 --
125 Brian Dolbec <dolsen>

Replies