[Collab-qa-commits] r350 - in svnbuildstat: . inc inc/Module inc/Module/Install lib lib/SvnBuildStat lib/SvnBuildStat/WWW lib/SvnBuildStat/WWW/Controller lib/SvnBuildStat/WWW/Model lib/SvnBuildStat/WWW/View root root/lib root/lib/config root/lib/site root/src root/src/contacts root/src/logs root/src/maintainers root/src/packages root/src/repositorys root/static root/static/images t
goneri-guest at alioth.debian.org
goneri-guest at alioth.debian.org
Mon Jul 23 19:17:58 UTC 2007
Author: goneri-guest
Date: 2007-07-23 19:17:58 +0000 (Mon, 23 Jul 2007)
New Revision: 350
Added:
svnbuildstat/inc/
svnbuildstat/inc/.author/
svnbuildstat/inc/Module/
svnbuildstat/inc/Module/AutoInstall.pm
svnbuildstat/inc/Module/Install.pm
svnbuildstat/inc/Module/Install/
svnbuildstat/inc/Module/Install/AutoInstall.pm
svnbuildstat/inc/Module/Install/Base.pm
svnbuildstat/inc/Module/Install/Include.pm
svnbuildstat/inc/Module/Install/Makefile.pm
svnbuildstat/inc/Module/Install/Metadata.pm
svnbuildstat/inc/Module/Install/Scripts.pm
svnbuildstat/lib/
svnbuildstat/lib/SvnBuildStat/
svnbuildstat/lib/SvnBuildStat/Config.pm
svnbuildstat/lib/SvnBuildStat/Schema.pm
svnbuildstat/lib/SvnBuildStat/WWW.pm
svnbuildstat/lib/SvnBuildStat/WWW/
svnbuildstat/lib/SvnBuildStat/WWW/Controller/
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Contacts.pm
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Logs.pm
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Maintainers.pm
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Packages.pm
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Repositorys.pm
svnbuildstat/lib/SvnBuildStat/WWW/Controller/Root.pm
svnbuildstat/lib/SvnBuildStat/WWW/Model/
svnbuildstat/lib/SvnBuildStat/WWW/Model/DB.pm
svnbuildstat/lib/SvnBuildStat/WWW/View/
svnbuildstat/lib/SvnBuildStat/WWW/View/TT.pm
svnbuildstat/root/
svnbuildstat/root/lib/
svnbuildstat/root/lib/config/
svnbuildstat/root/lib/config/col
svnbuildstat/root/lib/config/main
svnbuildstat/root/lib/config/url
svnbuildstat/root/lib/site/
svnbuildstat/root/lib/site/footer
svnbuildstat/root/lib/site/header
svnbuildstat/root/lib/site/html
svnbuildstat/root/lib/site/layout
svnbuildstat/root/lib/site/wrapper
svnbuildstat/root/src/
svnbuildstat/root/src/contacts/
svnbuildstat/root/src/contacts/main.tt2
svnbuildstat/root/src/logs/
svnbuildstat/root/src/logs/build.tt2
svnbuildstat/root/src/logs/piuparts.tt2
svnbuildstat/root/src/maintainers/
svnbuildstat/root/src/maintainers/main.tt2
svnbuildstat/root/src/packages/
svnbuildstat/root/src/packages/info.tt2
svnbuildstat/root/src/packages/main.tt2
svnbuildstat/root/src/repositorys/
svnbuildstat/root/src/repositorys/main.tt2
svnbuildstat/root/src/ttsite.css
svnbuildstat/root/src/ttsite.css.orig
svnbuildstat/root/static/
svnbuildstat/root/static/images/
svnbuildstat/root/static/images/btn_120x50_built.png
svnbuildstat/root/static/images/btn_120x50_built_shadow.png
svnbuildstat/root/static/images/btn_120x50_powered.png
svnbuildstat/root/static/images/btn_120x50_powered_shadow.png
svnbuildstat/root/static/images/btn_88x31_built.png
svnbuildstat/root/static/images/btn_88x31_built_shadow.png
svnbuildstat/root/static/images/btn_88x31_powered.png
svnbuildstat/root/static/images/btn_88x31_powered_shadow.png
svnbuildstat/root/static/images/catalyst_logo.png
svnbuildstat/root/static/images/debian.png
svnbuildstat/t/
svnbuildstat/t/01app.t
svnbuildstat/t/02pod.t
svnbuildstat/t/03podcoverage.t
svnbuildstat/t/controller_Packages.t
svnbuildstat/t/controller_SvnBuildStat-WWW-Controller-Packages.t
svnbuildstat/t/model_DB.t
svnbuildstat/t/view_TT.t
Log:
really move the project
Added: svnbuildstat/inc/Module/AutoInstall.pm
===================================================================
--- svnbuildstat/inc/Module/AutoInstall.pm (rev 0)
+++ svnbuildstat/inc/Module/AutoInstall.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,768 @@
+#line 1
+package Module::AutoInstall;
+
+use strict;
+use Cwd ();
+use ExtUtils::MakeMaker ();
+
+use vars qw{$VERSION};
+BEGIN {
+ $VERSION = '1.03';
+}
+
+# special map on pre-defined feature sets
+my %FeatureMap = (
+ '' => 'Core Features', # XXX: deprecated
+ '-core' => 'Core Features',
+);
+
+# various lexical flags
+my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
+my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
+my ( $PostambleActions, $PostambleUsed );
+
+# See if it's a testing or non-interactive session
+_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
+_init();
+
+sub _accept_default {
+ $AcceptDefault = shift;
+}
+
+sub missing_modules {
+ return @Missing;
+}
+
+sub do_install {
+ __PACKAGE__->install(
+ [
+ $Config
+ ? ( UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
+ : ()
+ ],
+ @Missing,
+ );
+}
+
+# initialize various flags, and/or perform install
+sub _init {
+ foreach my $arg (
+ @ARGV,
+ split(
+ /[\s\t]+/,
+ $ENV{PERL_AUTOINSTALL} || $ENV{PERL_EXTUTILS_AUTOINSTALL} || ''
+ )
+ )
+ {
+ if ( $arg =~ /^--config=(.*)$/ ) {
+ $Config = [ split( ',', $1 ) ];
+ }
+ elsif ( $arg =~ /^--installdeps=(.*)$/ ) {
+ __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
+ exit 0;
+ }
+ elsif ( $arg =~ /^--default(?:deps)?$/ ) {
+ $AcceptDefault = 1;
+ }
+ elsif ( $arg =~ /^--check(?:deps)?$/ ) {
+ $CheckOnly = 1;
+ }
+ elsif ( $arg =~ /^--skip(?:deps)?$/ ) {
+ $SkipInstall = 1;
+ }
+ elsif ( $arg =~ /^--test(?:only)?$/ ) {
+ $TestOnly = 1;
+ }
+ }
+}
+
+# overrides MakeMaker's prompt() to automatically accept the default choice
+sub _prompt {
+ goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
+
+ my ( $prompt, $default ) = @_;
+ my $y = ( $default =~ /^[Yy]/ );
+
+ print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
+ print "$default\n";
+ return $default;
+}
+
+# the workhorse
+sub import {
+ my $class = shift;
+ my @args = @_ or return;
+ my $core_all;
+
+ print "*** $class version " . $class->VERSION . "\n";
+ print "*** Checking for Perl dependencies...\n";
+
+ my $cwd = Cwd::cwd();
+
+ $Config = [];
+
+ my $maxlen = length(
+ (
+ sort { length($b) <=> length($a) }
+ grep { /^[^\-]/ }
+ map {
+ ref($_)
+ ? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
+ : ''
+ }
+ map { +{@args}->{$_} }
+ grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
+ )[0]
+ );
+
+ while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
+ my ( @required, @tests, @skiptests );
+ my $default = 1;
+ my $conflict = 0;
+
+ if ( $feature =~ m/^-(\w+)$/ ) {
+ my $option = lc($1);
+
+ # check for a newer version of myself
+ _update_to( $modules, @_ ) and return if $option eq 'version';
+
+ # sets CPAN configuration options
+ $Config = $modules if $option eq 'config';
+
+ # promote every features to core status
+ $core_all = ( $modules =~ /^all$/i ) and next
+ if $option eq 'core';
+
+ next unless $option eq 'core';
+ }
+
+ print "[" . ( $FeatureMap{ lc($feature) } || $feature ) . "]\n";
+
+ $modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
+
+ unshift @$modules, -default => &{ shift(@$modules) }
+ if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward combatability
+
+ while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
+ if ( $mod =~ m/^-(\w+)$/ ) {
+ my $option = lc($1);
+
+ $default = $arg if ( $option eq 'default' );
+ $conflict = $arg if ( $option eq 'conflict' );
+ @tests = @{$arg} if ( $option eq 'tests' );
+ @skiptests = @{$arg} if ( $option eq 'skiptests' );
+
+ next;
+ }
+
+ printf( "- %-${maxlen}s ...", $mod );
+
+ if ( $arg and $arg =~ /^\D/ ) {
+ unshift @$modules, $arg;
+ $arg = 0;
+ }
+
+ # XXX: check for conflicts and uninstalls(!) them.
+ if (
+ defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
+ {
+ print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
+ push @Existing, $mod => $arg;
+ $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+ }
+ else {
+ print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
+ push @required, $mod => $arg;
+ }
+ }
+
+ next unless @required;
+
+ my $mandatory = ( $feature eq '-core' or $core_all );
+
+ if (
+ !$SkipInstall
+ and (
+ $CheckOnly
+ or _prompt(
+ qq{==> Auto-install the }
+ . ( @required / 2 )
+ . ( $mandatory ? ' mandatory' : ' optional' )
+ . qq{ module(s) from CPAN?},
+ $default ? 'y' : 'n',
+ ) =~ /^[Yy]/
+ )
+ )
+ {
+ push( @Missing, @required );
+ $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+ }
+
+ elsif ( !$SkipInstall
+ and $default
+ and $mandatory
+ and
+ _prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
+ =~ /^[Nn]/ )
+ {
+ push( @Missing, @required );
+ $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
+ }
+
+ else {
+ $DisabledTests{$_} = 1 for map { glob($_) } @tests;
+ }
+ }
+
+ $UnderCPAN = _check_lock(); # check for $UnderCPAN
+
+ if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
+ require Config;
+ print
+"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
+
+ # make an educated guess of whether we'll need root permission.
+ print " (You may need to do that as the 'root' user.)\n"
+ if eval '$>';
+ }
+ print "*** $class configuration finished.\n";
+
+ chdir $cwd;
+
+ # import to main::
+ no strict 'refs';
+ *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
+}
+
+# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
+# if we are, then we simply let it taking care of our dependencies
+sub _check_lock {
+ return unless @Missing;
+
+ if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
+ print <<'END_MESSAGE';
+
+*** Since we're running under CPANPLUS, I'll just let it take care
+ of the dependency's installation later.
+END_MESSAGE
+ return 1;
+ }
+
+ _load_cpan();
+
+ # Find the CPAN lock-file
+ my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
+ return unless -f $lock;
+
+ # Check the lock
+ local *LOCK;
+ return unless open(LOCK, $lock);
+
+ if (
+ ( $^O eq 'MSWin32' ? _under_cpan() : <LOCK> == getppid() )
+ and ( $CPAN::Config->{prerequisites_policy} || '' ) ne 'ignore'
+ ) {
+ print <<'END_MESSAGE';
+
+*** Since we're running under CPAN, I'll just let it take care
+ of the dependency's installation later.
+END_MESSAGE
+ return 1;
+ }
+
+ close LOCK;
+ return;
+}
+
+sub install {
+ my $class = shift;
+
+ my $i; # used below to strip leading '-' from config keys
+ my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } );
+
+ my ( @modules, @installed );
+ while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
+
+ # grep out those already installed
+ if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ push @installed, $pkg;
+ }
+ else {
+ push @modules, $pkg, $ver;
+ }
+ }
+
+ return @installed unless @modules; # nothing to do
+ return @installed if _check_lock(); # defer to the CPAN shell
+
+ print "*** Installing dependencies...\n";
+
+ return unless _connected_to('cpan.org');
+
+ my %args = @config;
+ my %failed;
+ local *FAILED;
+ if ( $args{do_once} and open( FAILED, '.#autoinstall.failed' ) ) {
+ while (<FAILED>) { chomp; $failed{$_}++ }
+ close FAILED;
+
+ my @newmod;
+ while ( my ( $k, $v ) = splice( @modules, 0, 2 ) ) {
+ push @newmod, ( $k => $v ) unless $failed{$k};
+ }
+ @modules = @newmod;
+ }
+
+ if ( _has_cpanplus() ) {
+ _install_cpanplus( \@modules, \@config );
+ } else {
+ _install_cpan( \@modules, \@config );
+ }
+
+ print "*** $class installation finished.\n";
+
+ # see if we have successfully installed them
+ while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
+ if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ push @installed, $pkg;
+ }
+ elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
+ print FAILED "$pkg\n";
+ }
+ }
+
+ close FAILED if $args{do_once};
+
+ return @installed;
+}
+
+sub _install_cpanplus {
+ my @modules = @{ +shift };
+ my @config = _cpanplus_config( @{ +shift } );
+ my $installed = 0;
+
+ require CPANPLUS::Backend;
+ my $cp = CPANPLUS::Backend->new;
+ my $conf = $cp->configure_object;
+
+ return unless $conf->can('conf') # 0.05x+ with "sudo" support
+ or _can_write($conf->_get_build('base')); # 0.04x
+
+ # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
+ my $makeflags = $conf->get_conf('makeflags') || '';
+ if ( UNIVERSAL::isa( $makeflags, 'HASH' ) ) {
+ # 0.03+ uses a hashref here
+ $makeflags->{UNINST} = 1 unless exists $makeflags->{UNINST};
+
+ } else {
+ # 0.02 and below uses a scalar
+ $makeflags = join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
+ if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
+
+ }
+ $conf->set_conf( makeflags => $makeflags );
+ $conf->set_conf( prereqs => 1 );
+
+
+
+ while ( my ( $key, $val ) = splice( @config, 0, 2 ) ) {
+ $conf->set_conf( $key, $val );
+ }
+
+ my $modtree = $cp->module_tree;
+ while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
+ print "*** Installing $pkg...\n";
+
+ MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
+
+ my $success;
+ my $obj = $modtree->{$pkg};
+
+ if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) {
+ my $pathname = $pkg;
+ $pathname =~ s/::/\\W/;
+
+ foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
+ delete $INC{$inc};
+ }
+
+ my $rv = $cp->install( modules => [ $obj->{module} ] );
+
+ if ( $rv and ( $rv->{ $obj->{module} } or $rv->{ok} ) ) {
+ print "*** $pkg successfully installed.\n";
+ $success = 1;
+ } else {
+ print "*** $pkg installation cancelled.\n";
+ $success = 0;
+ }
+
+ $installed += $success;
+ } else {
+ print << ".";
+*** Could not find a version $ver or above for $pkg; skipping.
+.
+ }
+
+ MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
+ }
+
+ return $installed;
+}
+
+sub _cpanplus_config {
+ my @config = ();
+ while ( @_ ) {
+ my ($key, $value) = (shift(), shift());
+ if ( $key eq 'prerequisites_policy' ) {
+ if ( $value eq 'follow' ) {
+ $value = CPANPLUS::Internals::Constants::PREREQ_INSTALL();
+ } elsif ( $value eq 'ask' ) {
+ $value = CPANPLUS::Internals::Constants::PREREQ_ASK();
+ } elsif ( $value eq 'ignore' ) {
+ $value = CPANPLUS::Internals::Constants::PREREQ_IGNORE();
+ } else {
+ die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
+ }
+ } else {
+ die "*** Cannot convert option $key to CPANPLUS version.\n";
+ }
+ }
+ return @config;
+}
+
+sub _install_cpan {
+ my @modules = @{ +shift };
+ my @config = @{ +shift };
+ my $installed = 0;
+ my %args;
+
+ _load_cpan();
+ require Config;
+
+ if (CPAN->VERSION < 1.80) {
+ # no "sudo" support, probe for writableness
+ return unless _can_write( MM->catfile( $CPAN::Config->{cpan_home}, 'sources' ) )
+ and _can_write( $Config::Config{sitelib} );
+ }
+
+ # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
+ my $makeflags = $CPAN::Config->{make_install_arg} || '';
+ $CPAN::Config->{make_install_arg} =
+ join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
+ if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
+
+ # don't show start-up info
+ $CPAN::Config->{inhibit_startup_message} = 1;
+
+ # set additional options
+ while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
+ ( $args{$opt} = $arg, next )
+ if $opt =~ /^force$/; # pseudo-option
+ $CPAN::Config->{$opt} = $arg;
+ }
+
+ local $CPAN::Config->{prerequisites_policy} = 'follow';
+
+ while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
+ MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
+
+ print "*** Installing $pkg...\n";
+
+ my $obj = CPAN::Shell->expand( Module => $pkg );
+ my $success = 0;
+
+ if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) {
+ my $pathname = $pkg;
+ $pathname =~ s/::/\\W/;
+
+ foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
+ delete $INC{$inc};
+ }
+
+ my $rv = $args{force} ? CPAN::Shell->force( install => $pkg )
+ : CPAN::Shell->install($pkg);
+ $rv ||= eval {
+ $CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
+ ->{install}
+ if $CPAN::META;
+ };
+
+ if ( $rv eq 'YES' ) {
+ print "*** $pkg successfully installed.\n";
+ $success = 1;
+ }
+ else {
+ print "*** $pkg installation failed.\n";
+ $success = 0;
+ }
+
+ $installed += $success;
+ }
+ else {
+ print << ".";
+*** Could not find a version $ver or above for $pkg; skipping.
+.
+ }
+
+ MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
+ }
+
+ return $installed;
+}
+
+sub _has_cpanplus {
+ return (
+ $HasCPANPLUS = (
+ $INC{'CPANPLUS/Config.pm'}
+ or _load('CPANPLUS::Shell::Default')
+ )
+ );
+}
+
+# make guesses on whether we're under the CPAN installation directory
+sub _under_cpan {
+ require Cwd;
+ require File::Spec;
+
+ my $cwd = File::Spec->canonpath( Cwd::cwd() );
+ my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
+
+ return ( index( $cwd, $cpan ) > -1 );
+}
+
+sub _update_to {
+ my $class = __PACKAGE__;
+ my $ver = shift;
+
+ return
+ if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
+
+ if (
+ _prompt( "==> A newer version of $class ($ver) is required. Install?",
+ 'y' ) =~ /^[Nn]/
+ )
+ {
+ die "*** Please install $class $ver manually.\n";
+ }
+
+ print << ".";
+*** Trying to fetch it from CPAN...
+.
+
+ # install ourselves
+ _load($class) and return $class->import(@_)
+ if $class->install( [], $class, $ver );
+
+ print << '.'; exit 1;
+
+*** Cannot bootstrap myself. :-( Installation terminated.
+.
+}
+
+# check if we're connected to some host, using inet_aton
+sub _connected_to {
+ my $site = shift;
+
+ return (
+ ( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
+ qq(
+*** Your host cannot resolve the domain name '$site', which
+ probably means the Internet connections are unavailable.
+==> Should we try to install the required module(s) anyway?), 'n'
+ ) =~ /^[Yy]/
+ );
+}
+
+# check if a directory is writable; may create it on demand
+sub _can_write {
+ my $path = shift;
+ mkdir( $path, 0755 ) unless -e $path;
+
+ return 1 if -w $path;
+
+ print << ".";
+*** You are not allowed to write to the directory '$path';
+ the installation may fail due to insufficient permissions.
+.
+
+ if (
+ eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
+ qq(
+==> Should we try to re-execute the autoinstall process with 'sudo'?),
+ ((-t STDIN) ? 'y' : 'n')
+ ) =~ /^[Yy]/
+ )
+ {
+
+ # try to bootstrap ourselves from sudo
+ print << ".";
+*** Trying to re-execute the autoinstall process with 'sudo'...
+.
+ my $missing = join( ',', @Missing );
+ my $config = join( ',',
+ UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
+ if $Config;
+
+ return
+ unless system( 'sudo', $^X, $0, "--config=$config",
+ "--installdeps=$missing" );
+
+ print << ".";
+*** The 'sudo' command exited with error! Resuming...
+.
+ }
+
+ return _prompt(
+ qq(
+==> Should we try to install the required module(s) anyway?), 'n'
+ ) =~ /^[Yy]/;
+}
+
+# load a module and return the version it reports
+sub _load {
+ my $mod = pop; # class/instance doesn't matter
+ my $file = $mod;
+
+ $file =~ s|::|/|g;
+ $file .= '.pm';
+
+ local $@;
+ return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
+}
+
+# Load CPAN.pm and it's configuration
+sub _load_cpan {
+ return if $CPAN::VERSION;
+ require CPAN;
+ if ( $CPAN::HandleConfig::VERSION ) {
+ # Newer versions of CPAN have a HandleConfig module
+ CPAN::HandleConfig->load;
+ } else {
+ # Older versions had the load method in Config directly
+ CPAN::Config->load;
+ }
+}
+
+# compare two versions, either use Sort::Versions or plain comparison
+sub _version_check {
+ my ( $cur, $min ) = @_;
+ return unless defined $cur;
+
+ $cur =~ s/\s+$//;
+
+ # check for version numbers that are not in decimal format
+ if ( ref($cur) or ref($min) or $cur =~ /v|\..*\./ or $min =~ /v|\..*\./ ) {
+ if ( ( $version::VERSION or defined( _load('version') )) and
+ version->can('new')
+ ) {
+
+ # use version.pm if it is installed.
+ return (
+ ( version->new($cur) >= version->new($min) ) ? $cur : undef );
+ }
+ elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
+ {
+
+ # use Sort::Versions as the sorting algorithm for a.b.c versions
+ return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 )
+ ? $cur
+ : undef );
+ }
+
+ warn "Cannot reliably compare non-decimal formatted versions.\n"
+ . "Please install version.pm or Sort::Versions.\n";
+ }
+
+ # plain comparison
+ local $^W = 0; # shuts off 'not numeric' bugs
+ return ( $cur >= $min ? $cur : undef );
+}
+
+# nothing; this usage is deprecated.
+sub main::PREREQ_PM { return {}; }
+
+sub _make_args {
+ my %args = @_;
+
+ $args{PREREQ_PM} = { %{ $args{PREREQ_PM} || {} }, @Existing, @Missing }
+ if $UnderCPAN or $TestOnly;
+
+ if ( $args{EXE_FILES} and -e 'MANIFEST' ) {
+ require ExtUtils::Manifest;
+ my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
+
+ $args{EXE_FILES} =
+ [ grep { exists $manifest->{$_} } @{ $args{EXE_FILES} } ];
+ }
+
+ $args{test}{TESTS} ||= 't/*.t';
+ $args{test}{TESTS} = join( ' ',
+ grep { !exists( $DisabledTests{$_} ) }
+ map { glob($_) } split( /\s+/, $args{test}{TESTS} ) );
+
+ my $missing = join( ',', @Missing );
+ my $config =
+ join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
+ if $Config;
+
+ $PostambleActions = (
+ $missing
+ ? "\$(PERL) $0 --config=$config --installdeps=$missing"
+ : "\$(NOECHO) \$(NOOP)"
+ );
+
+ return %args;
+}
+
+# a wrapper to ExtUtils::MakeMaker::WriteMakefile
+sub Write {
+ require Carp;
+ Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
+
+ if ($CheckOnly) {
+ print << ".";
+*** Makefile not written in check-only mode.
+.
+ return;
+ }
+
+ my %args = _make_args(@_);
+
+ no strict 'refs';
+
+ $PostambleUsed = 0;
+ local *MY::postamble = \&postamble unless defined &MY::postamble;
+ ExtUtils::MakeMaker::WriteMakefile(%args);
+
+ print << "." unless $PostambleUsed;
+*** WARNING: Makefile written with customized MY::postamble() without
+ including contents from Module::AutoInstall::postamble() --
+ auto installation features disabled. Please contact the author.
+.
+
+ return 1;
+}
+
+sub postamble {
+ $PostambleUsed = 1;
+
+ return << ".";
+
+config :: installdeps
+\t\$(NOECHO) \$(NOOP)
+
+checkdeps ::
+\t\$(PERL) $0 --checkdeps
+
+installdeps ::
+\t$PostambleActions
+
+.
+
+}
+
+1;
+
+__END__
+
+#line 1003
Added: svnbuildstat/inc/Module/Install/AutoInstall.pm
===================================================================
--- svnbuildstat/inc/Module/Install/AutoInstall.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/AutoInstall.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,61 @@
+#line 1
+package Module::Install::AutoInstall;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+ $VERSION = '0.65';
+ $ISCORE = 1;
+ @ISA = qw{Module::Install::Base};
+}
+
+sub AutoInstall { $_[0] }
+
+sub run {
+ my $self = shift;
+ $self->auto_install_now(@_);
+}
+
+sub write {
+ my $self = shift;
+ $self->auto_install(@_);
+}
+
+sub auto_install {
+ my $self = shift;
+ return if $self->{done}++;
+
+ # Flatten array of arrays into a single array
+ my @core = map @$_, map @$_, grep ref,
+ $self->build_requires, $self->requires;
+
+ my @config = @_;
+
+ # We'll need Module::AutoInstall
+ $self->include('Module::AutoInstall');
+ require Module::AutoInstall;
+
+ Module::AutoInstall->import(
+ (@config ? (-config => \@config) : ()),
+ (@core ? (-core => \@core) : ()),
+ $self->features,
+ );
+
+ $self->makemaker_args( Module::AutoInstall::_make_args() );
+
+ my $class = ref($self);
+ $self->postamble(
+ "# --- $class section:\n" .
+ Module::AutoInstall::postamble()
+ );
+}
+
+sub auto_install_now {
+ my $self = shift;
+ $self->auto_install(@_);
+ Module::AutoInstall::do_install();
+}
+
+1;
Added: svnbuildstat/inc/Module/Install/Base.pm
===================================================================
--- svnbuildstat/inc/Module/Install/Base.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/Base.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,70 @@
+#line 1
+package Module::Install::Base;
+
+$VERSION = '0.65';
+
+# Suspend handler for "redefined" warnings
+BEGIN {
+ my $w = $SIG{__WARN__};
+ $SIG{__WARN__} = sub { $w };
+}
+
+### This is the ONLY module that shouldn't have strict on
+# use strict;
+
+#line 41
+
+sub new {
+ my ($class, %args) = @_;
+
+ foreach my $method ( qw(call load) ) {
+ *{"$class\::$method"} = sub {
+ shift()->_top->$method(@_);
+ } unless defined &{"$class\::$method"};
+ }
+
+ bless( \%args, $class );
+}
+
+#line 61
+
+sub AUTOLOAD {
+ my $self = shift;
+ local $@;
+ my $autoload = eval { $self->_top->autoload } or return;
+ goto &$autoload;
+}
+
+#line 76
+
+sub _top { $_[0]->{_top} }
+
+#line 89
+
+sub admin {
+ $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
+}
+
+sub is_admin {
+ $_[0]->admin->VERSION;
+}
+
+sub DESTROY {}
+
+package Module::Install::Base::FakeAdmin;
+
+my $Fake;
+sub new { $Fake ||= bless(\@_, $_[0]) }
+
+sub AUTOLOAD {}
+
+sub DESTROY {}
+
+# Restore warning handler
+BEGIN {
+ $SIG{__WARN__} = $SIG{__WARN__}->();
+}
+
+1;
+
+#line 138
Added: svnbuildstat/inc/Module/Install/Include.pm
===================================================================
--- svnbuildstat/inc/Module/Install/Include.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/Include.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,34 @@
+#line 1
+package Module::Install::Include;
+
+use strict;
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+ $VERSION = '0.65';
+ $ISCORE = 1;
+ @ISA = qw{Module::Install::Base};
+}
+
+sub include {
+ shift()->admin->include(@_);
+}
+
+sub include_deps {
+ shift()->admin->include_deps(@_);
+}
+
+sub auto_include {
+ shift()->admin->auto_include(@_);
+}
+
+sub auto_include_deps {
+ shift()->admin->auto_include_deps(@_);
+}
+
+sub auto_include_dependent_dists {
+ shift()->admin->auto_include_dependent_dists(@_);
+}
+
+1;
Added: svnbuildstat/inc/Module/Install/Makefile.pm
===================================================================
--- svnbuildstat/inc/Module/Install/Makefile.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/Makefile.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,212 @@
+#line 1
+package Module::Install::Makefile;
+
+use strict 'vars';
+use Module::Install::Base;
+use ExtUtils::MakeMaker ();
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+ $VERSION = '0.65';
+ $ISCORE = 1;
+ @ISA = qw{Module::Install::Base};
+}
+
+sub Makefile { $_[0] }
+
+my %seen = ();
+
+sub prompt {
+ shift;
+
+ # Infinite loop protection
+ my @c = caller();
+ if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
+ die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
+ }
+
+ # In automated testing, always use defaults
+ if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
+ local $ENV{PERL_MM_USE_DEFAULT} = 1;
+ goto &ExtUtils::MakeMaker::prompt;
+ } else {
+ goto &ExtUtils::MakeMaker::prompt;
+ }
+}
+
+sub makemaker_args {
+ my $self = shift;
+ my $args = ($self->{makemaker_args} ||= {});
+ %$args = ( %$args, @_ ) if @_;
+ $args;
+}
+
+# For mm args that take multiple space-seperated args,
+# append an argument to the current list.
+sub makemaker_append {
+ my $self = shift;
+ my $name = shift;
+ my $args = $self->makemaker_args;
+ $args->{name} = defined $args->{$name}
+ ? join( ' ', $args->{name}, @_ )
+ : join( ' ', @_ );
+}
+
+sub build_subdirs {
+ my $self = shift;
+ my $subdirs = $self->makemaker_args->{DIR} ||= [];
+ for my $subdir (@_) {
+ push @$subdirs, $subdir;
+ }
+}
+
+sub clean_files {
+ my $self = shift;
+ my $clean = $self->makemaker_args->{clean} ||= {};
+ %$clean = (
+ %$clean,
+ FILES => join(' ', grep length, $clean->{FILES}, @_),
+ );
+}
+
+sub realclean_files {
+ my $self = shift;
+ my $realclean = $self->makemaker_args->{realclean} ||= {};
+ %$realclean = (
+ %$realclean,
+ FILES => join(' ', grep length, $realclean->{FILES}, @_),
+ );
+}
+
+sub libs {
+ my $self = shift;
+ my $libs = ref $_[0] ? shift : [ shift ];
+ $self->makemaker_args( LIBS => $libs );
+}
+
+sub inc {
+ my $self = shift;
+ $self->makemaker_args( INC => shift );
+}
+
+sub write {
+ my $self = shift;
+ die "&Makefile->write() takes no arguments\n" if @_;
+
+ my $args = $self->makemaker_args;
+ $args->{DISTNAME} = $self->name;
+ $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args);
+ $args->{VERSION} = $self->version || $self->determine_VERSION($args);
+ $args->{NAME} =~ s/-/::/g;
+ if ( $self->tests ) {
+ $args->{test} = { TESTS => $self->tests };
+ }
+ if ($] >= 5.005) {
+ $args->{ABSTRACT} = $self->abstract;
+ $args->{AUTHOR} = $self->author;
+ }
+ if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
+ $args->{NO_META} = 1;
+ }
+ if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
+ $args->{SIGN} = 1;
+ }
+ unless ( $self->is_admin ) {
+ delete $args->{SIGN};
+ }
+
+ # merge both kinds of requires into prereq_pm
+ my $prereq = ($args->{PREREQ_PM} ||= {});
+ %$prereq = ( %$prereq, map { @$_ } map { @$_ } grep $_,
+ ($self->build_requires, $self->requires) );
+
+ # merge both kinds of requires into prereq_pm
+ my $subdirs = ($args->{DIR} ||= []);
+ if ($self->bundles) {
+ foreach my $bundle (@{ $self->bundles }) {
+ my ($file, $dir) = @$bundle;
+ push @$subdirs, $dir if -d $dir;
+ delete $prereq->{$file};
+ }
+ }
+
+ if ( my $perl_version = $self->perl_version ) {
+ eval "use $perl_version; 1"
+ or die "ERROR: perl: Version $] is installed, "
+ . "but we need version >= $perl_version";
+ }
+
+ $args->{INSTALLDIRS} = $self->installdirs;
+
+ my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
+
+ my $user_preop = delete $args{dist}->{PREOP};
+ if (my $preop = $self->admin->preop($user_preop)) {
+ $args{dist} = $preop;
+ }
+
+ my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
+ $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
+}
+
+sub fix_up_makefile {
+ my $self = shift;
+ my $makefile_name = shift;
+ my $top_class = ref($self->_top) || '';
+ my $top_version = $self->_top->VERSION || '';
+
+ my $preamble = $self->preamble
+ ? "# Preamble by $top_class $top_version\n"
+ . $self->preamble
+ : '';
+ my $postamble = "# Postamble by $top_class $top_version\n"
+ . ($self->postamble || '');
+
+ local *MAKEFILE;
+ open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ my $makefile = do { local $/; <MAKEFILE> };
+ close MAKEFILE or die $!;
+
+ $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
+ $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
+ $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
+ $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
+ $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
+
+ # Module::Install will never be used to build the Core Perl
+ # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
+ # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
+ $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
+ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
+
+ # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
+ $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g;
+
+ # XXX - This is currently unused; not sure if it breaks other MM-users
+ # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
+
+ open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ print MAKEFILE "$preamble$makefile$postamble" or die $!;
+ close MAKEFILE or die $!;
+
+ 1;
+}
+
+sub preamble {
+ my ($self, $text) = @_;
+ $self->{preamble} = $text . $self->{preamble} if defined $text;
+ $self->{preamble};
+}
+
+sub postamble {
+ my ($self, $text) = @_;
+ $self->{postamble} ||= $self->admin->postamble;
+ $self->{postamble} .= $text if defined $text;
+ $self->{postamble}
+}
+
+1;
+
+__END__
+
+#line 338
Added: svnbuildstat/inc/Module/Install/Metadata.pm
===================================================================
--- svnbuildstat/inc/Module/Install/Metadata.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/Metadata.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,323 @@
+#line 1
+package Module::Install::Metadata;
+
+use strict 'vars';
+use Module::Install::Base;
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+ $VERSION = '0.65';
+ $ISCORE = 1;
+ @ISA = qw{Module::Install::Base};
+}
+
+my @scalar_keys = qw{
+ name module_name abstract author version license
+ distribution_type perl_version tests installdirs
+};
+
+my @tuple_keys = qw{
+ build_requires requires recommends bundles
+};
+
+sub Meta { shift }
+sub Meta_ScalarKeys { @scalar_keys }
+sub Meta_TupleKeys { @tuple_keys }
+
+foreach my $key (@scalar_keys) {
+ *$key = sub {
+ my $self = shift;
+ return $self->{values}{$key} if defined wantarray and !@_;
+ $self->{values}{$key} = shift;
+ return $self;
+ };
+}
+
+foreach my $key (@tuple_keys) {
+ *$key = sub {
+ my $self = shift;
+ return $self->{values}{$key} unless @_;
+
+ my @rv;
+ while (@_) {
+ my $module = shift or last;
+ my $version = shift || 0;
+ if ( $module eq 'perl' ) {
+ $version =~ s{^(\d+)\.(\d+)\.(\d+)}
+ {$1 + $2/1_000 + $3/1_000_000}e;
+ $self->perl_version($version);
+ next;
+ }
+ my $rv = [ $module, $version ];
+ push @rv, $rv;
+ }
+ push @{ $self->{values}{$key} }, @rv;
+ @rv;
+ };
+}
+
+sub install_as_core { $_[0]->installdirs('perl') }
+sub install_as_cpan { $_[0]->installdirs('site') }
+sub install_as_site { $_[0]->installdirs('site') }
+sub install_as_vendor { $_[0]->installdirs('vendor') }
+
+sub sign {
+ my $self = shift;
+ return $self->{'values'}{'sign'} if defined wantarray and !@_;
+ $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 );
+ return $self;
+}
+
+sub dynamic_config {
+ my $self = shift;
+ unless ( @_ ) {
+ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n";
+ return $self;
+ }
+ $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0;
+ return $self;
+}
+
+sub all_from {
+ my ( $self, $file ) = @_;
+
+ unless ( defined($file) ) {
+ my $name = $self->name
+ or die "all_from called with no args without setting name() first";
+ $file = join('/', 'lib', split(/-/, $name)) . '.pm';
+ $file =~ s{.*/}{} unless -e $file;
+ die "all_from: cannot find $file from $name" unless -e $file;
+ }
+
+ $self->version_from($file) unless $self->version;
+ $self->perl_version_from($file) unless $self->perl_version;
+
+ # The remaining probes read from POD sections; if the file
+ # has an accompanying .pod, use that instead
+ my $pod = $file;
+ if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) {
+ $file = $pod;
+ }
+
+ $self->author_from($file) unless $self->author;
+ $self->license_from($file) unless $self->license;
+ $self->abstract_from($file) unless $self->abstract;
+}
+
+sub provides {
+ my $self = shift;
+ my $provides = ( $self->{values}{provides} ||= {} );
+ %$provides = (%$provides, @_) if @_;
+ return $provides;
+}
+
+sub auto_provides {
+ my $self = shift;
+ return $self unless $self->is_admin;
+
+ unless (-e 'MANIFEST') {
+ warn "Cannot deduce auto_provides without a MANIFEST, skipping\n";
+ return $self;
+ }
+
+ # Avoid spurious warnings as we are not checking manifest here.
+
+ local $SIG{__WARN__} = sub {1};
+ require ExtUtils::Manifest;
+ local *ExtUtils::Manifest::manicheck = sub { return };
+
+ require Module::Build;
+ my $build = Module::Build->new(
+ dist_name => $self->name,
+ dist_version => $self->version,
+ license => $self->license,
+ );
+ $self->provides(%{ $build->find_dist_packages || {} });
+}
+
+sub feature {
+ my $self = shift;
+ my $name = shift;
+ my $features = ( $self->{values}{features} ||= [] );
+
+ my $mods;
+
+ if ( @_ == 1 and ref( $_[0] ) ) {
+ # The user used ->feature like ->features by passing in the second
+ # argument as a reference. Accomodate for that.
+ $mods = $_[0];
+ } else {
+ $mods = \@_;
+ }
+
+ my $count = 0;
+ push @$features, (
+ $name => [
+ map {
+ ref($_) ? ( ref($_) eq 'HASH' ) ? %$_
+ : @$_
+ : $_
+ } @$mods
+ ]
+ );
+
+ return @$features;
+}
+
+sub features {
+ my $self = shift;
+ while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
+ $self->feature( $name, @$mods );
+ }
+ return $self->{values}->{features}
+ ? @{ $self->{values}->{features} }
+ : ();
+}
+
+sub no_index {
+ my $self = shift;
+ my $type = shift;
+ push @{ $self->{values}{no_index}{$type} }, @_ if $type;
+ return $self->{values}{no_index};
+}
+
+sub read {
+ my $self = shift;
+ $self->include_deps( 'YAML', 0 );
+
+ require YAML;
+ my $data = YAML::LoadFile('META.yml');
+
+ # Call methods explicitly in case user has already set some values.
+ while ( my ( $key, $value ) = each %$data ) {
+ next unless $self->can($key);
+ if ( ref $value eq 'HASH' ) {
+ while ( my ( $module, $version ) = each %$value ) {
+ $self->can($key)->($self, $module => $version );
+ }
+ }
+ else {
+ $self->can($key)->($self, $value);
+ }
+ }
+ return $self;
+}
+
+sub write {
+ my $self = shift;
+ return $self unless $self->is_admin;
+ $self->admin->write_meta;
+ return $self;
+}
+
+sub version_from {
+ my ( $self, $file ) = @_;
+ require ExtUtils::MM_Unix;
+ $self->version( ExtUtils::MM_Unix->parse_version($file) );
+}
+
+sub abstract_from {
+ my ( $self, $file ) = @_;
+ require ExtUtils::MM_Unix;
+ $self->abstract(
+ bless(
+ { DISTNAME => $self->name },
+ 'ExtUtils::MM_Unix'
+ )->parse_abstract($file)
+ );
+}
+
+sub _slurp {
+ my ( $self, $file ) = @_;
+
+ local *FH;
+ open FH, "< $file" or die "Cannot open $file.pod: $!";
+ do { local $/; <FH> };
+}
+
+sub perl_version_from {
+ my ( $self, $file ) = @_;
+
+ if (
+ $self->_slurp($file) =~ m/
+ ^
+ use \s*
+ v?
+ ([\d_\.]+)
+ \s* ;
+ /ixms
+ )
+ {
+ my $v = $1;
+ $v =~ s{_}{}g;
+ $self->perl_version($1);
+ }
+ else {
+ warn "Cannot determine perl version info from $file\n";
+ return;
+ }
+}
+
+sub author_from {
+ my ( $self, $file ) = @_;
+ my $content = $self->_slurp($file);
+ if ($content =~ m/
+ =head \d \s+ (?:authors?)\b \s*
+ ([^\n]*)
+ |
+ =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
+ .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
+ ([^\n]*)
+ /ixms) {
+ my $author = $1 || $2;
+ $author =~ s{E<lt>}{<}g;
+ $author =~ s{E<gt>}{>}g;
+ $self->author($author);
+ }
+ else {
+ warn "Cannot determine author info from $file\n";
+ }
+}
+
+sub license_from {
+ my ( $self, $file ) = @_;
+
+ if (
+ $self->_slurp($file) =~ m/
+ (
+ =head \d \s+
+ (?:licen[cs]e|licensing|copyright|legal)\b
+ .*?
+ )
+ (=head\\d.*|=cut.*|)
+ \z
+ /ixms
+ )
+ {
+ my $license_text = $1;
+ my @phrases = (
+ 'under the same (?:terms|license) as perl itself' => 'perl',
+ 'GNU public license' => 'gpl',
+ 'GNU lesser public license' => 'gpl',
+ 'BSD license' => 'bsd',
+ 'Artistic license' => 'artistic',
+ 'GPL' => 'gpl',
+ 'LGPL' => 'lgpl',
+ 'BSD' => 'bsd',
+ 'Artistic' => 'artistic',
+ 'MIT' => 'MIT',
+ );
+ while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
+ $pattern =~ s{\s+}{\\s+}g;
+ if ( $license_text =~ /\b$pattern\b/i ) {
+ $self->license($license);
+ return 1;
+ }
+ }
+ }
+
+ warn "Cannot determine license info from $file\n";
+ return 'unknown';
+}
+
+1;
Added: svnbuildstat/inc/Module/Install/Scripts.pm
===================================================================
--- svnbuildstat/inc/Module/Install/Scripts.pm (rev 0)
+++ svnbuildstat/inc/Module/Install/Scripts.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,50 @@
+#line 1
+package Module::Install::Scripts;
+
+use strict;
+use Module::Install::Base;
+use File::Basename ();
+
+use vars qw{$VERSION $ISCORE @ISA};
+BEGIN {
+ $VERSION = '0.65';
+ $ISCORE = 1;
+ @ISA = qw{Module::Install::Base};
+}
+
+sub prompt_script {
+ my ($self, $script_file) = @_;
+
+ my ($prompt, $abstract, $default);
+ foreach my $line ( $self->_read_script($script_file) ) {
+ last unless $line =~ /^#/;
+ $prompt = $1 if $line =~ /^#\s*prompt:\s+(.*)/;
+ $default = $1 if $line =~ /^#\s*default:\s+(.*)/;
+ $abstract = $1 if $line =~ /^#\s*abstract:\s+(.*)/;
+ }
+ unless (defined $prompt) {
+ my $script_name = File::Basename::basename($script_file);
+ $prompt = "Do you want to install '$script_name'";
+ $prompt .= " ($abstract)" if defined $abstract;
+ $prompt .= '?';
+ }
+ return unless $self->prompt($prompt, ($default || 'n')) =~ /^[Yy]/;
+ $self->install_script($script_file);
+}
+
+sub install_script {
+ my $self = shift;
+ my $args = $self->makemaker_args;
+ my $exe_files = $args->{EXE_FILES} ||= [];
+ push @$exe_files, @_;
+}
+
+sub _read_script {
+ my ($self, $script_file) = @_;
+ local *SCRIPT;
+ open SCRIPT, $script_file
+ or die "Can't open '$script_file' for input: $!\n";
+ return <SCRIPT>;
+}
+
+1;
Added: svnbuildstat/inc/Module/Install.pm
===================================================================
--- svnbuildstat/inc/Module/Install.pm (rev 0)
+++ svnbuildstat/inc/Module/Install.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,281 @@
+#line 1
+package Module::Install;
+
+# For any maintainers:
+# The load order for Module::Install is a bit magic.
+# It goes something like this...
+#
+# IF ( host has Module::Install installed, creating author mode ) {
+# 1. Makefile.PL calls "use inc::Module::Install"
+# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
+# 3. The installed version of inc::Module::Install loads
+# 4. inc::Module::Install calls "require Module::Install"
+# 5. The ./inc/ version of Module::Install loads
+# } ELSE {
+# 1. Makefile.PL calls "use inc::Module::Install"
+# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
+# 3. The ./inc/ version of Module::Install loads
+# }
+
+use 5.004;
+use strict 'vars';
+
+use vars qw{$VERSION};
+BEGIN {
+ # All Module::Install core packages now require synchronised versions.
+ # This will be used to ensure we don't accidentally load old or
+ # different versions of modules.
+ # This is not enforced yet, but will be some time in the next few
+ # releases once we can make sure it won't clash with custom
+ # Module::Install extensions.
+ $VERSION = '0.65';
+}
+
+# Whether or not inc::Module::Install is actually loaded, the
+# $INC{inc/Module/Install.pm} is what will still get set as long as
+# the caller loaded module this in the documented manner.
+# If not set, the caller may NOT have loaded the bundled version, and thus
+# they may not have a MI version that works with the Makefile.PL. This would
+# result in false errors or unexpected behaviour. And we don't want that.
+my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
+unless ( $INC{$file} ) {
+ die <<"END_DIE";
+Please invoke ${\__PACKAGE__} with:
+
+ use inc::${\__PACKAGE__};
+
+not:
+
+ use ${\__PACKAGE__};
+
+END_DIE
+}
+
+# If the script that is loading Module::Install is from the future,
+# then make will detect this and cause it to re-run over and over
+# again. This is bad. Rather than taking action to touch it (which
+# is unreliable on some platforms and requires write permissions)
+# for now we should catch this and refuse to run.
+if ( -f $0 and (stat($0))[9] > time ) {
+ die << "END_DIE";
+Your installer $0 has a modification time in the future.
+
+This is known to create infinite loops in make.
+
+Please correct this, then run $0 again.
+
+END_DIE
+}
+
+use Cwd ();
+use File::Find ();
+use File::Path ();
+use FindBin;
+
+*inc::Module::Install::VERSION = *VERSION;
+ at inc::Module::Install::ISA = __PACKAGE__;
+
+sub autoload {
+ my $self = shift;
+ my $who = $self->_caller;
+ my $cwd = Cwd::cwd();
+ my $sym = "${who}::AUTOLOAD";
+ $sym->{$cwd} = sub {
+ my $pwd = Cwd::cwd();
+ if ( my $code = $sym->{$pwd} ) {
+ # delegate back to parent dirs
+ goto &$code unless $cwd eq $pwd;
+ }
+ $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
+ unshift @_, ($self, $1);
+ goto &{$self->can('call')} unless uc($1) eq $1;
+ };
+}
+
+sub import {
+ my $class = shift;
+ my $self = $class->new(@_);
+ my $who = $self->_caller;
+
+ unless ( -f $self->{file} ) {
+ require "$self->{path}/$self->{dispatch}.pm";
+ File::Path::mkpath("$self->{prefix}/$self->{author}");
+ $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self );
+ $self->{admin}->init;
+ @_ = ($class, _self => $self);
+ goto &{"$self->{name}::import"};
+ }
+
+ *{"${who}::AUTOLOAD"} = $self->autoload;
+ $self->preload;
+
+ # Unregister loader and worker packages so subdirs can use them again
+ delete $INC{"$self->{file}"};
+ delete $INC{"$self->{path}.pm"};
+}
+
+sub preload {
+ my ($self) = @_;
+
+ unless ( $self->{extensions} ) {
+ $self->load_extensions(
+ "$self->{prefix}/$self->{path}", $self
+ );
+ }
+
+ my @exts = @{$self->{extensions}};
+ unless ( @exts ) {
+ my $admin = $self->{admin};
+ @exts = $admin->load_all_extensions;
+ }
+
+ my %seen;
+ foreach my $obj ( @exts ) {
+ while (my ($method, $glob) = each %{ref($obj) . '::'}) {
+ next unless $obj->can($method);
+ next if $method =~ /^_/;
+ next if $method eq uc($method);
+ $seen{$method}++;
+ }
+ }
+
+ my $who = $self->_caller;
+ foreach my $name ( sort keys %seen ) {
+ *{"${who}::$name"} = sub {
+ ${"${who}::AUTOLOAD"} = "${who}::$name";
+ goto &{"${who}::AUTOLOAD"};
+ };
+ }
+}
+
+sub new {
+ my ($class, %args) = @_;
+
+ # ignore the prefix on extension modules built from top level.
+ my $base_path = Cwd::abs_path($FindBin::Bin);
+ unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
+ delete $args{prefix};
+ }
+
+ return $args{_self} if $args{_self};
+
+ $args{dispatch} ||= 'Admin';
+ $args{prefix} ||= 'inc';
+ $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author');
+ $args{bundle} ||= 'inc/BUNDLES';
+ $args{base} ||= $base_path;
+ $class =~ s/^\Q$args{prefix}\E:://;
+ $args{name} ||= $class;
+ $args{version} ||= $class->VERSION;
+ unless ( $args{path} ) {
+ $args{path} = $args{name};
+ $args{path} =~ s!::!/!g;
+ }
+ $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
+
+ bless( \%args, $class );
+}
+
+sub call {
+ my ($self, $method) = @_;
+ my $obj = $self->load($method) or return;
+ splice(@_, 0, 2, $obj);
+ goto &{$obj->can($method)};
+}
+
+sub load {
+ my ($self, $method) = @_;
+
+ $self->load_extensions(
+ "$self->{prefix}/$self->{path}", $self
+ ) unless $self->{extensions};
+
+ foreach my $obj (@{$self->{extensions}}) {
+ return $obj if $obj->can($method);
+ }
+
+ my $admin = $self->{admin} or die <<"END_DIE";
+The '$method' method does not exist in the '$self->{prefix}' path!
+Please remove the '$self->{prefix}' directory and run $0 again to load it.
+END_DIE
+
+ my $obj = $admin->load($method, 1);
+ push @{$self->{extensions}}, $obj;
+
+ $obj;
+}
+
+sub load_extensions {
+ my ($self, $path, $top) = @_;
+
+ unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
+ unshift @INC, $self->{prefix};
+ }
+
+ foreach my $rv ( $self->find_extensions($path) ) {
+ my ($file, $pkg) = @{$rv};
+ next if $self->{pathnames}{$pkg};
+
+ local $@;
+ my $new = eval { require $file; $pkg->can('new') };
+ unless ( $new ) {
+ warn $@ if $@;
+ next;
+ }
+ $self->{pathnames}{$pkg} = delete $INC{$file};
+ push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
+ }
+
+ $self->{extensions} ||= [];
+}
+
+sub find_extensions {
+ my ($self, $path) = @_;
+
+ my @found;
+ File::Find::find( sub {
+ my $file = $File::Find::name;
+ return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
+ my $subpath = $1;
+ return if lc($subpath) eq lc($self->{dispatch});
+
+ $file = "$self->{path}/$subpath.pm";
+ my $pkg = "$self->{name}::$subpath";
+ $pkg =~ s!/!::!g;
+
+ # If we have a mixed-case package name, assume case has been preserved
+ # correctly. Otherwise, root through the file to locate the case-preserved
+ # version of the package name.
+ if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
+ open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!";
+ my $in_pod = 0;
+ while ( <PKGFILE> ) {
+ $in_pod = 1 if /^=\w/;
+ $in_pod = 0 if /^=cut/;
+ next if ($in_pod || /^=cut/); # skip pod text
+ next if /^\s*#/; # and comments
+ if ( m/^\s*package\s+($pkg)\s*;/i ) {
+ $pkg = $1;
+ last;
+ }
+ }
+ close PKGFILE;
+ }
+
+ push @found, [ $file, $pkg ];
+ }, $path ) if -d $path;
+
+ @found;
+}
+
+sub _caller {
+ my $depth = 0;
+ my $call = caller($depth);
+ while ( $call eq __PACKAGE__ ) {
+ $depth++;
+ $call = caller($depth);
+ }
+ return $call;
+}
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/Config.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/Config.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/Config.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,39 @@
+package SvnBuildStat::Config;
+
+use AppConfig qw(:expand :argcount);
+
+sub new {
+
+ my $file = "/usr/local/etc/svnbuildstat.conf";
+ $file = "/etc/svnbuildstat.conf" unless -f $file;
+ die "Can't open config file" unless $file;
+
+ my $self;
+
+ $self = AppConfig->new({
+ GLOBAL => {
+ DEFAULT => "<unset>",
+ ARGCOUNT => ARGCOUNT_ONE,
+ },});
+
+ # report injector
+ $self->define( "report_sourcedir" => { ARGCOUNT => ARGCOUNT_ONE, });
+ $self->define( "report_workdir" => { ARGCOUNT => ARGCOUNT_ONE, });
+ $self->define( "report_rejecteddir" => { ARGCOUNT => ARGCOUNT_ONE, });
+ # DB
+ $self->define( "db_dsn" => { ARGCOUNT => ARGCOUNT_ONE, });
+ $self->define( "db_user" => { ARGCOUNT => ARGCOUNT_ONE, });
+ $self->define( "db_password" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ # Agent
+ $self->define( "agent_ftphost" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_ftplogin" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_ftppassword" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_source" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_buildadminaddr" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_vardir" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+ $self->define( "agent_debmirror" => {ARGCOUNT => ARGCOUNT_ONE, DEFAULT => "" });
+
+ $self->file($file) or die "Can't load `$file'";
+ return $self;
+}
+1;
Added: svnbuildstat/lib/SvnBuildStat/Schema.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/Schema.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/Schema.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,35 @@
+package SvnBuildStat::Schema;
+
+use strict;
+use base qw/DBIx::Class::Schema::Loader/;
+
+__PACKAGE__->loader_options(
+ relationships => 1,
+ # debug => 1,
+);
+
+=head1 NAME
+
+SvnBuildStat::Schema - DBIx::Class::Schema::Loader class
+
+=head1 SYNOPSIS
+
+See L<SvnBuildStat::WWW>
+
+=head1 DESCRIPTION
+
+Generated by L<Catalyst::Model::DBIC::Schema> for use in L<SvnBuildStat::WWW::Model::DB>
+
+=head1 AUTHOR
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
+
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Contacts.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Contacts.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Contacts.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,29 @@
+package SvnBuildStat::WWW::Controller::Contacts;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Packages - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub main : Local {
+ my ( $self, $c ) = @_;
+
+}
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Logs.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Logs.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Logs.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,116 @@
+package SvnBuildStat::WWW::Controller::Logs;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Packages - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+
+ $c->response->redirect($c->uri_for('/'));
+}
+
+sub build : Local {
+ my ( $self, $c, $build_id ) = @_;
+
+
+ if (!($build_id && $build_id =~ /\d+/)) {
+ $c->response->redirect($c->uri_for('/'));
+ return;
+ }
+
+ my $build = $c->model('SvnBuildStat::WWW::Model::DB::Build')->search({id => $build_id})->first;
+ if (!$build) {
+ $c->response->redirect($c->uri_for('/'));
+ return;
+ }
+
+ my $htmllog;
+ my @errindex;
+
+ my $line;
+ foreach (split $/, $build->build_log) {
+ $line++;
+ my $orig = $_;
+ if (s/(error|warning|failed)/<strong id="$line">$1<\/strong>/gi) {
+ push @{$c->stash->{'erridx'}}, {
+ linenum => $line,
+ content => $orig
+ }
+ }
+ push @{$c->stash->{'lines'}}, $_;
+ }
+
+ $c->stash->{'log'} = {
+ 'package' => $build->package_id->name,
+ 'arch' => $build->arch_id->name,
+ 'buildisok' => $build->buildisok,
+ 'log' => $htmllog
+ };
+
+ $c->stash->{template} = 'logs/build.tt2';
+
+}
+
+sub piuparts : Local {
+ my ( $self, $c, $build_id ) = @_;
+
+
+ if (!($build_id && $build_id =~ /\d+/)) {
+ $c->response->redirect($c->uri_for('/'));
+ return;
+ }
+
+ my $build = $c->model('SvnBuildStat::WWW::Model::DB::Build')->search({id => $build_id})->first;
+ if (!$build) {
+ $c->response->redirect($c->uri_for('/'));
+ return;
+ }
+
+ my $htmllog;
+ my @errindex;
+
+ my $line;
+ foreach (split $/, $build->piuparts_log) {
+ $line++;
+ my $orig = $_;
+ if (s/(error|warning|failed)/<strong id="$line">$1<\/strong>/gi) {
+ push @{$c->stash->{'erridx'}}, {
+ linenum => $line,
+ content => $orig
+ }
+ }
+ push @{$c->stash->{'lines'}}, $_;
+ }
+
+ $c->stash->{'log'} = {
+ 'package' => $build->package_id->name,
+ 'arch' => $build->arch_id->name,
+ 'buildisok' => $build->buildisok,
+ 'log' => $htmllog,
+ piuparts_release => $build->piuparts_release
+ };
+
+ $c->stash->{template} = 'logs/piuparts.tt2';
+
+}
+
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Maintainers.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Maintainers.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Maintainers.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,60 @@
+package SvnBuildStat::WWW::Controller::Maintainers;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Packages - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+
+ $c->response->redirect($c->uri_for('list'));
+}
+
+sub list : Local {
+ my ( $self, $c, $repository ) = @_;
+
+
+ my $repository_rs;
+ my $maintainer;
+
+ $c->stash->{maintainers} = [ $c->model('SvnBuildStat::WWW::Model::DB::Maintainer')->search(undef,{order_by=>"name"}) ];
+
+ $c->stash->{template} = 'maintainers/main.tt2';
+
+}
+
+sub info : Local {
+ my ($self, $c, $name) = @_;
+
+ # Retrieve all of the book records as book model objects and store in the
+ # stash where they can be accessed by the TT template
+ my $package = $c->model('SvnBuildStat::WWW::Model::DB::Package')->search({name => $name})->first;
+
+
+
+ # Set the TT template to use. You will almost always want to do this
+ # in your action methods (actions methods respond to user input in
+ # your controllers).
+ $c->stash->{template} = 'packages/info.tt2';
+
+}
+
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Packages.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Packages.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Packages.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,230 @@
+package SvnBuildStat::WWW::Controller::Packages;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Packages - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub mkTarballFromPackage {
+ my $package = shift;
+
+ my $majorrelease = $$package->svndebrelease;
+ $majorrelease =~ s/-[0-9A-Za-z\.~]*$//;
+ # remove the EPOCH if exists
+ $majorrelease =~ s/^\d+://;
+
+ $$package->name.'_'.$majorrelease.".orig.tar.gz";
+}
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+
+ $c->response->redirect($c->uri_for('/'));
+}
+
+sub list : Local {
+ my ( $self, $c, $param ) = @_;
+
+ my $data;
+
+
+ my $package_rs;
+ my $maintainer;
+
+ if (!$param) {
+ $c->response->redirect($c->uri_for('/repositorys/list'));
+ return;
+ }
+
+ ##
+ # people view
+ if ($param =~ /\@/) {
+ $maintainer = $c->model('SvnBuildStat::WWW::Model::DB::Maintainer')->search({email => $param})->first;
+ $c->stash->{maintainer} = $maintainer;
+
+ my $packagemaintainer_rs = $c->model('SvnBuildStat::WWW::Model::DB::PackageMaintainer')->search({maintainer_id => $maintainer->id});
+
+ my @package_id;
+ while (my $packagemaintainer = $packagemaintainer_rs->next) {
+ push @package_id, $packagemaintainer->package_id->id;
+ }
+ $c->stash->{packages} = [ $c->model('SvnBuildStat::WWW::Model::DB::Viewpackage')->search({ package_id => { '-in' => \@package_id } },{order_by=>"name"}) ];
+ ##
+ # team view
+ } elsif ($param =~ /^\d+$/) {
+ $c->stash->{maintainer} = $c->model('SvnBuildStat::WWW::Model::DB::Repository')->search({id => $param})->first;
+ $c->stash->{packages} = [ $c->model('SvnBuildStat::WWW::Model::DB::Viewpackage')->search({ repository_id => $param },{order_by=>"name"}) ];
+ } else { # I don't want to kill my server with to much request
+ $c->response->redirect($c->uri_for('/repositorys/list'));
+ return;
+ }
+
+ $c->stash->{template} = 'packages/main.tt2';
+
+}
+
+sub info : Local {
+ my ($self, $c, $name) = @_;
+
+ # Retrieve all of the book records as book model objects and store in the
+ # stash where they can be accessed by the TT template
+ my $package = $c->model('SvnBuildStat::WWW::Model::DB::Package')->search({name => $name})->first;
+ if (!$package) {
+ $c->response->redirect($c->uri_for('/'));
+ return;
+ }
+ $c->stash->{package} = $package->name;
+ $c->stash->{bugpic} = $package->name;
+ $c->stash->{bugpic} =~ s!^(.)(.+)$!http://people.debian.org/~glandium/bts/$1/$1$2.png! ;
+ $c->stash->{istarballpresent} = $package->istarballpresent;
+ $c->stash->{isindebian} = $package->isindebian;
+ $c->stash->{tarballuri} = $package->tarballuri;
+ $c->stash->{svndebrelease} = $package->svndebrelease;
+ $c->stash->{iswatchfilebroken} = $package->iswatchfilebroken;
+ $c->stash->{uri} = $package->uri;
+ $c->stash->{weburi} = $package->uri;
+ $c->stash->{weburi} =~ s!svn://svn.debian.org/svn!http://svn.debian.org/wsvn!;
+ $c->stash->{isuptodate} = $package->isuptodate;
+ $c->stash->{upstreamrelease} = $package->upstreamrelease;
+ ############ Maintainers list
+ my $packagemaintainer_rs = $c->model('SvnBuildStat::WWW::Model::DB::PackageMaintainer')->search({package_id => $package->id});
+ $c->stash->{maintainers} = [ $packagemaintainer_rs->search_related("maintainer_id")->all ];
+
+ #############
+ my $bug_rs = $c->model('SvnBuildStat::WWW::Model::DB::Bug')->search(package_id => $package->id);
+ while (my $bug = $bug_rs->next) {
+ my $bugerror;
+ my $bugwarning;
+ $bugerror = 1 if ($bug->severity_id->name =~ /important|serious|grave|critical/);
+ $bugwarning = 1 if ($bug->severity_id->name =~ /normal/);
+ push @{$c->stash->{bugs}}, {
+ id => $bug->id,
+ name => $bug->name,
+ severity => $bug->severity_id->name,
+ error => $bugerror,
+ warning => $bugwarning }
+ }
+
+##########
+my $build = $c->model('SvnBuildStat::WWW::Model::DB::Build')->search({package_id => $package->id, isbuildinprogress => 'false'},{order_by => "id DESC"})->first;
+if ($build) {
+foreach (split $/, $build->lintian_log) {
+my $error;
+$error = 1 if /^E/;
+push @{$c->stash->{lintians}}, { text => $_, error => $error };
+}
+
+foreach (split $/, $build->linda_log) {
+my $error;
+$error = 1 if /^E/;
+push @{$c->stash->{lindas}}, { text => $_, error => $error } ;
+}
+
+$c->stash->{piupartsisok} = $build->piupartsisok;
+}
+##############
+
+my $build_rs = $c->model('SvnBuildStat::WWW::Model::DB::Build')->search({package_id => $package->id, isbuildinprogress => 'false'},{order_by => "id DESC"});
+my $cpt;
+while (($cpt++ < 10) && (my $build = $build_rs->next)) {
+my $failedstep;
+if (!$build->buildisok) {
+ if (!$build->checkoutisok) {
+ $failedstep = "check out";
+ } elsif (!$build->downloadisok) {
+ $failedstep = "download";
+ } else {
+ $failedstep = "build";
+ }
+}
+
+ push @{$c->stash->{builds}}, {
+ id => $build->id,
+ buildisok => $build->buildisok,
+ rev => $build->rev,
+ duration => $build->duration,
+ arch => $build->arch_id->name,
+ failedstep => $failedstep,
+ time => $build->time,
+ }
+}
+
+
+
+# Set the TT template to use. You will almost always want to do this
+# in your action methods (actions methods respond to user input in
+# your controllers).
+$c->stash->{template} = 'packages/info.tt2';
+
+}
+
+sub tobuild : Local {
+ my ($self, $c, $arch) = @_;
+ my $archs = "(i386|m68k|sparc|alpha|powerpc|".
+ "arm|mips|mipsel|hppa|ia64|s390|amd64|".
+ "ppc64|sh|armeb|m32r|hurd-i386|kfreebsd-gnu)";
+
+
+ if (!(defined ($arch) && $arch && $arch =~ /$archs/)) {
+ $c->response->body("missing or invalid arch"); # Seems to create an error
+ return;
+ }
+
+ my $archobj = $c->model('SvnBuildStat::WWW::Model::DB::Arch')->find_or_create ({name => $arch});
+
+ #my $package_rs = $c->model('SvnBuildStat::WWW::Model::DB::Viewpackage')->search({istarballpresent => 'true', },{order_by=> "builded, lastbuilddate"});
+ my $package_id = $c->model('SvnBuildStat::WWW::Model::DB::Viewtobuild')->first;
+ my $package = $c->model('SvnBuildStat::WWW::Model::DB::Package')->search ({id => $package_id->package_id})->first;
+
+
+ my $resp = '';
+ my $tarball;
+ my $tarballuri;
+ # TODO next unless arch is supported
+
+ my $name = $package->name;
+ my $uri = $package->uri;
+
+ if ($package->isnative ne 't') {
+ $tarballuri = $package->tarballuri;
+
+ $tarballuri =~ s/\@PACKAGE@/$package->name/;
+ $tarballuri =~ s/\@TARBALL@/$package->svndebrelease/;
+
+ $tarball = mkTarballFromPackage(\$package);
+ }
+
+ $package->lastbuildstart('now');
+ $package->update();
+ $resp = "$name;$tarballuri;$tarball;$uri";
+
+ $c->response->body($resp);
+}
+=head1 AUTHOR
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Repositorys.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Repositorys.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Repositorys.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,44 @@
+package SvnBuildStat::WWW::Controller::Repositorys;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Packages - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+
+ $c->response->redirect($c->uri_for('list'));
+}
+
+sub list : Local {
+ my ( $self, $c, $repository ) = @_;
+
+
+ my $repository_rs;
+ my $maintainer;
+
+ $c->stash->{repositorys} = [ $c->model('SvnBuildStat::WWW::Model::DB::Repository')->search(undef,{order_by=>"name"}) ];
+
+ $c->stash->{template} = 'repositorys/main.tt2';
+
+}
+
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Controller/Root.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Controller/Root.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Controller/Root.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,60 @@
+package SvnBuildStat::WWW::Controller::Root;
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config->{namespace} = '';
+
+=head1 NAME
+
+SvnBuildStat::WWW::Controller::Root - Root Controller for SvnBuildStat::WWW
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=cut
+
+=head2 default
+
+=cut
+
+sub default : Private {
+ my ( $self, $c, $email ) = @_;
+
+ if ($email) {
+ $email = "/$email";
+ } else {
+ $email = '';
+ }
+
+ $c->response->redirect($c->uri_for('/packages/list'));
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+=head1 AUTHOR
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/Model/DB.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/Model/DB.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/Model/DB.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,46 @@
+package SvnBuildStat::WWW::Model::DB;
+
+use strict;
+use base 'Catalyst::Model::DBIC::Schema';
+
+
+use lib "/home/goneri/svn/pkg-games/people/goneri/svnbuildstat";
+use SvnBuildStat::Config;
+
+
+my $config = new SvnBuildStat::Config;
+print $config->db_dsn."\n";
+print $config->db_user."\n";
+print $config->db_password."\n";
+__PACKAGE__->config(
+ schema_class => 'SvnBuildStat::Schema',
+ connect_info => [
+ $config->db_dsn,
+ $config->db_user,
+ $config->db_password,
+ {AutoCommit => 1, debug => 1}
+ ]
+);
+=head1 NAME
+
+SvnBuildStat::WWW::Model::DB - Catalyst DBIC Schema Model
+=head1 SYNOPSIS
+
+See L<SvnBuildStat::WWW>
+
+=head1 DESCRIPTION
+
+L<Catalyst::Model::DBIC::Schema> Model using schema L<SvnBuildStat::Schema>
+
+=head1 AUTHOR
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW/View/TT.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW/View/TT.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW/View/TT.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,41 @@
+package SvnBuildStat::WWW::View::TT;
+
+use strict;
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(
+ CATALYST_VAR => 'Catalyst',
+ TEMPLATE_EXTENSION => '.tt2',
+ PRE_PROCESS => 'config/main',
+ WRAPPER => 'site/wrapper',
+ ERROR => 'error.tt2',
+ INCLUDE_PATH => [
+ SvnBuildStat::WWW->path_to( 'root', 'src' ),
+ SvnBuildStat::WWW->path_to( 'root', 'lib' )
+ ],
+);
+
+=head1 NAME
+
+SvnBuildStat::WWW::View::TT - TT View for SvnBuildStat::WWW
+
+=head1 DESCRIPTION
+
+TT View for SvnBuildStat::WWW.
+
+=head1 AUTHOR
+
+=head1 SEE ALSO
+
+L<SvnBuildStat::WWW>
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: svnbuildstat/lib/SvnBuildStat/WWW.pm
===================================================================
--- svnbuildstat/lib/SvnBuildStat/WWW.pm (rev 0)
+++ svnbuildstat/lib/SvnBuildStat/WWW.pm 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,63 @@
+package SvnBuildStat::WWW;
+
+use strict;
+use warnings;
+
+use Catalyst::Runtime '5.70';
+
+# Set flags and add plugins for the application
+#
+# -Debug: activates the debug mode for very useful log messages
+# ConfigLoader: will load the configuration from a YAML file in the
+# application's home directory
+# Static::Simple: will serve static files from the application's root
+# directory
+
+#use Catalyst qw/-Debug ConfigLoader Static::Simple/;
+use Catalyst qw/ConfigLoader Static::Simple/;
+
+our $VERSION = '0.01';
+
+# Configure the application.
+#
+# Note that settings in SvnBuildStat::WWW.yml (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with a external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config( name => 'SvnBuildStat::WWW' );
+
+# Start the application
+__PACKAGE__->setup;
+
+
+=head1 NAME
+
+SvnBuildStat::WWW - Catalyst based application
+
+=head1 SYNOPSIS
+
+ script/svnbuildstat_www_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<SvnBuildStat::WWW::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Goneri Le Bouder,,,
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
Added: svnbuildstat/root/lib/config/col
===================================================================
--- svnbuildstat/root/lib/config/col (rev 0)
+++ svnbuildstat/root/lib/config/col 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,21 @@
+[% site.rgb = {
+ black = '#000000'
+ white = '#ffffff'
+ grey1 = '#46494c'
+ grey2 = '#c6c9cc'
+ grey3 = '#e3e6ea'
+ red = '#CC4444'
+ green = '#66AA66'
+ blue = '#89b8df'
+ orange = '#f08900'
+ };
+
+ site.col = {
+ page = site.rgb.white
+ text = site.rgb.grey1
+ head = site.rgb.grey3
+ line = site.rgb.orange
+ message = site.rgb.green
+ error = site.rgb.red
+ };
+%]
Added: svnbuildstat/root/lib/config/main
===================================================================
--- svnbuildstat/root/lib/config/main (rev 0)
+++ svnbuildstat/root/lib/config/main 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,26 @@
+[% # config/main
+ #
+ # This is the main configuration template which is processed before
+ # any other page, by virtue of it being defined as a PRE_PROCESS
+ # template. This is the place to define any extra template variables,
+ # macros, load plugins, and perform any other template setup.
+
+ IF Catalyst.debug;
+ # define a debug() macro directed to Catalyst's log
+ MACRO debug(message) CALL Catalyst.log.debug(message);
+ END;
+
+ # define a data structure to hold sitewide data
+ site = {
+ title => 'SvnBuildStat',
+ };
+
+ # load up any other configuration items
+ PROCESS config/col
+ + config/url;
+
+ # set defaults for variables, etc.
+ DEFAULT
+ message = 'There is no message';
+
+-%]
Added: svnbuildstat/root/lib/config/url
===================================================================
--- svnbuildstat/root/lib/config/url (rev 0)
+++ svnbuildstat/root/lib/config/url 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,8 @@
+[% base = Catalyst.req.base;
+
+ site.url = {
+ base = base
+ home = "${base}welcome"
+ message = "${base}message"
+ }
+-%]
Added: svnbuildstat/root/lib/site/footer
===================================================================
--- svnbuildstat/root/lib/site/footer (rev 0)
+++ svnbuildstat/root/lib/site/footer 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,2 @@
+<!-- BEGIN site/footer -->
+<!-- END site/footer -->
Added: svnbuildstat/root/lib/site/header
===================================================================
--- svnbuildstat/root/lib/site/header (rev 0)
+++ svnbuildstat/root/lib/site/header 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,10 @@
+<!-- BEGIN site/header -->
+<div id="debianlogo">
+<img src="/static/images/debian.png" alt="Debian logo" />
+</div>
+<div id="headertitle">svnbuildstat.debian.net</div>
+<div id="headersubtitle">
+Team packages overview
+</div>
+
+<!-- END site/header -->
Added: svnbuildstat/root/lib/site/html
===================================================================
--- svnbuildstat/root/lib/site/html (rev 0)
+++ svnbuildstat/root/lib/site/html 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <title>[% template.title or site.title %]</title>
+ <style type="text/css">
+[% PROCESS ttsite.css %]
+ </style>
+ </head>
+ <body>
+
+[% content %]
+ </body>
+</html>
Added: svnbuildstat/root/lib/site/layout
===================================================================
--- svnbuildstat/root/lib/site/layout (rev 0)
+++ svnbuildstat/root/lib/site/layout 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,26 @@
+<!-- BEGIN site/layout -->
+<div id="header">
+[% PROCESS site/header %]
+</div>
+
+
+<div id="floatmenu">
+<div class="menuitem">Welcome</div>
+<div class="menusubitem">
+<a href="/repositorys/list">Teams</a></div>
+<div class="menusubitem"><a href="/maintainers/list">Maintainers</a></div>
+<div class="menusubitem"><a href="/contacts/main">Contacts</a></div>
+
+
+</div>
+
+<div id="maincontent">
+
+
+<div id="maincontent">
+[% content %]
+</div>
+</div>
+
+<div id="footer">[% PROCESS site/footer %]</div>
+<!-- END site/layout -->
Added: svnbuildstat/root/lib/site/wrapper
===================================================================
--- svnbuildstat/root/lib/site/wrapper (rev 0)
+++ svnbuildstat/root/lib/site/wrapper 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,8 @@
+[% IF template.name.match('\.(css|js|txt)');
+ debug("Passing page through as text: $template.name");
+ content;
+ ELSE;
+ debug("Applying HTML page layout wrappers to $template.name\n");
+ content WRAPPER site/html + site/layout;
+ END;
+-%]
Added: svnbuildstat/root/src/contacts/main.tt2
===================================================================
--- svnbuildstat/root/src/contacts/main.tt2 (rev 0)
+++ svnbuildstat/root/src/contacts/main.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,11 @@
+[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
+[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
+[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
+
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Contacts' -%]
+
+<h1>Contact</h1>
+
+For comment, bug report, or if you want to add your team in SvnBuildStat feel free to contact me : <a href="ahref:goneri at rulezlan.org">Gonéri Le Bouder</a>.
Added: svnbuildstat/root/src/logs/build.tt2
===================================================================
--- svnbuildstat/root/src/logs/build.tt2 (rev 0)
+++ svnbuildstat/root/src/logs/build.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,33 @@
+[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
+[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
+[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
+
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Build log' -%]
+
+<h1>[% log.package %] build log ([% log.arch %])</h1>
+
+[% IF log.buildisok %]
+Build succeed
+[% ELSE %]
+Build failed
+[% END %]
+
+[% IF erridx %]
+<h2>autodetected possible error in log</h2>
+ <ul>
+ [% FOREACH err IN erridx -%]
+ <li><a href="#[% err.linenum %]">[% err.content %]</a></li>
+ [% END %]
+ </ul>
+[% END %]
+
+
+
+<h2>log</h2>
+<blockquote>
+ [% FOREACH line IN lines -%]
+ [% line %]<br />
+ [% END %]
+</blockquote>
Added: svnbuildstat/root/src/logs/piuparts.tt2
===================================================================
--- svnbuildstat/root/src/logs/piuparts.tt2 (rev 0)
+++ svnbuildstat/root/src/logs/piuparts.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,28 @@
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Piuparts log' -%]
+
+<h1>[% log.package %] piuparts log ([% log.arch %])</h1>
+
+[% IF log.piupartsissok %]
+Piuparts ([% log.piuparts_release %]) checks succeed
+[% ELSE %]
+Piuparts ([% log.piuparts_release %]) checks failed
+[% END %]
+
+[% IF erridx %]
+<h2>autodetected possible error in log</h2>
+ <ul>
+ [% FOREACH err IN erridx -%]
+ <li><a href="#[% err.linenum %]">[% err.content %]</a></li>
+ [% END %]
+ </ul>
+[% END %]
+
+
+
+<h2>log</h2>
+<blockquote>
+ [% FOREACH line IN lines -%]
+ [% line %]<br />
+ [% END %]
+</blockquote>
Added: svnbuildstat/root/src/maintainers/main.tt2
===================================================================
--- svnbuildstat/root/src/maintainers/main.tt2 (rev 0)
+++ svnbuildstat/root/src/maintainers/main.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,19 @@
+[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
+[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
+[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
+
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Maintainer list' -%]
+
+<h1>Maintainers list</h1>
+
+<table>
+[% # Display each book in a table row %]
+[% FOREACH maintainer IN maintainers -%]
+ <tr>
+ <td><a href="[% Catalyst.uri_for('/packages/list/') _ maintainer.email %]"><strong>[% maintainer.name %]</strong></a></td>
+ <td><a href="http://qa.debian.org/developer.php?login=[% maintainer.email %]">QA</a></td>
+ </tr>
+[% END -%]
+</table>
Added: svnbuildstat/root/src/packages/info.tt2
===================================================================
--- svnbuildstat/root/src/packages/info.tt2 (rev 0)
+++ svnbuildstat/root/src/packages/info.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,136 @@
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Package overview' -%]
+
+<h1>[% package %]_[% svndebrelease %]</h1>
+
+<h2>Maintainers</h2>
+<table>
+ [% FOREACH maintainer IN maintainers -%]
+ <tr>
+ <td>
+ <strong>[% maintainer.name %]</strong> <a href="http://qa.debian.org/developer.php?login=[% maintainer.email %]">QA</a> <a href="[% Catalyst.uri_for('/packages/list/') _ maintainer.email %]">Packages</a>
+ </td>
+ </tr>
+ [% END -%]
+</table>
+
+<h2>URI</h2>
+<table>
+<tr>
+ <td>Repository location: <a href="[% uri %]">SVN</a> <a href="[% weburi %]">HTTP</a></td>
+</tr>
+<tr>
+<td [% IF iswatchfilebroken || !istarballpresent %]class="error"[% END %]>
+ [% IF iswatchfilebroken %]
+ Broken watchfile
+ [% ELSE %]
+ [% IF istarballpresent %]
+ <a href="[% tarballuri %]">Tarball</a>
+ [% ELSE %]
+ Can't find the tarball
+ [% END %]
+ [% END %]
+ </td>
+</tr>
+[% IF !iswatchfilebroken && isuptodate == 0 %]
+<tr><td class="error">A new upstream ([% upstreamrelease %]) release exists.</a></td>
+</tr>
+[% END %]
+</table>
+
+[% IF isindebian %]
+ <div>This release is in Debian</div>
+[% ELSE %]
+ <div>This release is not in Debian</div>
+[% END %]
+
+[% IF bugs %]
+<h2>Bugs</h2>
+<img src="[% bugpic %]" alt="bug graph"/>
+<table>
+ [% # Display each book in a table row %]
+ [% FOREACH bug IN bugs -%]
+ <tr [% IF bug.error %] class="error"[% ELSE %][% IF bug.warning %] class="warning"[% END %][% END %]>
+ <td>
+ <a href="http://bugs.debian.org/[% bug.id %]">[% bug.id %]: [% bug.name %]</a>
+ </td>
+ <td>
+ [% bug.severity %]
+ </td>
+ </tr>
+ [% END -%]
+</table>
+[% END -%]
+
+[% IF builds %]
+<h2>Builds</h2>
+<table>
+ <tr><th>Status</th><th>Arch</th><th>Svn Rev.</th><th>Date</th><th>Build duration</th></tr>
+ [% # Display each book in a table row %]
+ [% FOREACH build IN builds -%]
+ <tr [% IF ! build.buildisok %]class="error"[% ELSE %]class="ok"[% END %]>
+ <td>
+ [% IF build.buildisok %]
+ <a href="[% Catalyst.uri_for('/logs/build/') _ build.id %]">Success</a>
+ [% ELSE %]
+ [% IF build.failedstep == "build" %]
+ <a href="[% Catalyst.uri_for('/logs/build/') _ build.id %]">Build failed</a>
+ [% ELSE %]
+ failed during the "[% build.failedstep %]"
+
+ [% END %]
+ [% END %]
+
+ </td>
+ <td>
+ [% build.arch %]
+ </td>
+ <td>
+ [% build.rev %]
+ </td>
+ <td>
+ [% build.time %]
+ </td>
+ <td>
+ [% IF build.duration %][% build.duration %]s[% END %]
+ </td>
+ </tr>
+ [% END -%]
+</table>
+
+<h2>piuparts</h2>
+[% IF piupartsisok %]
+<a href="[% Catalyst.uri_for('/logs/piuparts/') _ build.id %]">piuparts checks successed</a>
+[% ELSE %]
+<a href="[% Catalyst.uri_for('/logs/piuparts/') _ build.id %]">piuparts checks failed (maybe a false negative?)</a>
+[% END %]
+
+[% IF lintians %]
+<h2>lintian</h2>
+<table>
+ [% FOREACH lintian IN lintians %]
+ <tr>
+ <td [% IF lintian.error %]class="error"[% ELSE %]class="warning"[% END %]>
+ [% lintian.text %]
+ </td>
+ </tr>
+ [% END -%]
+</table>
+[% END %]
+
+[% IF lindas %]
+<h2>linda</h2>
+<table>
+ [% FOREACH linda IN lindas %]
+ <tr>
+ <td [% IF linda.error %]class="error"[% ELSE %]class="warning"[% END %]>
+ [% linda.text %]
+ </td>
+ </tr>
+ [% END -%]
+</table>
+[% END %]
+
+[% ELSE %]
+Never built yet.
+[% END -%]
Added: svnbuildstat/root/src/packages/main.tt2
===================================================================
--- svnbuildstat/root/src/packages/main.tt2 (rev 0)
+++ svnbuildstat/root/src/packages/main.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,80 @@
+[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
+[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
+[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
+
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Package list' -%]
+
+<h1>
+[% IF maintainer.name %]
+[% maintainer.name %]
+[% END %] packages overview
+</h1>
+
+<table>
+<tr><th>Packages</th><th>Status</th><th>Linda</th><th>Lintian</th><th>Bugs</th><!--<th>Piuparts--></th><th>Synced<br />with<br />Debian</th><th>Synced<br />with<br />Upstream</th></tr>
+[% # Display each book in a table row %]
+[% FOREACH package IN packages -%]
+ <tr>
+ <td>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]"><strong>[% package.name %]</strong></a>
+ </td>
+ <td [% IF ! package.isnative && !package.istarballpresent %]class="error"[% ELSE %][% IF package.builded %][% IF package.buildisok == 0 %]class="error"[% END %][% IF package.buildisok == 1 %]class="ok"[% END %][% END %][% END %]>
+
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF ! package.istarballpresent && ! package.isnative %]
+ No tarball
+ [% ELSE %]
+ [% IF ! package.builded %]
+ Need build
+ [% ELSE %]
+ [% IF package.buildisok == 1 %]ok[% END %]
+ [% IF package.buildisok == 0 %]failed[% END %]
+ [% END %]
+ [% END %]
+ </a>
+ </td>
+ <td [% IF package.lintianerrcount > 0 %]class="error"[% ELSE %][% IF package.lintiancount > 0 %]class="warning"[% ELSE %][% IF package.buildisok %]class="ok"[% END %][% END %][% END %]>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF package.lintiancount > 0 %][% package.lintiancount %][% END %]
+ </a>
+ </td>
+ <td [% IF package.lindaerrcount > 0 %]class="error"[% ELSE %][% IF package.lindacount > 0 %]class="warning"[% ELSE %][% IF package.buildisok %]class="ok"[% END %][% END %][% END %]>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF package.lindacount > 0 %][% package.lindacount %][% END %]
+ </a>
+ </td>
+
+
+ <td [% IF package.bugcount == 0 %]class="ok"[% ELSE %][% IF package.bugmaxseverity > 3 %]class="error"[% ELSE %]class="warning"[% END %][% END %]>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF package.bugcount > 0 %][% package.bugcount %][% END %]
+ </a>
+ </td>
+<!-- <td [% IF package.piupartsisok %]class="ok"[% ELSE %][% IF package.buildisok %]class="error"[% END %][% END %]>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF ! package.needbuild && package.buildisok %][% IF package.piupartsisok %]Succeed[% ELSE %]Failed[% END %][% END %]
+ </a>
+ </td>-->
+ <td [% IF package.isindebian %]class="ok"[% ELSE %]class="warning"[% END %]>
+ [% IF ! package.isindebian %]No[% END %]
+ </td>
+ <td [% IF package.iswatchfilebroken || package.isuptodate == 0 %]class="error"[% ELSE %][% IF package.isuptodate == 1 || package.isnative == 1 %]class="ok"[% ELSE %]class="warning"[% END %][% END %]>
+ <a href="[% Catalyst.uri_for('info/') _ package.name %]">
+ [% IF package.isnative == 1 %]
+ Native
+ [% ELSE %]
+ [% IF package.iswatchfilebroken == 1 %]
+ Broken watch file
+ [% ELSE%]
+ [% IF package.isuptodate == 0 %]No[% END %]
+ [% IF package.isuptodate == 1 %]Yes[% END %]
+ [% IF package.isuptodate == "" %]No watch file[% END %]
+ [% END %]
+ [% END %]
+ </a>
+ </td>
+ </tr>
+[% END -%]
+</table>
Added: svnbuildstat/root/src/repositorys/main.tt2
===================================================================
--- svnbuildstat/root/src/repositorys/main.tt2 (rev 0)
+++ svnbuildstat/root/src/repositorys/main.tt2 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,17 @@
+[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
+[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
+[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
+[%- # optional, but both the beginning and the ending TT tags support chomping. -%]
+
+[% # Provide a title to root/lib/site/header -%]
+[% META title = 'Repository list' -%]
+
+<table>
+[% FOREACH repository IN repositorys -%]
+[% IF repository.enabled %]
+<tr>
+<td><a href="[% Catalyst.uri_for('/packages/list/') _ repository.id %]"><strong>[% repository.name %]</strong></a></td>
+</tr>
+[% END -%]
+[% END -%]
+</table>
Added: svnbuildstat/root/src/ttsite.css
===================================================================
--- svnbuildstat/root/src/ttsite.css (rev 0)
+++ svnbuildstat/root/src/ttsite.css 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,281 @@
+/* Stylesheet for mentors.debian.net */
+/* (c) 2005,2006 the mentors.debian.net team */
+/* You are free to use this style sheet on your own web pages
+ under the terms of the GNU General Public License 2 */
+
+body
+{
+ font-family: sans-serif;
+ font-size: 10pt;
+ background-color: #ffffff;
+ margin: 0;
+ padding: 0;
+}
+
+img
+{
+ border: 0;
+}
+
+h1,h2
+{
+ font-family: "Bitstream Vera Serif", Georgia, Palatino, serif;
+ font-weight: normal;
+ color: #d70751;
+ margin: 0.5em 0 0.2em 0;
+ padding: 0 0 0 0;
+}
+
+h1
+{
+ font-size: 170%;
+ color: #000000;
+}
+
+h2
+{
+ font-size: 140%;
+ color: #808080;
+}
+
+
+#floatmenu
+{
+ float: left;
+ margin: 0.5ex;
+ padding: 0.5ex;
+ width: 20ex;
+}
+
+/* Menu item */
+.menuitem
+{
+ padding: 0.1em 0.2em 0.1em 0.2em;
+ background-color: #f0f0f0;
+ border: 1px solid #d0d0d0;
+ border-left: 3px solid #d70751;
+ margin: 0.5em 0 0 0;
+ text-transform: uppercase;
+}
+
+.menuitem-active
+{
+ padding: 0.1em 0.2em 0.1em 0.2em;
+ background-color: #f0f0f0;
+ border: 1px solid #d0d0d0;
+ border-left: 3px solid #d70751;
+ margin: 0.5em 0 0 0;
+ text-transform: uppercase;
+ font-weight: bolder;
+}
+
+.menusubitem
+{
+ margin: 0 0 0 1em;
+ font-size: 9pt;
+ line-height: 2em;
+}
+
+.menusubitem-active
+{
+ margin: 0 0 0 1em;
+ font-size: 9pt;
+ line-height: 2em;
+ font-weight: bolder;
+}
+
+/*
+.menuitem a
+{
+ text-decoration: none;
+}
+*/
+
+/* The currently running CGI is highlighted */
+.currentcgi
+{
+ border: 1px solid red;
+}
+
+#maincontent
+{
+ margin: 0.5ex 0.5ex 0.5ex 5ex;
+ padding: 0 0 0 1ex;
+ _border-left: 1px dotted red;
+}
+
+#header
+{
+ background-color: #f0f0f0;
+ color: #707070;
+ padding: 0.5ex;
+ min-height: 75px; /* the top area is at least as large as the debian logo */
+ /* does not work with the IE but you won't see me write hacks to
+ * support buggy browsers */
+ border-bottom: 1px solid #b0b0b0;
+}
+
+#debianlogo
+{
+ float: left;
+ position: absolute;
+ top: 5px;
+ left: 5px;
+}
+#headertitle
+{
+ font-family: "Bitstream Vera Serif", Georgia, Palatino, serif;
+ font-size: 300%;
+ margin: 0;
+ margin-left: 70px; /* indentation from the debian logo on the lft */
+ padding: 0;
+ font-weight: 100;
+}
+
+#headersubtitle
+{
+ padding: 0;
+ margin: 0;
+ margin-left: 70px; /* indentation from the debian logo on the lft */
+ font-size: 110%;
+ font-weight: 500;
+}
+
+#footer
+{
+ background-color: #f0f0f0;
+ color: #707070;
+ padding: 0.2em 1em 0.2em 1em;
+ margin: 2em 0 0 0;
+ text-align: center;
+ clear: both;
+ border-top: 1px solid #b0b0b0;
+}
+
+#navigation
+{
+ padding: 0.2em 1em 0.2em 1em;
+ background: #e0e0e0;
+}
+
+#navigation > .right
+{
+ position: absolute;
+ right: 1em;
+}
+
+p,form
+{
+ color: #606060;
+ margin: 0.3ex 0em 1ex 0;
+ padding: 0 0 0 0;
+}
+
+pre
+{
+ color: #606060;
+ background-color: #f0f0f0;
+}
+
+a
+{
+ color: #606060;
+ text-decoration: underline;
+}
+
+a:hover
+{
+ _border-bottom: 1px solid #000000;
+ background-color: #f0f0f0;
+}
+
+ul
+{
+ color: #606060;
+}
+
+/*
+ul
+{
+ _background: #e0ffe0;
+ _margin: 0 0 0 0 0em;
+ padding: 0 0 0 1em;
+}
+
+li
+{
+ _background: #ffe0e0;
+ _list-style: none;
+ padding: 0;
+ margin: 0;
+}
+*/
+
+table
+{
+ border-collapse: collapse;
+ margin: 0.5em 0 0.5em 0;
+}
+
+tr:hover {
+background-color: #d0d0d0;
+ padding-bottom: 3em;
+ }
+
+td
+{
+ vertical-align: top;
+ color: #606060;
+ padding: 0.1em 1em 0.1em 0.1em;
+ margin: 0;
+}
+/* Table rows with light lines seperating the rows */
+td.lines
+{
+ border-top: 1px solid #e8e8e8;
+ border-bottom: 1px solid #e8e8e8;
+}
+
+th
+{
+ color: #606060;
+ font-weight: bolder;
+ text-align: left;
+ vertical-align: top;
+ padding-right: 1em;
+}
+
+/*
+fieldset
+{
+ _border: 1px solid #808080;
+}
+
+legend
+{
+ padding: 0.2em 0.5em;
+ border: 1px solid #808080;
+ color: #808080;
+ _font-size: 90%;
+ _text-align: right;
+}
+*/
+
+.error
+{
+ background-color: #e49797;
+ font-weight: bolder;
+}
+
+.warning
+{
+ background-color: #f2f04b;
+ font-weight: bolder;
+}
+
+.ok
+{
+ background-color: #54cb5d;
+ font-weight: bolder;
+}
+
Added: svnbuildstat/root/src/ttsite.css.orig
===================================================================
--- svnbuildstat/root/src/ttsite.css.orig (rev 0)
+++ svnbuildstat/root/src/ttsite.css.orig 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,53 @@
+
+html {
+ height: 100%;
+}
+
+body {
+ background-color: [% site.col.page %];
+ color: [% site.col.text %];
+ margin: 0px;
+ padding: 0px;
+ height: 100%;
+}
+
+#header {
+ background-color: [% site.col.head %];
+ border-bottom: 1px solid [% site.col.line %];
+}
+
+#footer {
+ background-color: [% site.col.head %];
+ text-align: center;
+ border-top: 1px solid [% site.col.line %];
+ position: float;
+ bottom: 0;
+ left: 0px;
+ width: 100%;
+ padding: 4px;
+}
+
+#content {
+ padding: 10px;
+}
+
+.good {
+ background-color: #5ce272;
+}
+.bad {
+ background-color: #e26c5c;
+}
+
+h1.title {
+ padding: 4px;
+ margin: 0px;
+}
+
+a {
+ text-decoration: none;
+ color: [% site.col.text %];
+}
+
+a:hover {
+ text-decoration: overline;
+}
Added: svnbuildstat/root/static/images/btn_120x50_built.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_120x50_built.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_120x50_built_shadow.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_120x50_built_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_120x50_powered.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_120x50_powered.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_120x50_powered_shadow.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_120x50_powered_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_88x31_built.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_88x31_built.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_88x31_built_shadow.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_88x31_built_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_88x31_powered.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_88x31_powered.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/btn_88x31_powered_shadow.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/btn_88x31_powered_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/catalyst_logo.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/catalyst_logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/root/static/images/debian.png
===================================================================
(Binary files differ)
Property changes on: svnbuildstat/root/static/images/debian.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: svnbuildstat/t/01app.t
===================================================================
--- svnbuildstat/t/01app.t (rev 0)
+++ svnbuildstat/t/01app.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+BEGIN { use_ok 'Catalyst::Test', 'SvnBuildStat::WWW' }
+
+ok( request('/')->is_success, 'Request should succeed' );
Added: svnbuildstat/t/02pod.t
===================================================================
--- svnbuildstat/t/02pod.t (rev 0)
+++ svnbuildstat/t/02pod.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
Added: svnbuildstat/t/03podcoverage.t
===================================================================
--- svnbuildstat/t/03podcoverage.t (rev 0)
+++ svnbuildstat/t/03podcoverage.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
Added: svnbuildstat/t/controller_Packages.t
===================================================================
--- svnbuildstat/t/controller_Packages.t (rev 0)
+++ svnbuildstat/t/controller_Packages.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'SvnBuildStat::WWW' }
+BEGIN { use_ok 'SvnBuildStat::WWW::Controller::Packages' }
+
+ok( request('/packages')->is_success, 'Request should succeed' );
+
+
Added: svnbuildstat/t/controller_SvnBuildStat-WWW-Controller-Packages.t
===================================================================
--- svnbuildstat/t/controller_SvnBuildStat-WWW-Controller-Packages.t (rev 0)
+++ svnbuildstat/t/controller_SvnBuildStat-WWW-Controller-Packages.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,9 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'SvnBuildStat::WWW' }
+
+ok( request('/svnbuildstat/www/controller/packages')->is_success, 'Request should succeed' );
+
+
Added: svnbuildstat/t/model_DB.t
===================================================================
--- svnbuildstat/t/model_DB.t (rev 0)
+++ svnbuildstat/t/model_DB.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'SvnBuildStat::WWW::Model::DB' }
+
Added: svnbuildstat/t/view_TT.t
===================================================================
--- svnbuildstat/t/view_TT.t (rev 0)
+++ svnbuildstat/t/view_TT.t 2007-07-23 19:17:58 UTC (rev 350)
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'SvnBuildStat::WWW::View::TT' }
+
More information about the Collab-qa-commits
mailing list