1 |
On 01/06/2015 08:53 PM, Brian Dolbec wrote: |
2 |
> On Wed, 31 Dec 2014 00:07:19 -0800 |
3 |
> Zac Medico <zmedico@g.o> wrote: |
4 |
> |
5 |
>> This adds support for a new --sync-submodule option to both emerge and |
6 |
>> emaint. When this option is used with the sync action, only the |
7 |
>> selected submodules are synced. Each submodule is referenced using an |
8 |
>> abstract identifier, which serves to hide the implementation details |
9 |
>> involving the precise locations of specific submodules within each |
10 |
>> repository. |
11 |
>> |
12 |
>> Currently, --sync-submodule has no effect for sync protocols other |
13 |
>> than rsync, but the new SyncBase._get_submodule_paths() method will |
14 |
>> be useful for implementing support in other SyncBase subclasses. |
15 |
>> |
16 |
>> X-Gentoo-Bug: 534070 |
17 |
>> X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=534070 |
18 |
>> --- |
19 |
>> |
20 |
>> portage.process.spawn(command, diff --git |
21 |
>> a/pym/portage/sync/syncbase.py b/pym/portage/sync/syncbase.py index |
22 |
>> 94d4aab..fcde51f 100644 --- a/pym/portage/sync/syncbase.py |
23 |
>> +++ b/pym/portage/sync/syncbase.py |
24 |
>> @@ -12,6 +12,11 @@ import os |
25 |
>> import portage |
26 |
>> from portage.util import writemsg_level |
27 |
>> |
28 |
>> +_SUBMODULE_PATH_MAP = { |
29 |
>> + 'glsa': 'metadata/glsa', |
30 |
>> + 'news': 'metadata/news', |
31 |
>> + 'profiles': 'profiles', |
32 |
>> +} |
33 |
>> |
34 |
>> |
35 |
> |
36 |
> It mostly looks good, but... |
37 |
> |
38 |
> I don't like the idea of hard-coding this in the base class. |
39 |
> |
40 |
> I think this should be configurable per-repo or at least per repo type. |
41 |
|
42 |
The paths should be the same as long as the repo conforms to existing |
43 |
conventions. If the repo doesn't conform to existing conventions, then |
44 |
existing tools won't know where to look for the glsa, news, and profiles |
45 |
directories. |
46 |
|
47 |
> This patch clears the way for other repo types to have sub-modules, but |
48 |
> will they be the same mapping for a git tree with those as |
49 |
> sub-modules? Maybe I'm just not following how the system works |
50 |
> properly... |
51 |
|
52 |
Yes, they should use the same mappings, as explained above. |
53 |
|
54 |
> Alternatively...if the above is wrong/not feasible. In the |
55 |
> sync/__init__.py you have the choices hard-coded there independently of |
56 |
> these definitions above. I would prefer that one get it's options from |
57 |
> the other. Since syncbase.py is not gauranteed to be loaded, I would |
58 |
> think that the above be declared in the sync module's __init__.py and |
59 |
> imported or passed in here. Then the: |
60 |
> |
61 |
> "choices": ("glsa", "news", "profiles"), |
62 |
> |
63 |
> could become: |
64 |
> |
65 |
> "choices": list(_SUBMODULE_PATH_MAP) |
66 |
> |
67 |
> Then there is only one place to edit as options or code change. |
68 |
|
69 |
That's a good idea. I'll make a patch for that. |
70 |
-- |
71 |
Thanks, |
72 |
Zac |