From: Jo-Philipp Wich Date: Sun, 2 Jan 2011 17:52:06 +0000 (+0000) Subject: build: zoneinfo2lua.pl: rework script to accommodate split tzdata.lua and tzoffset... X-Git-Tag: 0.10.0~260 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9fd0276848ae1294a2d5984de887ce6c59d674d2;p=oweals%2Fluci.git build: zoneinfo2lua.pl: rework script to accommodate split tzdata.lua and tzoffset.lua libs --- diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl index 2e24c9541..722711a97 100755 --- a/build/zoneinfo2lua.pl +++ b/build/zoneinfo2lua.pl @@ -6,12 +6,12 @@ use strict; my %TZ; -my $tzdir = $ARGV[0] || "/usr/share/zoneinfo"; -chdir($tzdir) || die "chdir($tzdir): $!\n"; +my $tzdin = $ARGV[0] || "/usr/share/zoneinfo"; +my $tzdout = $ARGV[1] || "./libs/sys/luasrc/sys/zoneinfo"; local $/ = "\012"; -open( ZTAB, "< ./zone.tab" ) || die "Unable to open zone.tab: $!"; +open( ZTAB, "< $tzdin/zone.tab" ) || die "open($tzdin/zone.tab): $!"; while( ! eof ZTAB ) { chomp( my $line = readline ZTAB ); @@ -21,7 +21,7 @@ while( ! eof ZTAB ) { printf STDERR "%-40s", $zone; - if( open ZONE, "< ./$zone" ) { + if( open ZONE, "< $tzdin/$zone" ) { seek ZONE, -2, 2; while( tell(ZONE) > 0 ) { @@ -40,14 +40,17 @@ while( ! eof ZTAB ) { } else { - print STDERR "Unable to open $zone: $!\n"; + print STDERR "open($tzdin/$zone): $!\n"; } } close ZTAB; -print < $tzdout/tzdata.lua") || die "open($tzdout/tzdata.lua): $!\n"; + +print STDERR "Writing time zones to $tzdout/tzdata.lua ... "; +print O < $tzdout/tzoffset.lua") || die "open($tzdout/tzoffset.lua): $!\n"; + +print STDERR "Writing time offsets to $tzdout/tzoffset.lua ... "; +print O <