diff options
| author | Michael Forney <mforney@mforney.org> | 2017-10-20 17:12:29 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2017-10-20 17:12:29 -0700 |
| commit | 52a1ac8da18ed4d61f5566631e2c5e1b0b440df8 (patch) | |
| tree | f4dd68ab42346f211dc87c4c52e28c585c34be43 /pkg/tz/tzdata.lua | |
| parent | 9116002f4995b34cc0da60575dc2c1882cc180a8 (diff) | |
tz: Fix some issues in tzdata.lua
When this was converted from an awk script, two regressions were introduced:
- hash.rc failures did not cause a failure in tzdata.lua.
- We stopped actually running the zic command.
Diffstat (limited to 'pkg/tz/tzdata.lua')
| -rw-r--r-- | pkg/tz/tzdata.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/tz/tzdata.lua b/pkg/tz/tzdata.lua index 4de07e82..9777e10c 100644 --- a/pkg/tz/tzdata.lua +++ b/pkg/tz/tzdata.lua @@ -1,17 +1,23 @@ -local cmd = 'rc ./scripts/hash.rc %s %s share/zoneinfo/%s %s' +local function execute(cmd) + if not os.execute(cmd) then + error('command failed: '..cmd) + end +end -repo = arg[1] -outdir = arg[2] +local hash = 'rc ./scripts/hash.rc %s %s share/zoneinfo/%s %s' +local repo = arg[1] +local outdir = arg[2] 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 target = name:gsub('[^/]+', '..'):sub(1, -3)..target - os.execute(cmd:format(repo, 120000, name, target)) + execute(hash:format(repo, 120000, name, target)) else name = line:match('^Zone%s+(%g+)') if name then - os.execute(cmd:format(repo, 100644, name, outdir..'/'..name)) + execute(hash:format(repo, 100644, name, outdir..'/'..name)) end end end |
