aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lpm.c2
-rw-r--r--src/lpm.lua3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/lpm.c b/src/lpm.c
index f2e9799..2697f37 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -999,7 +999,7 @@ static const luaL_Reg system_lib[] = {
#endif
#endif
#ifndef LITE_ARCH_TUPLE
- #define LITE_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM
+ #define LITE_ARCH_TUPLE (ARCH_PROCESSOR "-" ARCH_PLATFORM)
#endif
diff --git a/src/lpm.lua b/src/lpm.lua
index e4c47e0..ba81ce0 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -370,6 +370,7 @@ function common.join(j, l) local s = "" for i, v in ipairs(l) do if i > 1 then s
function common.sort(t, f) table.sort(t, f) return t end
function common.write(path, contents) local f, err = io.open(path, "wb") if not f then error("can't write to " .. path .. ": " .. err) end f:write(contents) f:flush() end
function common.read(path) local f, err = io.open(path, "rb") if not f then error("can't read from " .. path .. ": " .. err) end return f:read("*all") end
+function common.uniq(l) local t = {} local k = {} for i,v in ipairs(l) do if not k[v] then table.insert(t, v) k[v] = true end end return t end
function common.split(splitter, str)
local o = 1
local res = {}
@@ -1143,7 +1144,7 @@ function Bottle:get_plugin(id, version, filter)
end
end
end
- return table.unpack(common.sort(candidates, function (a,b) return a.version < b.version end))
+ return table.unpack(common.sort(common.uniq(candidates), function (a,b) return a.version < b.version end))
end