commit: 8b0c936479fe3435747fd06dccffea6d26583998
parent f6198cfeb5195349b859faaf47a8cbcfe18fe9c4
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 7 Jul 2019 15:16:06 -0700
tz: Honor config.fs when writing tzdata.index
Diffstat:
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ninja.lua b/ninja.lua
@@ -406,7 +406,7 @@ local function specmatch(spec, path)
return true
end
-local function fs(name, path)
+function fs(name, path)
for _, spec in ipairs(config.fs) do
for specname in iterstrings(spec) do
if name == specname then
diff --git a/pkg/tz/tzdata.lua b/pkg/tz/tzdata.lua
@@ -1,3 +1,6 @@
+dofile 'ninja.lua'
+config = dofile 'config.lua'
+
local function execute(cmd)
if not os.execute(cmd) then
error('command failed: '..cmd)
@@ -11,12 +14,12 @@ for i = 3, #arg do
execute(string.format('zic -d %s %s', outdir, arg[i]))
for line in io.lines(arg[i]) do
local target, name = line:match('^Link%s+(%g+)%s+(%g+)')
- if target then
+ if target and fs('tz', 'share/zoneinfo/'..name) then
target = name:gsub('[^/]+', '..'):sub(1, -3)..target
execute(hash:format(repo, 120000, name, target))
else
name = line:match('^Zone%s+(%g+)')
- if name then
+ if name and fs('tz', 'share/zoneinfo/'..name) then
execute(hash:format(repo, 100644, name, outdir..'/'..name))
end
end