diff options
| author | Michael Forney <mforney@mforney.org> | 2016-07-04 21:47:17 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-07-04 21:47:29 -0700 |
| commit | 51e359b2f85ab367e7cab74066fe7f4e5ff1d4ac (patch) | |
| tree | 9b3383f138a822e039c98dc922ed7c1bf06ac3a5 /core/tz/tzdata.awk | |
| parent | 26eb7fe8d8daa97430b7e5256878db47b25d2cd5 (diff) | |
tzdata: Fix gen.rc to not require contents of source files
This also fixes a symlink target calculation bug.
Diffstat (limited to 'core/tz/tzdata.awk')
| -rw-r--r-- | core/tz/tzdata.awk | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/tz/tzdata.awk b/core/tz/tzdata.awk new file mode 100644 index 00000000..8bd70188 --- /dev/null +++ b/core/tz/tzdata.awk @@ -0,0 +1,26 @@ +# usage: awk -f tzdata.awk repo=out/root.git out=out/core/tz/zoneinfo [file...] + +function run(cmd) { + status = system(cmd) + if (status != 0) + exit status +} + +BEGIN { + cmdfmt = "rc ./scripts/hash.rc %s %s share/zoneinfo/%s %s" +} + +FNR == 1 { + run(sprintf("zic -d %s %s", out, FILENAME)) +} + +$1 == "Link" { + s = $3 + gsub(/[^/]+/, "..", s) + s = substr(s, 1, length(s) - 2) $2 + run(sprintf(cmdfmt, repo, 120000, $3, s)) +} + +$1 == "Zone" { + run(sprintf(cmdfmt, repo, 100644, $2, out "/" $2)) +} |
