fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-11-11 03:47 am

[dw-free] Add check for system time being GMT to checkconfig

[commit: http://hg.dwscoalition.org/dw-free/rev/0bf25921a21f]

http://bugs.dwscoalition.org/show_bug.cgi?id=3785

Check for system time using DateTime::TimeZone.

Patch by [personal profile] rb.

Files modified:
  • bin/checkconfig.pl
--------------------------------------------------------------------------------
diff -r db3e6ad361a8 -r 0bf25921a21f bin/checkconfig.pl
--- a/bin/checkconfig.pl	Tue Nov 08 22:06:08 2011 -0600
+++ b/bin/checkconfig.pl	Fri Nov 11 11:41:42 2011 +0800
@@ -22,6 +22,7 @@
 
 my %dochecks;   # these are the ones we'll actually do
 my @checks = (  # put these in the order they should be checked in
+    "timezone",
     "modules",
     "env",
     "database",
@@ -50,6 +51,7 @@
 if ($debs_only) {
     $dochecks{ljconfig} = 0;
     $dochecks{database} = 0;
+    $dochecks{timezone} = 0;
 }
 
 usage() if $only_check && $no_check;
@@ -221,6 +223,7 @@
                    'opt' => "Required for taking credit/debit cards in the shop.",
                },
                "Hash::MultiValue" => {},
+               "DateTime::TimeZone" => { 'deb' => "libdatetime-timezone-perl", },
                "Sys::Syscall" => { dev => 'libsys-syscall-perl' },
                "Danga::Socket" => { dev => 'libdanga-socket-perl' },
                "IO::AIO" => { dev => 'libio-aoi-perl' },
@@ -369,3 +372,15 @@
     print "NOTE: checkconfig.pl doesn't check everything yet\n";
 }
 
+sub check_timezone {
+    print "[Checking Timezone...]\n";
+    my $rv = eval "use DateTime::TimeZone;";
+    if ($@) {
+        $err->( "Missing required perl module: DateTime::TimeZone" );
+    }
+
+    my $timezone = DateTime::TimeZone->new( name => 'local' );
+
+    $err->( "Timezone must be UTC." ) unless $timezone->is_utc;
+}
+
--------------------------------------------------------------------------------
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2011-11-11 04:14 am (UTC)(link)
I think you pasted the wrong bug here! The proper link, for anybody watching, is http://bugs.dwscoalition.org/show_bug.cgi?id=3785 . :)