File: update-from-latest-olson

package info (click to toggle)
libdatetime-timezone-perl 1%3A0.77.01-1%2B2008c
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 4,208 kB
  • ctags: 2,636
  • sloc: perl: 3,691; sh: 56
file content (63 lines) | stat: -rwxr-xr-x 1,500 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl -w

use strict;
use warnings;

use File::chdir;
use File::Temp ();
use Net::FTP;

my $olson_version;
my $tempdir = File::Temp::tempdir( CLEANUP => 1 );
{
    local $CWD = $tempdir;

    my $ftp = Net::FTP->new( 'elsie.nci.nih.gov', Passive => 1 )
        or die "Cannot connect to elsie.nci.nih.gov: $@";
    $ftp->login()
        or die 'Cannot login: ', $ftp->message;
    $ftp->cwd('/pub')
        or die 'Cannot cwd to /pub: ', $ftp->message;

    for my $f ( $ftp->ls )
    {
        if ( $f =~ /^tz(?:code|data)/ )
        {
            print "Getting $f\n";
            $ftp->get($f);

            system( 'tar', 'xzf', $f );

            ($olson_version) = $f =~ /(\d\d\d\d\w)/;
        }
    }

    die "Did not retrieve anything from elsie"
        unless $olson_version;

    system( 'make' )
        and die "Cannot run make: $!";

    for my $f ( qw( africa antarctica asia australasia
                    europe northamerica pacificnew
                    southamerica backward
                  )
                )
    {
        system( 'sudo', './zic', '-d', '/usr/share/zoneinfo', $f )
            and die "Cannot run zic on $f";
    }
}

{
    system( './tools/parse_olson',
            '--clean',
            '--version', $olson_version,
            '--dir', $tempdir,
          )
        and die "Cannot run parse_olson: $!";

    print "Generating tests from zdump\n";
    system( './tools/tests_from_zdump' )
        and die "Cannot run tests_from_zdump: $!";
}