[Collab-qa-commits] r641 - svnbuildstat/trunk/lib/SvnBuildStat/Controller

goneri-guest at alioth.debian.org goneri-guest at alioth.debian.org
Sun Jan 13 22:28:11 UTC 2008


Author: goneri-guest
Date: 2008-01-13 22:28:11 +0000 (Sun, 13 Jan 2008)
New Revision: 641

Removed:
   svnbuildstat/trunk/lib/SvnBuildStat/Controller/Builds.pm
Modified:
   svnbuildstat/trunk/lib/SvnBuildStat/Controller/Packages.pm
   svnbuildstat/trunk/lib/SvnBuildStat/Controller/Teams.pm
Log:
to many changes to do a list here

Deleted: svnbuildstat/trunk/lib/SvnBuildStat/Controller/Builds.pm
===================================================================
--- svnbuildstat/trunk/lib/SvnBuildStat/Controller/Builds.pm	2008-01-13 22:27:29 UTC (rev 640)
+++ svnbuildstat/trunk/lib/SvnBuildStat/Controller/Builds.pm	2008-01-13 22:28:11 UTC (rev 641)
@@ -1,156 +0,0 @@
-package SvnBuildStat::Controller::Builds;
-
-use strict;
-use warnings;
-use base 'Catalyst::Controller';
-
-use File::Basename;
-
-=head1 NAME
-
-SvnBuildStat::Controller::Packages - Catalyst Controller
-
-=head1 DESCRIPTION
-
-Catalyst Controller.
-
-=head1 METHODS
-
-=cut
-
-
-=head2 index 
-
-=cut 
-sub loadInfofile {
-  my $infofile = shift;
-
-  my $ret = {};
-
-
-  my $endOfFile;
-  if (open (INFOFILE, "<".$infofile)) {
-    foreach (<INFOFILE>) {
-        $ret->{$1} = $2 if /^(.*?)=(.*)$/;
-        if (/^-END-$/) {
-          $endOfFile = 1;
-          last;
-        }
-    }
-    close INFOFILE;
-  } else {
-    print "failed to open ".$infofile."\n";
-    return;
-  }
-  return unless $endOfFile;
-
-  my $basename = basename($infofile);
-  $ret->{packagesrc} = $1 if $basename =~ /^(.*?)_/;
-  $ret->{vcsrev} = $2 if $basename =~ /~(git|svn|cvs|hg)(.*?)_/;
-                                       #^^^^^^^^^^^^^^^ TODO
-
-  return unless $ret->{packagesrc} or $ret->{id};
-
-  return $ret;
-}
-
-
-sub index : Private {
-  my ( $self, $c ) = @_;
-
-  $c->response->redirect($c->uri_for('/'));
-}
-
-# TODO purge the files
-sub upload : Local {
-  my ( $self, $c, $param ) = @_;
-
-  my @uploadedFiles;
-  my $uploaddir = $c->config->{path}->{uploaddir};
-  my $upload = $c->request->upload('file');
-  my $target = $uploaddir.'/'.basename($upload->filename);
-  if (!$upload->copy_to($target)) {
-    $c->response->body("ko ".$!);
-  }
-
-
-  my $infofile;
-  if ($target =~ /\.info$/) {
-    $infofile = loadInfofile($target);
-  } else {
-    $c->response->body("ok".$!);
-  }
-
-# just in case a file is missing  
-  foreach (split(' ', $uploaddir.'/'.$infofile->{binarypackages})) {
-    next unless -f $uploaddir.'/'.$_;
-    $c->response->body("ko can't find all the binary files");
-  }
-  if (!-f $uploaddir.'/'.$infofile->{logfile}) { 
-    $c->response->body("ko can't find all the binary files");
-  }
-
-  my $log;  
-  if (open LOGFILE, "<".$uploaddir.'/'.$infofile->{logfile}) {
-  
-      seek(LOGFILE, -20000, 2); # I just keep the end of the logfile
-      # If I'm not at the end of BUILDLOGTMP it means that seek moved me
-      $infofile->{log_file} = "(log file truncated) ... " if tell(LOGFILE);
-    foreach (<LOGFILE>) {
-      # To avoid strange breakage I do some clean up in the log file
-      s/[[:cntrl:]]//g;
-      $log .= $_;
-    }
-    close LOGFILE;
-  }
-
-  my $host = $c->model('SvnBuildStat::Model::DB::Host')->find_or_create(name => $infofile->{hostname},
-    arch => $infofile->{arch});
-  my $arch = $c->model('SvnBuildStat::Model::DB::Arch')->find_or_create(name => $infofile->{arch});
-  my $changelogentry_rs = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search(repositoryentry_id => $infofile->{id}, rev => $infofile->{vcsrev});
-  if (!$changelogentry_rs->count) {
-    $c->response->body("can't find such revision in the DB");
-  }
-  my $changelogentry = $changelogentry_rs->first;
-  my $build = $c->model('SvnBuildStat::Model::DB::Build')->find_or_create({
-      changelogentry_id => $changelogentry->id,
-      repositoryentry_id => $infofile->{id},
-      arch_id => $arch->id,
-    });
-
-  $build->time('now');
-  $build->set_from_related('host_id', $host);
-  $build->svndebrelease ($infofile->{release});
-  $build->buildisok ($infofile->{build} eq "ok"?"true":"false");
-  $build->duration
-  ($infofile->{'stamp_build-end'}-$infofile->{'stamp_build-start'});
-  $build->update;
-
-  $build->build_log ($log);
-
-  $c->response->body("ok");
-
-}
-
-
-sub debug : Local {
-  my ( $self, $c, $param ) = @_;
-
-  use Data::Dumper;
-  my $tmp = Dumper($c->config->{path}->{uploaddir});
-  $tmp .= "<\n";
-  $c->response->body($tmp);
-
-}
-=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;

