Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priority option for repo configuration #5

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
85bebc4
Add priority option for repo configuration
kellyma2 Dec 5, 2024
8ab2cc8
Remove erroneous blank line
kellyma2 Jan 3, 2025
f2b3f04
Seperate RepoReducer from CacheHelper implementation
kellyma2 Jan 8, 2025
a50651f
Remove unused `lang` option for reducer
kellyma2 Jan 8, 2025
e505566
Extract Resolve() function for reducer
kellyma2 Jan 8, 2025
c84e3ac
reducer: pull out loadRepos() from Load()
kellyma2 Jan 8, 2025
710f6b0
reducer: Decouple loadRepos() from RepoReducer
kellyma2 Jan 8, 2025
29bd632
Merge pull request #79 from kellyma2/dead-code
kellyma2 Jan 8, 2025
325d64d
reducer: Factor our separate loader
kellyma2 Jan 8, 2025
11c8b10
deps: bumps all golang deps
manuelnaranjo Jan 13, 2025
4bbf4e5
Merge pull request #87 from rmohr/mnaranjo/bump-go-dependencies
manuelnaranjo Jan 14, 2025
c6d1b89
Make use of cmp.Or instead of complex ifs
manuelnaranjo Jan 13, 2025
60973b1
Using slices.[Sort,SortFunc]
manuelnaranjo Jan 13, 2025
73ea213
test: validate if sorting helps
manuelnaranjo Jan 13, 2025
e9f6570
sat: sort inputs to the sat solver for determinism
manuelnaranjo Jan 13, 2025
b5efd4c
Merge pull request #86 from rmohr/mnaranjo/make-sat-reproducible
manuelnaranjo Jan 14, 2025
b9918d5
Refine loader interface
kellyma2 Jan 8, 2025
3d25093
Merge branch 'main' into HEAD
kellyma2 Jan 15, 2025
3225b58
Merge pull request #85 from kellyma2/reducer-refactor
kellyma2 Jan 17, 2025
3377617
reducer: Add test for loader
kellyma2 Jan 9, 2025
816d264
reducer: Add tests for reducer process
kellyma2 Jan 17, 2025
891c572
Merge branch 'reducer-test' into priority
kellyma2 Jan 17, 2025
f00f2bd
Fix broken behaviour and add some tests
kellyma2 Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/api/bazeldnf/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ type Repository struct {
Arch string `json:"arch"`
Mirrors []string `json:"mirrors,omitempty"`
GPGKey string `json:"gpgkey,omitempty"`
Priority int `json:"priority,omitempty"`
}
11 changes: 8 additions & 3 deletions pkg/reducer/reducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,16 @@ func (r *RepoReducer) Resolve(packages []string) (matched []string, involved []*
if !found {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this RepoReducer.Resolve unit deserves a unit test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree in practice, if we want to add unit tests for this I think we should handle this separately as the change here is (relatively) narrow.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a test, it's arguably incomplete. Is the problem that it's hard to add a test to cover this new logic? It doesn't have to cover everything that was here already.

return nil, nil, fmt.Errorf("Package %s does not exist", req)
}
for i, p := range candidates {
discovered[p.String()] = candidates[i]
}

if len(candidates) > 0 {
selected := candidates[0]
for _, p := range candidates {
if selected.Repository.Priority > p.Repository.Priority {
selected = p
}
}

discovered[selected.String()] = selected
matched = append(matched, candidates[0].Name)
}
}
Expand Down