From af0a2132c6914f9f2484ffdfd43a51d304053989 Mon Sep 17 00:00:00 2001 From: Gaspartcho <93390411+Gaspartcho@users.noreply.github.com> Date: Sun, 25 Feb 2024 20:15:55 +0100 Subject: Checks if dependency is core beofore marking it as orphan (#76) * checks if dependency is core beofore marking it as orphan * creting new var actually not needed --- src/lpm.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lpm.lua b/src/lpm.lua index 3f2a6ab..645d5fc 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -932,10 +932,15 @@ function Addon:get_orphaned_dependencies(bottle) local installed_addons = system_bottle:installed_addons() for id, options in pairs(self.dependencies) do local dependency = bottle:get_addon(id, options.version) - if dependency and (dependency.type == "meta" or dependency:is_installed(bottle)) and not dependency:is_explicitly_installed(bottle) and #common.grep(installed_addons, function(addon) return addon ~= self and addon:depends_on(dependency) end) == 0 then - table.insert(t, dependency) - if dependency.type == "meta" then - t = common.concat(t, dependency:get_orphaned_dependencies(bottle)) + if dependency then + if ( dependency.type == "meta" or dependency:is_installed(bottle) ) + and #common.grep(installed_addons, function(addon) return addon ~= self and addon:depends_on(dependency) end) == 0 + and not ( dependency:is_explicitly_installed(bottle) or dependency:is_core(bottle) ) + then + table.insert(t, dependency) + if dependency.type == "meta" then + t = common.concat(t, dependency:get_orphaned_dependencies(bottle)) + end end end end -- cgit v1.2.3