8000 fix(base): ship the IANA timezone database in every box by norrietaylor · Pull Request #804 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/base/build.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let grep = import "../grep/build.ncl" in
let gzip = import "../gzip/build.ncl" in
let sed = import "../sed/build.ncl" in
let tar = import "../tar/build.ncl" in
let tzdata = import "../tzdata/build.ncl" in
let xz = import "../xz/build.ncl" in
{
name = "base",
Expand All @@ -28,6 +29,7 @@ let xz = import "../xz/build.ncl" in
gzip,
sed,
tar,
tzdata,
xz,
],
cmd = "build.sh",
Expand Down
10 changes: 10 additions & 0 deletions packages/python/build.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ let version = "3.14.7" in
],
} | Test,

# base carries tzdata, so zoneinfo resolves IANA zone names without extra packages
smoketest_zoneinfo =
{
class = 'Standalone,
test_deps = [base],
cmds = [
["/bin/python3", "-c", "import zoneinfo; zoneinfo.ZoneInfo('Europe/Paris')"],
],
} | Test,

smoketest_math =
{
class = 'Standalone,
Expand Down
5 changes: 4 additions & 1 deletion packages/tcl/build.sh
8000
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ export CXXFLAGS="${CFLAGS}"

SRCDIR=$(pwd)
cd unix
# --with-tzdata: configure otherwise skips the bundled zone data whenever
# /usr/share/zoneinfo exists (base ships tzdata), leaving the tzdata output empty.
./configure --prefix=/usr \
--mandir=/usr/share/man \
--disable-rpath
--disable-rpath \
--with-tzdata

make -j$(nproc)

Expand Down
47 changes: 47 additions & 0 deletions packages/tzdata/build.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
let { Attrs, BuildSpec, Local, OutputData, Source, Test, .. } = import "minimal.ncl" in
let bash-bootstrap = import "../bash-bootstrap/build.ncl" in
let coreutils = import "../coreutils/build.ncl" in
let glibc = import "../glibc/build.ncl" in

let version = "2026e" in
{
name = "tzdata",
# No `base` here: `base` carries tzdata at runtime, so building tzdata against it would be a cycle.
build_deps = [
{ file = "build.sh" } | Local,
{
url = "https://data.iana.org/time-zones/releases/tzdata%{version}.tar.gz",
sha256 = "b26882805f26aac59d5b222978e6580484b834ccdc98be89df2f05a6dc53a652",
extract = true,
} | Source,
bash-bootstrap,
coreutils,
glibc, # zic
],

cmd = "./build.sh",

outputs = {
zoneinfo = { glob = "usr/share/zoneinfo/**" } | OutputData,
},

attrs =
{
upstream_version = version,
license_spdx = "LicenseRef-Public-Domain",
repology_project = "tzdata",
} | Attrs,

tests = {
tz_resolves =
{
class = 'Standalone,
test_deps = [bash-bootstrap, coreutils],
cmds = [
["/bin/bash", "-c", "test -f /usr/share/zoneinfo/UTC"],
["/bin/bash", "-c", "[[ $(TZ=America/Vancouver date +%Z) == P[SD]T ]]"],
["/bin/bash", "-c", "test \"$(TZ=Europe/Paris date -d @0 +%H)\" = 01"],
],
} | Test,
},
} | BuildSpec
12 changes: 12 additions & 0 deletions packages/tzdata/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

ZONEINFO="$OUTPUT_DIR/usr/share/zoneinfo"
mkdir -p "$ZONEINFO"

# The zone sources upstream's Makefile compiles by default (PRIMARY_YDATA + etcetera + backward).
zic -b slim -d "$ZONEINFO" \
africa antarctica asia australasia europe northamerica southamerica etcetera backward

# The tables that tzselect and Python's zoneinfo read alongside the compiled zones.
cp iso3166.tab zone.tab zone1970.tab "$ZONEINFO/"
Loading
0