luke: sync with upstream.
* build-aux/luke: Fix a bug with matching non-literal platform
specifications.
@@ -81,7 +81,7 @@ package.preload['luke._base'] = function()
return {
fatal = function(...)
local msg = (...)
- if select("#", ...) > 1 then
+ if select('#', ...) > 1 then
msg = format(...)
end
stderr:write('luke: fatal: ' .. msg .. '\n')
@@ -1008,16 +1008,31 @@ package.preload['luke.platforms'] = function()
['Darwin'] = {'macosx', 'bsd', 'unix'},
['Linux'] = {'linux', 'unix'},
['SunOS'] = {'solaris', 'unix'},
- ['CYGWIN.*'] = {'cygwin', 'unix'},
- ['Windows.*'] = {'win32', 'windows'},
- ['MINGW.*'] = {'mingw32', 'win32', 'windows'},
- ['procnto.*'] = {'qnx'},
+ ['^CYGWIN'] = {'cygwin', 'unix'},
+ ['^MSYS'] = {'msys', 'cygwin', 'unix'},
+ ['^Windows'] = {'win32', 'windows'},
+ ['^MINGW'] = {'mingw32', 'win32', 'windows'},
+ ['^procnto'] = {'qnx'},
['QNX'] = {'qnx'},
+ ['Haiku'] = {'haiku', 'unix'},
},
}
- local platforms = CANON[popen('uname -s'):read'*l'] or {'unix'}
+ local UNAME = popen('uname -s'):read '*l'
+ local LITERALS, PATTERNS = partition(keys(CANON), function(k)
+ return sub(k, 1, 1) ~= '^'
+ end)
+
+
+ local function match_uname(x)
+ return match(UNAME, x) and CANON[x]
+ end
+
+
+ local platforms = LITERALS[UNAME]
+ or dropuntil(map(PATTERNS, match_uname))
+ or {'unix'}
local allplatforms = reduce(values(CANON), function(acc, platforms)
@@ -1235,12 +1250,20 @@ package.preload['std.functional'] = function()
if block == nil then
predicate, block = isnonnil, predicate
end
+ if block ~= nil then
for valu in each(seq) do
local r = pack(block(unpack(valu)))
if predicate(unpack(r)) then
return unpack(r)
end
end
+ else
+ for r in each(seq) do
+ if predicate(unpack(r)) then
+ return unpack(r)
+ end
+ end
+ end
end,
except = except,
