Skip to content

Commit

Permalink
rpmmd: delete unused ResolveConflictsExclude()
Browse files Browse the repository at this point in the history
This method is no longer used by any code, let's delete it.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza authored and achilleas-k committed Dec 1, 2023
1 parent 7152886 commit 08a93eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 65 deletions.
19 changes: 0 additions & 19 deletions pkg/rpmmd/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,6 @@ func (ps PackageSet) Append(other PackageSet) PackageSet {
return ps
}

// ResolveConflictsExclude resolves conflicting Include and Exclude package lists
// content by deleting packages listed as Excluded from the Include list.
func (ps PackageSet) ResolveConflictsExclude() PackageSet {
excluded := map[string]struct{}{}
for _, pkg := range ps.Exclude {
excluded[pkg] = struct{}{}
}

newInclude := []string{}
for _, pkg := range ps.Include {
_, found := excluded[pkg]
if !found {
newInclude = append(newInclude, pkg)
}
}
ps.Include = newInclude
return ps
}

// TODO: the public API of this package should not be reused for serialization.
type PackageSpec struct {
Name string `json:"name"`
Expand Down
46 changes: 0 additions & 46 deletions pkg/rpmmd/test/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rpmmdtests

import (
"encoding/json"
"fmt"
"path/filepath"
"reflect"
"testing"
Expand Down Expand Up @@ -147,51 +146,6 @@ func Test_LoadAllRepositories(t *testing.T) {
}
}

func TestPackageSetResolveConflictExclude(t *testing.T) {
tests := []struct {
got rpmmd.PackageSet
want rpmmd.PackageSet
}{
{
got: rpmmd.PackageSet{
Include: []string{"kernel", "microcode_ctl", "dnf"},
Exclude: []string{"microcode_ctl"},
},
want: rpmmd.PackageSet{
Include: []string{"kernel", "dnf"},
Exclude: []string{"microcode_ctl"},
},
},
{
got: rpmmd.PackageSet{
Include: []string{"kernel", "dnf"},
Exclude: []string{"microcode_ctl"},
},
want: rpmmd.PackageSet{
Include: []string{"kernel", "dnf"},
Exclude: []string{"microcode_ctl"},
},
},
{
got: rpmmd.PackageSet{
Include: []string{"kernel", "microcode_ctl", "dnf"},
Exclude: []string{},
},
want: rpmmd.PackageSet{
Include: []string{"kernel", "microcode_ctl", "dnf"},
Exclude: []string{},
},
},
}
for idx, tt := range tests {
t.Run(fmt.Sprintf("%d", idx), func(t *testing.T) {
if !reflect.DeepEqual(tt.got.ResolveConflictsExclude(), tt.want) {
t.Errorf("ResolveConflictExclude() returned unexpected result got: %#v\n want: %#v", tt.got.ResolveConflictsExclude(), tt.want)
}
})
}
}

func TestOldWorkerRepositoryCompatUnmarshal(t *testing.T) {
testCases := []struct {
repoJSON []byte
Expand Down

0 comments on commit 08a93eb

Please sign in to comment.