diff --git a/internal/actions/actions.go b/internal/actions/actions.go index de8ffd7..a999930 100644 --- a/internal/actions/actions.go +++ b/internal/actions/actions.go @@ -143,7 +143,7 @@ func checkLegacyVersion(ver *versions.Versions, cfg config.LLPkgConfig, mappedVe latestVersion := vers[0] - isLatest := semver.Compare(currentVersion, latestVersion) > 0 + isLatest := semver.Compare(currentVersion, latestVersion) >= 0 // fast-path: we're the latest version if isLatest { // case1: we're the latest version, but mapped version is not latest, invalid. diff --git a/upstream/installer/conan/conan_test.go b/upstream/installer/conan/conan_test.go index 409e551..8a97579 100644 --- a/upstream/installer/conan/conan_test.go +++ b/upstream/installer/conan/conan_test.go @@ -21,7 +21,7 @@ func (vs packageSort) Len() int { return len(vs) } func (vs packageSort) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } func (vs packageSort) Less(i, j int) bool { - return vs[i].Version < vs[j].Version + return vs[i].Name < vs[j].Name } func TestConanCJSON(t *testing.T) { @@ -141,8 +141,11 @@ func testDependency(t *testing.T, config map[string]string, pkg upstream.Package } sort.Sort(packageSort(ver)) - if !reflect.DeepEqual(ver, expectedDeps) { - t.Errorf("unexpected dependency for sdl: want %v got %v", expectedDeps, ver) + for i, expectedPkg := range expectedDeps { + // skip checking version of deps, because they may be upgraded + if expectedPkg.Name != ver[i].Name { + t.Errorf("unexpected dependency for sdl: want %v got %v", expectedDeps, ver) + } } } @@ -166,18 +169,18 @@ func TestConanDependency(t *testing.T) { Version: "3.2.6", } expectedDeps := []upstream.Package{ - {"libusb", "1.0.26"}, {"dbus", "1.15.8"}, - {"libiconv", "1.17"}, + {"expat", "2.7.1"}, {"libalsa", "1.2.12"}, - {"wayland", "1.22.0"}, - {"zlib", "1.3.1"}, - {"xkbcommon", "1.6.0"}, + {"libffi", "3.4.4"}, + {"libiconv", "1.17"}, {"libsndio", "1.9.0"}, - {"pulseaudio", "17.0"}, + {"libusb", "1.0.26"}, {"libxml2", "2.13.6"}, - {"expat", "2.7.1"}, - {"libffi", "3.4.4"}, + {"pulseaudio", "17.0"}, + {"wayland", "1.22.0"}, + {"xkbcommon", "1.6.0"}, + {"zlib", "1.3.1"}, } testDependency(t, map[string]string{}, pkg, expectedDeps) }) @@ -208,8 +211,8 @@ func TestConanDependency(t *testing.T) { Version: "1.1.42", } expectedDeps := []upstream.Package{ - {"zlib", "1.3.1"}, {"libxml2", "2.13.6"}, + {"zlib", "1.3.1"}, } testDependency(t, map[string]string{ "options": `libxml2/*:iconv=False`, @@ -223,8 +226,8 @@ func TestConanDependency(t *testing.T) { } expectedDeps := []upstream.Package{ {"libiconv", "1.17"}, - {"zlib", "1.3.1"}, {"libxml2", "2.13.6"}, + {"zlib", "1.3.1"}, } testDependency(t, map[string]string{}, pkg, expectedDeps) })