@@ -11,8 +11,7 @@ package gps
11
11
// The goal is to determine whether selecting the atom would result in a state
12
12
// where all the solver requirements are still satisfied.
13
13
func (s * solver ) check (a atomWithPackages , pkgonly bool ) error {
14
- pa := a .a
15
- if nilpa == pa {
14
+ if nilpa == a .a {
16
15
// This shouldn't be able to happen, but if it does, it unequivocally
17
16
// indicates a logical bug somewhere, so blowing up is preferable
18
17
panic ("canary - checking version of empty ProjectAtom" )
@@ -30,7 +29,7 @@ func (s *solver) check(a atomWithPackages, pkgonly bool) error {
30
29
// If we're pkgonly, then base atom was already determined to be allowable,
31
30
// so we can skip the checkAtomAllowable step.
32
31
if ! pkgonly {
33
- if err = s .checkAtomAllowable (pa ); err != nil {
32
+ if err = s .checkAtomAllowable (a ); err != nil {
34
33
return err
35
34
}
36
35
}
@@ -78,24 +77,24 @@ func (s *solver) check(a atomWithPackages, pkgonly bool) error {
78
77
79
78
// checkAtomAllowable ensures that an atom itself is acceptable with respect to
80
79
// the constraints established by the current solution.
81
- func (s * solver ) checkAtomAllowable (pa atom ) error {
82
- constraint := s .sel .getConstraint (pa . id )
83
- if s .vUnify .matches (pa . id , constraint , pa .v ) {
80
+ func (s * solver ) checkAtomAllowable (awp atomWithPackages ) error {
81
+ constraint := s .sel .getConstraint (awp . a . id , awp . bmi )
82
+ if s .vUnify .matches (awp . a . id , constraint , awp . a .v ) {
84
83
return nil
85
84
}
86
85
// TODO(sdboyer) collect constraint failure reason (wait...aren't we, below?)
87
86
88
- deps := s .sel .getDependenciesOn (pa .id )
87
+ deps := s .sel .getDependenciesOn (awp . a .id )
89
88
var failparent []dependency
90
89
for _ , dep := range deps {
91
- if ! s .vUnify .matches (pa . id , dep .dep .Constraint , pa .v ) {
92
- s .fail (dep .depender .id )
90
+ if ! s .vUnify .matches (awp . a . id , dep .dep .Constraint , awp . a .v ) {
91
+ s .fail (dep .depender .a . id )
93
92
failparent = append (failparent , dep )
94
93
}
95
94
}
96
95
97
96
err := & versionNotAllowedFailure {
98
- goal : pa ,
97
+ goal : awp . a ,
99
98
failparent : failparent ,
100
99
c : constraint ,
101
100
}
@@ -120,14 +119,14 @@ func (s *solver) checkRequiredPackagesExist(a atomWithPackages) error {
120
119
for _ , dep := range deps {
121
120
for _ , pkg := range dep .dep .pl {
122
121
if errdep , seen := fp [pkg ]; seen {
123
- errdep .deppers = append (errdep .deppers , dep .depender )
122
+ errdep .deppers = append (errdep .deppers , dep .depender . a )
124
123
fp [pkg ] = errdep
125
124
} else {
126
125
perr , has := ptree .Packages [pkg ]
127
126
if ! has || perr .Err != nil {
128
127
fp [pkg ] = errDeppers {
129
128
err : perr .Err ,
130
- deppers : []atom {dep .depender },
129
+ deppers : []atom {dep .depender . a },
131
130
}
132
131
}
133
132
}
@@ -147,7 +146,7 @@ func (s *solver) checkRequiredPackagesExist(a atomWithPackages) error {
147
146
// given dep are valid with respect to existing constraints.
148
147
func (s * solver ) checkDepsConstraintsAllowable (a atomWithPackages , cdep completeDep ) error {
149
148
dep := cdep .workingConstraint
150
- constraint := s .sel .getConstraint (dep .Ident )
149
+ constraint := s .sel .getConstraint (dep .Ident , a . bmi )
151
150
// Ensure the constraint expressed by the dep has at least some possible
152
151
// intersection with the intersection of existing constraints.
153
152
if s .vUnify .matchesAny (dep .Ident , constraint , dep .Constraint ) {
@@ -160,15 +159,15 @@ func (s *solver) checkDepsConstraintsAllowable(a atomWithPackages, cdep complete
160
159
var nofailsib []dependency
161
160
for _ , sibling := range siblings {
162
161
if ! s .vUnify .matchesAny (dep .Ident , sibling .dep .Constraint , dep .Constraint ) {
163
- s .fail (sibling .depender .id )
162
+ s .fail (sibling .depender .a . id )
164
163
failsib = append (failsib , sibling )
165
164
} else {
166
165
nofailsib = append (nofailsib , sibling )
167
166
}
168
167
}
169
168
170
169
return & disjointConstraintFailure {
171
- goal : dependency {depender : a . a , dep : cdep },
170
+ goal : dependency {depender : a , dep : cdep },
172
171
failsib : failsib ,
173
172
nofailsib : nofailsib ,
174
173
c : constraint ,
@@ -185,7 +184,7 @@ func (s *solver) checkDepsDisallowsSelected(a atomWithPackages, cdep completeDep
185
184
s .fail (dep .Ident )
186
185
187
186
return & constraintNotAllowedFailure {
188
- goal : dependency {depender : a . a , dep : cdep },
187
+ goal : dependency {depender : a , dep : cdep },
189
188
v : selected .a .v ,
190
189
}
191
190
}
@@ -206,7 +205,7 @@ func (s *solver) checkIdentMatches(a atomWithPackages, cdep completeDep) error {
206
205
// Fail all the other deps, as there's no way atom can ever be
207
206
// compatible with them
208
207
for _ , d := range deps {
209
- s .fail (d .depender .id )
208
+ s .fail (d .depender .a . id )
210
209
}
211
210
212
211
return & sourceMismatchFailure {
@@ -236,7 +235,7 @@ func (s *solver) checkRootCaseConflicts(a atomWithPackages, cdep completeDep) er
236
235
curid , _ := s .sel .getIdentFor (current )
237
236
deps := s .sel .getDependenciesOn (curid )
238
237
for _ , d := range deps {
239
- s .fail (d .depender .id )
238
+ s .fail (d .depender .a . id )
240
239
}
241
240
242
241
// If a project has multiple packages that import each other, we treat that
@@ -260,13 +259,13 @@ func (s *solver) checkRootCaseConflicts(a atomWithPackages, cdep completeDep) er
260
259
if current == a .a .id .ProjectRoot {
261
260
return & wrongCaseFailure {
262
261
correct : pr ,
263
- goal : dependency {depender : a . a , dep : cdep },
262
+ goal : dependency {depender : a , dep : cdep },
264
263
badcase : deps ,
265
264
}
266
265
}
267
266
268
267
return & caseMismatchFailure {
269
- goal : dependency {depender : a . a , dep : cdep },
268
+ goal : dependency {depender : a , dep : cdep },
270
269
current : current ,
271
270
failsib : deps ,
272
271
}
@@ -289,7 +288,7 @@ func (s *solver) checkPackageImportsFromDepExist(a atomWithPackages, cdep comple
289
288
290
289
e := & depHasProblemPackagesFailure {
291
290
goal : dependency {
292
- depender : a . a ,
291
+ depender : a ,
293
292
dep : cdep ,
294
293
},
295
294
v : sel .a .v ,
@@ -329,7 +328,7 @@ func (s *solver) checkRevisionExists(a atomWithPackages, cdep completeDep) error
329
328
330
329
return & nonexistentRevisionFailure {
331
330
goal : dependency {
332
- depender : a . a ,
331
+ depender : a ,
333
332
dep : cdep ,
334
333
},
335
334
r : r ,
0 commit comments