diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | src/lpm.c | 2 | ||||
-rw-r--r-- | src/lpm.lua | 3 |
3 files changed, 4 insertions, 3 deletions
@@ -18,7 +18,7 @@ CMAKE_DEFAULT_FLAGS=" $CMAKE_DEFAULT_FLAGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_PR mkdir -p lib/prefix/include lib/prefix/lib if [[ "$@" != *"-lz"* ]]; then [ ! -e "lib/zlib" ] && echo "Make sure you've cloned submodules. (git submodule update --init --depth=1)" && exit -1 - [[ ! -e "lib/zlib/build" && $OSTYPE != 'msys'* ]] && cd lib/zlib && mkdir build && cd build && $CC -O3 -D_LARGEFILE64_SOURCE -I.. ../*.c -c && ar rc libz.a *.o && cp libz.a ../../prefix/lib && cp ../*.h ../../prefix/include && cd ../../../ + [[ ! -e "lib/zlib/build" && $OSTYPE != 'msys'* ]] && cd lib/zlib && mkdir build && cd build && $CC -O3 -D_LARGEFILE64_SOURCE -I.. ../*.c -c && $AR rc libz.a *.o && cp libz.a ../../prefix/lib && cp ../*.h ../../prefix/include && cd ../../../ LDFLAGS="$LDFLAGS -lz" fi if [[ "$@" != *"-lmbedtls"* && "$@" != *"-lmbedcrypto"* ]]; then @@ -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 |