MCPcopy Create free account
hub / github.com/celer-pkg/celer / orderedEntries

Method orderedEntries

configs/install_report.go:199–248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

197}
198
199func (i *installReport) orderedEntries() []installReportEntry {
200 // Convert map to slice for deterministic ordering in report output.
201 ordered := make([]installReportEntry, 0, len(i.entries))
202 for _, entry := range i.entries {
203 ordered = append(ordered, entry)
204 }
205
206 // Multi-key sort (high priority -> low priority):
207 // 1) dependency type group: runtime, buildtime, native
208 // 2) parent package
209 // 3) package itself
210 // 4) build system
211 // 5) install source
212 sort.SliceStable(ordered, func(first, second int) bool {
213 left := ordered[first]
214 right := ordered[second]
215
216 // Keep type groups together and in configured rank order.
217 leftRank := i.dependencyTypeRank(i.dependencyTypeOf(left))
218 rightRank := i.dependencyTypeRank(i.dependencyTypeOf(right))
219 if leftRank != rightRank {
220 return leftRank < rightRank
221 }
222
223 // Normalize empty parent to "-" so root entries can be compared consistently.
224 leftParent := left.Parent
225 rightParent := right.Parent
226 if strings.TrimSpace(leftParent) == "" {
227 leftParent = "-"
228 }
229 if strings.TrimSpace(rightParent) == "" {
230 rightParent = "-"
231 }
232 if leftParent != rightParent {
233 return leftParent < rightParent
234 }
235
236 // Then order by package identity and remaining metadata for stable output.
237 if left.Port != right.Port {
238 return left.Port < right.Port
239 }
240
241 if left.BuildSystem != right.BuildSystem {
242 return left.BuildSystem < right.BuildSystem
243 }
244 return left.InstalledFrom < right.InstalledFrom
245 })
246
247 return ordered
248}
249
250func (i *installReport) write(p *Port) (string, error) {
251 if i == nil || p == nil {

Callers 1

renderMarkdownMethod · 0.95

Calls 2

dependencyTypeRankMethod · 0.95
dependencyTypeOfMethod · 0.95

Tested by

no test coverage detected