Skip to content

Commit

Permalink
Issue #679 Added MName:downstreamConflictCk()
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Mar 26, 2024
1 parent 8201a97 commit ee2c065
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 19 deletions.
46 changes: 38 additions & 8 deletions src/MName.lua
Expand Up @@ -674,12 +674,11 @@ end

function M.conflictCk(self, mt)
dbg.start{"MName:conflictCk(mt)"}
local userName = self:userName()
local userName = false
local sn = self:sn()
if (not (sn and mt:have(sn,"active"))) then
userName = false
dbg.fini("MName:conflictCk")
return false
return userName
end

if (self.__have_range) then
Expand All @@ -690,24 +689,55 @@ function M.conflictCk(self, mt)
local pV = parseVersion(mt:version(sn))

if (lowerFn(lowerBound, pV) and upperFn(pV, upperBound)) then
local userName = mt:fullName(sn)
userName = mt:fullName(sn)
dbg.fini("MName:conflictCk")
return userName
end
userName = false
dbg.fini("MName:conflictCk")
return userName
end

if (self:userName() == sn or extractVersion(userName, sn) == mt:version(sn)) then
dbg.fini("MName:conflictCk")
return userName
userName = self.userName()
end
userName = false
dbg.fini("MName:conflictCk")
return userName
end

function downstreamConflictCk(self, mnameIn)
local snIn = mnameIn:sn()
dbg.start{"MName:downstreamConflictCk(snIn:", snIn,")"}
local sn = self:sn()
if (snIn ~= sn) then
return false
end
local userName = false
if (self.__have_range) then
local lowerBound = self.__range[1]
local upperBound = self.__range[2]
local lowerFn = self.__range_fnA[1]
local upperFn = self.__range_fnA[2]
local pV = parseVersion(mname:version())
if (lowerFn(lowerBound, pV) and upperFn(pV, upperBound)) then
userName = mnameIn:userName()
dbg.fini("MName:downstreamConflictCk")
return userName
end
userName = false
dbg.fini("MName:conflictCk")
return userName
end

if (self:userName() == snIn or extractVersion(userName, sn) == mnameIn:version()) then
userName = mnameIn:userName()
end

dbg.fini( "MName:downstreamConflictCk")
return userName
end



function M.set_depends_on_flag(self, value)
if (type(value) == "number") then
self.__dependsOn = value > 0
Expand Down
19 changes: 8 additions & 11 deletions src/MT.lua
Expand Up @@ -1509,27 +1509,24 @@ function M.removeConflicts(self, mname)
end

function M.haveDSConflict(self, mnameIn)
local snIn = mnameIn:sn()
if (dbg.active()) then
local snIn = mnameIn:sn()
dbg.start{"MT:haveDSConflict(sn:", snIn,")"}
end

local cT = self.__conflictT
for sn, vv in pairs(cT) do
for i = 1,#vv do
local mname = vv[i]
local sn = mname:sn()
local userName = mname:userName()
if (snIn and mt:have(snIn,"pending")) then
------------------------------------------------------------------------
-- This is a mess. Who is who?
-- What happens if the downstream name is a range?
-- My head hurts
-- ??????
local conflict_mname = vv[i]
local userName = conflict_mname:downstreamConflictCk(mnameIn)
if (userName) then
return userName
end
end
end

dbg.fini("MT:haveDSConflict")
return false
end


Expand Down

0 comments on commit ee2c065

Please sign in to comment.