Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] ArchChecks: don't mix arches between ebuilds
Date: Sun, 24 Apr 2016 08:01:35
Message-Id: 20160424010028.0ebb302a.dolsen@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] ArchChecks: don't mix arches between ebuilds by "Michał Górny"
1 On Sun, 24 Apr 2016 08:15:56 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > On Sat, 23 Apr 2016 16:57:21 -0700
5 > Zac Medico <zmedico@g.o> wrote:
6 >
7 > > Fix ArchChecks to not mix arches of ebuilds together, so that
8 > > errors are only reported for those arches that the ebuild has
9 > > keywords for.
10 > > ---
11 > > Applies to the *repoman* branch.
12 > >
13 > > pym/repoman/modules/scan/arches/arches.py | 2 +-
14 > > 1 file changed, 1 insertion(+), 1 deletion(-)
15 > >
16 > > diff --git a/pym/repoman/modules/scan/arches/arches.py
17 > > b/pym/repoman/modules/scan/arches/arches.py index 4df25a8..6e1c17d
18 > > 100644 --- a/pym/repoman/modules/scan/arches/arches.py
19 > > +++ b/pym/repoman/modules/scan/arches/arches.py
20 > > @@ -69,7 +69,7 @@ class ArchChecks(ScanBase):
21 > > arches.add(('**', '**', ('**',)))
22 > > # update the dynamic data
23 > > dyn_arches = kwargs.get('arches')
24 > > - #dyn_arches.clear()
25 > > + dyn_arches.clear()
26 > > dyn_arches.update(arches)
27 >
28 > Is that some crazy way of replacing contents of an existing dict? May
29 > be worth a comment since the code looks suspicious, at least.
30 >
31
32 It was an interim step so that modules didn't pass back
33 arbitrary data to be re-used by other modules after it. This way
34 maintains the data pointer to the set (not dict) object in the calling
35 function. Just assigning it a new set doesn't set the 'arches' pointer
36 in the calling function so that it can pass that data along to other
37 modules.
38
39 Instead it is getting an extended Future instance from asyncio to hold
40 the target data. That also gives it the ability to raise an error if
41 the data is not set or something tries to set it a second time, etc..
42
43 BTW, the code to replace the contents of an existing dictionary is way
44 crazier... It has to loop and pop() each item until empty, it does
45 not have a clear(). Then you can update it with the new contents.
46
47 But this step did prove the basic tightened up modules data interface.
48 And debugged the initial conversion, so I'll be coding the rest of the
49 conversion in the morning. Then I'll apply your xml patches.
50 --
51 Brian Dolbec <dolsen>

Replies