Modified: svnbuildstat/trunk/lib/SvnBuildStat/Controller/Packages.pm
===================================================================
--- svnbuildstat/trunk/lib/SvnBuildStat/Controller/Packages.pm	2008-01-13 22:27:29 UTC (rev 640)
+++ svnbuildstat/trunk/lib/SvnBuildStat/Controller/Packages.pm	2008-01-13 22:28:11 UTC (rev 641)
@@ -172,62 +172,11 @@
 $c->stash->{template} = 'packages/info.tt2';
 
 }
-sub tobuildv3 : 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;
-  }
-#   FROM package
-#      LEFT JOIN build ON package.id = build.package_id AND package.vcsrev = build.rev::text
-#        WHERE package.blacklisted = false AND package.issrcinmypool = true AND (package.lastbuildstart IS NULL OR package.lastbuildstart < (now() - '03:00:00'::interval))
-#          ORDER BY build.id IS NOT NULL, build."time";
 
-  my $repositoryentry_id = $c->model('SvnBuildStat::Model::DB::Viewtobuild')->search({$arch => 'true' })->first->id;
-  my $repositoryentry = $c->model('SvnBuildStat::Model::DB::Repositoryentry')->search ({id => $repositoryentry_id})->first;
 
-
-  $repositoryentry->lastbuildstart('now');
-  $repositoryentry->update();
-
-
-  my $dscuri = $repositoryentry->dscuri;
-  $dscuri =~ s/\@REPOSITORY_URL@/http:\/\/localhost\/debian/;
-
-  $c->response->body("dsc=".$dscuri."\nid=".$repositoryentry->id);
-
-}
-
-
-sub tocheckv3 : Local {
-  my ($self, $c, $qatoolname) = @_;
-
-  return unless $qatoolname =~ /^\w+$/;
-
-  my $qatool = $c->model('SvnBuildStat::Model::DB::Qatool')->search ({name => $qatoolname})->first;
-
-  return unless $qatool;
-
-
-
-  my $package_id = $c->model('SvnBuildStat::Model::DB::Qaresult')->search({$ => 'true' })->first->id;
-  my $build = $c->model('SvnBuildStat::Model::DB::Build')->search ({id => $package_id})->first;
-
-
-
-#  my $dscuri = $package->dscuri;
-#  $dscuri =~ s/\@REPOSITORY_URL@/http:\/\/localhost\/debian/;
-#
-#  $c->response->body("dsc=".$dscuri."\npackage_id=".$package->id);
-
-}
-
 =head1 AUTHOR
 
 Goneri Le Bouder,,,

Modified: svnbuildstat/trunk/lib/SvnBuildStat/Controller/Teams.pm
===================================================================
--- svnbuildstat/trunk/lib/SvnBuildStat/Controller/Teams.pm	2008-01-13 22:27:29 UTC (rev 640)
+++ svnbuildstat/trunk/lib/SvnBuildStat/Controller/Teams.pm	2008-01-13 22:28:11 UTC (rev 641)
@@ -22,19 +22,34 @@
 =cut
 
 sub index : Private {
-  my ( $self, $c ) = @_;
+    my ( $self, $c ) = @_;
 
-  $c->response->redirect($c->uri_for('list'));
+    $c->response->redirect($c->uri_for('list'));
 }
 
 sub list : Local {
-  my ( $self, $c, $repository ) = @_;
+    my ( $self, $c ) = @_;
 
-  $c->stash->{teams} = [ $c->model('SvnBuildStat::Model::DB::Teamy')->search(undef,{order_by=>"name"}) ];
-  
-  $c->stash->{template} = 'teams/main.tt2';
+    $c->stash->{teams} = [ $c->model('SvnBuildStat::Model::DB::Team')->search(undef,{order_by=>"name"}) ];
 
+    $c->stash->{template} = 'teams/main.tt2';
+
 }
 
+sub packages : Local {
+    my ( $self, $c, $team_id ) = @_;
 
+    if (!$team_id || $team_id !~ /^\d+$/) {
+    print STDERR "$team_id > redirect\n";
+        $c->response->redirect($c->uri_for('teams/list'));
+    }
+
+    $c->stash->{team} = $c->model('SvnBuildStat::Model::DB::Team')->search({team_id => $team_id},{order_by=>"name"});
+
+    $c->stash->{packages} = [ $c->model('SvnBuildStat::Model::DB::Viewpackagelist')->search({team_id => $team_id},{order_by=>"name"}) ];
+
+    $c->stash->{template} = 'teams/packages.tt2';
+
+}
+
 1;




More information about the Collab-qa-commits mailing list