#!/usr/bin/perl -w
$|++;
$VERSION
=
'3.59'
;
my
$BASE
;
BEGIN {
$BASE
=
'/var/www/reports'
;
}
use
lib
qw|../cgi-bin/lib ../cgi-bin/plugins|
;
my
%options
;
usage()
if
(!GetOptions( \
%options
,
'create|c'
,
'update|u'
,
'fix|f'
,
'rebuild|r'
,
'dist=s'
,
'version=s'
));
if
(
$options
{rebuild}) {
usage()
unless
(
$options
{dist} &&
$options
{version});
}
Labyrinth::Variables::init();
Labyrinth::Globals::LoadSettings(
"$BASE/cgi-bin/config/settings.ini"
);
Labyrinth::Globals::DBConnect();
SetLogFile(
FILE
=>
'/var/www/reports/toolkit/logs/release-audit.log'
,
USER
=>
'labyrinth'
,
LEVEL
=> 0,
CLEAR
=> 1,
CALLER
=> 1);
my
$content
= Labyrinth::Plugin::Content->new();
$content
->GetVersion();
_log(
"Start"
);
my
$builder
= Labyrinth::Plugin::CPAN::Release->new();
$builder
->Create( \
&_log
)
if
(
$options
{create});
$builder
->Update( \
&_log
)
if
(
$options
{update});
$builder
->Fix( \
&_log
)
if
(
$options
{fix});
$builder
->Rebuild(\
&_log
,
$options
{dist},
$options
{version})
if
(
$options
{rebuild});
_log(
"Finish"
);
sub
_log {
my
@date
=
localtime
(
time
);
my
$date
=
sprintf
"%04d/%02d/%02d %02d:%02d:%02d"
,
$date
[5]+1900,
$date
[4]+1,
$date
[3],
$date
[2],
$date
[1],
$date
[0];
print
"$date "
.
join
(
' '
,
@_
).
"\n"
;
}
sub
usage {
print
STDERR
"$0 ( --create | --update | --fix | --rebuild --dist=<dist> --version=<vers>) [--verbose]\n"
;
exit
;
}