mirror of
https://github.com/mudler/luet.git
synced 2025-08-01 23:41:37 +00:00
Merge pull request #75 from mudler/fixup_upgrade
Don't attempt to upgrade packages already in system
This commit is contained in:
commit
0067fa82a5
@ -119,7 +119,8 @@ func (l *LuetInstaller) Upgrade(s *System) error {
|
|||||||
|
|
||||||
toInstall := []pkg.Package{}
|
toInstall := []pkg.Package{}
|
||||||
for _, assertion := range solution {
|
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)
|
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 {
|
func (l *LuetInstaller) swap(syncedRepos Repositories, toRemove []pkg.Package, toInstall []pkg.Package, s *System) error {
|
||||||
|
|
||||||
// First match packages against repositories by priority
|
// First match packages against repositories by priority
|
||||||
allRepos := pkg.NewInMemoryDatabase(false)
|
allRepos := pkg.NewInMemoryDatabase(false)
|
||||||
syncedRepos.SyncDatabase(allRepos)
|
syncedRepos.SyncDatabase(allRepos)
|
||||||
|
@ -108,13 +108,15 @@ testInstall() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testUpgrade() {
|
testUpgrade() {
|
||||||
luet --config $tmpdir/luet.yaml upgrade
|
upgrade=$(luet --config $tmpdir/luet.yaml upgrade)
|
||||||
installst=$?
|
installst=$?
|
||||||
assertEquals 'install test successfully' "$installst" "0"
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
assertTrue 'package uninstalled B' "[ ! -e '$tmpdir/testrootfs/test5' ]"
|
assertTrue 'package uninstalled B' "[ ! -e '$tmpdir/testrootfs/test5' ]"
|
||||||
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/newc' ]"
|
assertTrue 'package installed B' "[ -e '$tmpdir/testrootfs/newc' ]"
|
||||||
assertTrue 'package uninstalled A' "[ ! -e '$tmpdir/testrootfs/testaa' ]"
|
assertTrue 'package uninstalled A' "[ ! -e '$tmpdir/testrootfs/testaa' ]"
|
||||||
assertTrue 'package installed new A' "[ -e '$tmpdir/testrootfs/testlatest' ]"
|
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.
|
# Load shUnit2.
|
||||||
|
@ -112,8 +112,8 @@ testSearch() {
|
|||||||
assertEquals 'search exists successfully' "$searchst" "0"
|
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 b 1.0'
|
||||||
assertContains 'contains test/b-1.0' "$installed" 'test a 1.0'
|
assertContains 'contains test/a-1.0' "$installed" 'test a 1.0'
|
||||||
assertContains 'contains test/b-1.0' "$installed" 'test c 1.0'
|
assertContains 'contains test/c-1.0' "$installed" 'test c 1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load shUnit2.
|
# Load shUnit2.
|
||||||
|
Loading…
Reference in New Issue
Block a user