[Collab-qa-commits] r1201 - in buildstat/trunk/buildstat-server/lib/SvnBuildStat: . Controller

goneri at alioth.debian.org goneri at alioth.debian.org
Tue Sep 2 13:58:48 UTC 2008


Author: goneri
Date: 2008-09-02 13:58:47 +0000 (Tue, 02 Sep 2008)
New Revision: 1201

Modified:
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
Log:
add the apt-get target for QA job, I'm not fan of its design yet.

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm	2008-09-02 10:56:14 UTC (rev 1200)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm	2008-09-02 13:58:47 UTC (rev 1201)
@@ -575,7 +575,6 @@
 
                 $entry->dscuri("\@DEB_MIRROR\@/pool/main/$1/$sourcepackage_name/$sourcepackage_name\_$version.dsc");
             }
-
         }
 
 

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm	2008-09-02 10:56:14 UTC (rev 1200)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm	2008-09-02 13:58:47 UTC (rev 1201)
@@ -132,7 +132,7 @@
     }
 
     die "qatool key missing" unless $params->{qatool};
-    die "invalide target" unless $params->{target} =~ /^(source|binary)$/;
+    die "invalide target" unless $params->{target} =~ /^(source|binary|apt-get)$/;
 
     my $qatool = $c->model('SvnBuildStat::Model::DB::Qatool')->find_or_create(name => $params->{qatool});
 
@@ -163,41 +163,96 @@
   lastjobstart
  LIMIT 1";
 
-    $request{build} = "
-SELECT
-  changelogentry.id AS changelogentry_id,
+    $request{binary} = "
+
+SELECT  changelogentry.id AS changelogentry_id,
   changelogentry.changesuri AS changesuri,
-  build.id AS build_id 
+  build.id AS build_id,
 FROM
-  build,
   changelogentry
  LEFT JOIN
   qajob
  ON
+  qajob.qatool_id=".$qatool->id."
+ AND
   changelogentry.id=qajob.changelogentry_id
+ LEFT JOIN
+  build
+ ON
+  build.changelogentry_id=changelogentry.id
+ LEFT JOIN
+  repositoryentry
+ ON
+  repositoryentry.changelogentry_id=changelogentry.id
+ LEFT JOIN
+  repository
+ ON
+  repository.id=repositoryentry.repository_id
+ LEFT JOIN
+  vcs
+ ON
+  vcs.id=repository.vcs_id
+WHERE
+  vcs.name<>'apt' AND build.changelogentry_id=changelogentry.id AND isbuildok=true AND changelogentry.changesuri IS NOT NULL
+ ORDER BY
+  lastjobstart IS NOT NULL,
+  lastjobstart
+  LIMIT 1
+
+";
+
+    $request{'apt-get'} = "
+
+SELECT  changelogentry.id AS changelogentry_id,
+  changelogentry.changesuri AS changesuri,
+  build.id AS build_id,
+  vcs.name AS vcs_name,
+  sourcepackage.name AS sourcepackage_name,
+  repository.uri AS repository_uri
+FROM
+  changelogentry
+ LEFT JOIN
+  qajob
+ ON
+  qajob.qatool_id=".$qatool->id."
  AND
-  qajob.qatool_id=".$qatool->id."
+  changelogentry.id=qajob.changelogentry_id
+ LEFT JOIN
+  build
+ ON
+  build.changelogentry_id=changelogentry.id
+ LEFT JOIN
+  repositoryentry
+ ON
+  repositoryentry.changelogentry_id=changelogentry.id
+ LEFT JOIN
+  repository
+ ON
+  repository.id=repositoryentry.repository_id
+ LEFT JOIN
+  vcs
+ ON
+  vcs.id=repository.vcs_id
+ LEFT JOIN
+  sourcepackage
+ ON
+  repositoryentry.sourcepackage_id=sourcepackage.id
 WHERE
-  build.changelogentry_id=changelogentry.id
- AND
-  isbuildok='1'
- AND
-  changelogentry.changesuri IS NOT NULL
+  vcs.name='apt'
  ORDER BY
   lastjobstart IS NOT NULL,
   lastjobstart
- LIMIT 1";
+  LIMIT 1
 
+";
 
 
 
+print STDERR $params->{target}."\n";
+print "--->".$request{$params->{target}}."\n";
 
-
     my $hashref  = $dbh->selectrow_hashref($request{$params->{target}});
     die unless $hashref;
-#    my $changelogentry_id = $;
-#    my $dscuri = $array[1];
-#    my $build_id = $array[2];
     my $cookie = int (rand(0xfffffff));
     my $changelogentry = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search({id => $hashref->{changelogentry_id}})->first;
     die unless $changelogentry;
@@ -230,19 +285,29 @@
         $qajob->lastjobstart("NOW");
         $qajob->update;
 
-        #my $changesfile = bsd_glob($c->config->{path}->{staticdir}.'/files/'.$changelogentry->repositoryentry_id->repository_id->team_id->shortname.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$build_id."/deb/*.changes");
-#        my $changesfile = bsd_glob('/var/lib/buildstat-server/repository/'.$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$hashref->{build_id}."/deb/*.changes");
-#	print STDERR $changesfile."\n";
-#        my $changesuri = "http://buildstat.debian.net/repository/".$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$hashref->{build_id}."/deb/".basename($changesfile);
+        $ret .= "changesuri=".$hashref->{changesuri}."\n";
 
-        $ret .= "qajob_id=".$qajob->id."\nchangesuri=".$hashref->{changesuri}."\n";
+        $ret .= "qajob_id=".$qajob->id."\n";
 
+    } elsif ($params->{target} eq 'apt-get') {
+
+        $qajob = $c->model('SvnBuildStat::Model::DB::Qajob')->find_or_create(
+            qatool_id => $qatool->id,
+            changelogentry_id => $hashref->{changelogentry_id},
+        );
+        $qajob->cookie($cookie);
+        $qajob->lastjobstart("NOW");
+        $qajob->update;
+
+        $ret .= "sourcepackage_name=".$hashref->{sourcepackage_name}."\n";
+        $ret .= "apt=".$hashref->{repository_uri}."\n";
+
+        $ret .= "qajob_id=".$qajob->id."\n";
+
     }
     die unless $qajob;
 
 
-#    my $repositoryuri = "http://buildstat.debian.net/repository";
-#    $dscuri =~ s/\@REPOSITORY_URL@/$repositoryuri/;
     $ret .= "cookie=$cookie\n";
 
 
@@ -252,7 +317,6 @@
 
 
 
-# TODO purge the files
 sub buildInput : Local {
     my ( $self, $c, $param ) = @_;
 




More information about the Collab-qa-commits mailing list