DateTime-TimeZone
view release on metacpan or search on metacpan
tools/update-from-latest-olson view on Meta::CPAN
$ftp->get($file)
or die "Cannot fetch $file: ", $ftp->message;
system( 'tar', 'xzf', $file );
($olson_version) = $file =~ /(\d\d\d\d\w)/;
die "Did not retrieve anything from elsie"
unless $olson_version;
}
return $olson_version;
}
sub _compile_tzdata {
my $dir = shift;
my $pushed = pushd($dir);
# The CFLAGS bit is necessary because of an issue introduced in 2017c with
# the use of snprintf. This works fine on my machine without the flag but
# blows up on Travis.
system( 'make', 'CFLAGS=-DHAVE_SNPRINTF' )
and die "Cannot run make: $!";
my $target = $dir->subdir('target');
$target->mkpath( 0, 0755 );
my @files = qw(
africa
antarctica
asia
australasia
europe
northamerica
southamerica
etcetera
factory
backward
);
for my $f (@files) {
system( './zic', '-d', $target, $f )
and die "Cannot run zic on $f";
}
# The rdfind and symlinks bits are copied from the Debian tzdata packages
# rules file.
system(
'rdfind',
'-outputname', '/dev/null',
'-makesymlinks', 'true',
'-removeidentinode', 'false',
$target
);
system( qw( symlinks -r -s -c ), $target );
system(qw( sudo rm -fr /usr/share/zoneinfo ));
system( qw( sudo mv ), $target, '/usr/share/zoneinfo' );
system(qw( sudo chown -R root:root /usr/share/zoneinfo ));
}
sub _parse_olson {
my $dir = shift;
my $olson_version = shift;
my $generate_tests = shift;
system(
'./tools/parse_olson',
'--clean',
'--version', $olson_version,
'--dir', $dir,
) and die "Cannot run parse_olson: $!";
if ($generate_tests) {
print "Generating tests from zdump\n";
system('./tools/tests_from_zdump')
and die "Cannot run tests_from_zdump: $!";
}
}
main();
( run in 0.447 second using v1.01-cache-2.11-cpan-71847e10f99 )