Gentoo Archives: gentoo-portage-dev

From: Jason Stubbs <jstubbs@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] DepSet
Date: Thu, 08 Dec 2005 12:36:47
Message-Id: 200512082136.17838.jstubbs@gentoo.org
In Reply to: Re: [gentoo-portage-dev] DepSet by Zac Medico
1 On Thursday 08 December 2005 16:44, Zac Medico wrote:
2 > The middle hunk fixes a problem with block atoms that do not match any
3 > packages. Previously, these atoms would not make it into the okay_atoms set
4 > which caused unresolved dependencies.
5
6 Are you sure about this? For reference:
7
8 @@ -58,12 +58,19 @@
9                                 all_atoms.union_update(atomset)
10                         okay_atoms = sets.Set()
11                         for atom in all_atoms:
12 +                               have_blocker=False
13                                 for child in self.pkgs:
14                                         if atom.key != child.key:
15                                                 continue
16 -                                       if atom.match(child) ^ atom.blocks:
17 -                                               okay_atoms.add(atom)
18 +                                       if atom.match(child):
19 +                                               if atom.blocks:
20 +                                                       have_blocker=True
21 +                                               else:
22 +                                                       okay_atoms.add(atom)
23                                                 break
24 +                               if atom.blocks and not have_blocker:
25 +                                       # block atom that does not match any
26 packages
27 +                                       okay_atoms.add(atom)
28                         for choice in self.pkgs[pkg][0]:
29                                 if choice.issubset(okay_atoms):
30                                         break
31
32
33 if atom.match(child) ^ atom.blocks:
34 okay_atoms.add(atom)
35 break
36
37 is the same as:
38
39 if (atom.match(child) and not atom.blocks) or \
40 (not atom.match(child) or atom.blocks):
41 okay_atoms.add(atom)
42 break
43
44
45 have_blocker = False
46 ...
47 if atom.match(child):
48 if atom.blocks:
49 have_blocker=True
50 else:
51 okay_atoms.add(atom)
52 break
53 if atom.blocks and not have_blocker:
54 okay_atoms.add(atom)
55
56 Therefore:
57
58 have_blocker = atom.blocks and atom.match(child)
59
60 which makes the last check:
61
62 if atom.blocks and not (atom.blocks and atom.match(child)):
63 okay_atoms.add(atom)
64
65 which is equivalent to:
66
67 if atom.blocks and (not atom.blocks or not atom.match(child)):
68 okay_atoms.add(atom)
69
70 Removing the impossibility of "atom.blocks and not atom.blocks":
71
72 if atom.blocks and not atom.match(child):
73 okay_atoms.add(atom)
74
75 Within the loop you have:
76
77 if atom.match(child):
78 if atom.blocks:
79 ...
80 else:
81 okay_atoms.add(atom)
82 break
83
84 Which could be represented as:
85
86 if atom.match(child) and not atom.blocks:
87 okay_atoms.add(atom)
88
89 Combining those two gives:
90
91 if atom.blocks and not atom.match(child) or \
92 atom.match(child) and not atom.blocks:
93 okay_atoms.add(atom)
94
95 Which is exactly the same thing as the original except seven lines longer...
96
97 --
98 Jason Stubbs
99
100 --
101 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] DepSet Zac Medico <zmedico@×××××.com>