diff --git a/pkg/installer/installer.go b/pkg/installer/installer.go index f271f6df..495e41f2 100644 --- a/pkg/installer/installer.go +++ b/pkg/installer/installer.go @@ -119,7 +119,8 @@ func (l *LuetInstaller) Upgrade(s *System) error { toInstall := []pkg.Package{} for _, assertion := range solution { - if assertion.Value { + // Be sure to filter from solutions packages already installed in the system + if _, err := s.Database.FindPackage(assertion.Package); err != nil && assertion.Value { toInstall = append(toInstall, assertion.Package) } } @@ -158,7 +159,6 @@ func (l *LuetInstaller) Swap(toRemove []pkg.Package, toInstall []pkg.Package, s } func (l *LuetInstaller) swap(syncedRepos Repositories, toRemove []pkg.Package, toInstall []pkg.Package, s *System) error { - // First match packages against repositories by priority allRepos := pkg.NewInMemoryDatabase(false) syncedRepos.SyncDatabase(allRepos) diff --git a/tests/integration/05_upgrade.sh b/tests/integration/05_upgrade.sh index ac86c582..3c79478e 100755 --- a/tests/integration/05_upgrade.sh +++ b/tests/integration/05_upgrade.sh @@ -108,13 +108,15 @@ testInstall() { } testUpgrade() { - luet --config $tmpdir/luet.yaml upgrade + upgrade=$(luet --config $tmpdir/luet.yaml upgrade) installst=$? assertEquals 'install test successfully' "$installst" "0" assertTrue 'package uninstalled B' "[ ! -e '$tmpdir/testrootfs/test5' ]" assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/newc' ]" assertTrue 'package uninstalled A' "[ ! -e '$tmpdir/testrootfs/testaa' ]" assertTrue 'package installed new A' "[ -e '$tmpdir/testrootfs/testlatest' ]" + assertNotContains 'does not contain test/c-1.0' "$upgrade" 'test/c-1.0' + assertNotContains 'does not attempt to download test/c-1.0' "$upgrade" 'test/c-1.0 downloaded' } # Load shUnit2. diff --git a/tests/integration/06_search.sh b/tests/integration/06_search.sh index 98fce79d..886a5197 100755 --- a/tests/integration/06_search.sh +++ b/tests/integration/06_search.sh @@ -112,8 +112,8 @@ testSearch() { assertEquals 'search exists successfully' "$searchst" "0" assertContains 'contains test/b-1.0' "$installed" 'test b 1.0' - assertContains 'contains test/b-1.0' "$installed" 'test a 1.0' - assertContains 'contains test/b-1.0' "$installed" 'test c 1.0' + assertContains 'contains test/a-1.0' "$installed" 'test a 1.0' + assertContains 'contains test/c-1.0' "$installed" 'test c 1.0' } # Load shUnit2.