diff --git a/cmd/config_helper.go b/cmd/config_helper.go index e780f370..e4408cce 100644 --- a/cmd/config_helper.go +++ b/cmd/config_helper.go @@ -13,7 +13,11 @@ import ( // makeId creates an opaque, deterministic string identifier, unique for each package present in the config. func makeId(pkg *api.Package) string { - return pkg.Name + id := pkg.Name + if pkg.Arch != "" { + id += "." + pkg.Arch + } + return id } func sortedKeys[K cmp.Ordered, V any](m map[K]V) []K { diff --git a/pkg/sat/loader.go b/pkg/sat/loader.go index 5d799966..e20bb68e 100644 --- a/pkg/sat/loader.go +++ b/pkg/sat/loader.go @@ -309,6 +309,9 @@ func (loader *Loader) explodeSamePackageConflicts(pkgVar *Var) bf.Formula { if otherVar.Package == pkgVar.Package { // itself continue } + if otherVar.Package.Arch != pkgVar.Package.Arch { + continue + } conflictingVars = append(conflictingVars, bf.Var(otherVar.satVarName)) } if len(conflictingVars) == 0 { diff --git a/pkg/sat/sat_test.go b/pkg/sat/sat_test.go index a0a9fe87..d8fd6b12 100644 --- a/pkg/sat/sat_test.go +++ b/pkg/sat/sat_test.go @@ -1493,6 +1493,33 @@ func TestNewResolver(t *testing.T) { exclude: []string{"testb-0:1.x86_64"}, solvable: true, }, + {name: "package needed in two architectures, and referenced by name", packages: []*api.Package{ + newPkgAP("testa", "1", "i686", 1, []string{}, []string{"/usr/lib/libfoo.so"}, []string{}), + newPkgAP("testb", "1", "x86_64", 1, []string{}, []string{"/usr/lib64/libfoo.so"}, []string{}), + newPkgAP("testc", "1", "noarch", 1, []string{}, []string{"foo"}, []string{}), + newPkgAP("foo", "1", "i686", 1, []string{"/usr/lib/libfoo.so"}, []string{}, []string{}), + newPkgAP("foo", "1", "x86_64", 1, []string{"/usr/lib64/libfoo.so"}, []string{}, []string{}), + }, requires: []string{ + "testa", "testb", "testc", + }, + architectures: []string{"x86_64", "i686"}, + install: []string{"testa-0:1.i686", "testb-0:1.x86_64", "testc-0:1.noarch", "foo-0:1.i686", "foo-0:1.x86_64"}, + exclude: []string{}, + solvable: true, + }, + {name: "package needed in two architectures, and referenced by file", packages: []*api.Package{ + newPkgAP("testa", "1", "i686", 1, []string{}, []string{"/usr/lib/libfoo.so"}, []string{}), + newPkgAP("testb", "1", "x86_64", 1, []string{}, []string{"/usr/lib64/libfoo.so"}, []string{}), + newPkgAP("foo", "1", "i686", 1, []string{"/usr/lib/libfoo.so"}, []string{}, []string{}), + newPkgAP("foo", "1", "x86_64", 1, []string{"/usr/lib64/libfoo.so"}, []string{}, []string{}), + }, requires: []string{ + "testa", "testb", + }, + architectures: []string{"x86_64", "i686"}, + install: []string{"testa-0:1.i686", "testb-0:1.x86_64", "foo-0:1.i686", "foo-0:1.x86_64"}, + exclude: []string{}, + solvable: true, + }, // TODO: Add test cases. }