[Collab-qa-commits] r560 - in svnbuildstat/trunk: lib/SvnBuildStat script

goneri-guest at alioth.debian.org goneri-guest at alioth.debian.org
Wed Dec 5 18:11:02 UTC 2007


Author: goneri-guest
Date: 2007-12-05 18:11:02 +0000 (Wed, 05 Dec 2007)
New Revision: 560

Modified:
   svnbuildstat/trunk/lib/SvnBuildStat/Common.pm
   svnbuildstat/trunk/script/svnbuildstat_update-bugs.pl
   svnbuildstat/trunk/script/svnbuildstat_update-repository.pl
Log:
apply the changes on schema too:
 -svnbuildstat_update-repository.pl
 -svnbuildstat_update-bugs.pl
 -SvnBuildStat/Common.pm


Modified: svnbuildstat/trunk/lib/SvnBuildStat/Common.pm
===================================================================
--- svnbuildstat/trunk/lib/SvnBuildStat/Common.pm	2007-12-05 17:51:05 UTC (rev 559)
+++ svnbuildstat/trunk/lib/SvnBuildStat/Common.pm	2007-12-05 18:11:02 UTC (rev 560)
@@ -6,7 +6,7 @@
 require Exporter;
 
 our @ISA = "Exporter";
-our @EXPORT = qw(mkTarballFromPackage testUrl mkRootdirectoryFromPackage getDataFromDebianFtp parseControl parseChangelog);
+our @EXPORT = qw(mkTarballFromPackage testUrl mkRootdirectoryFromRepositoryentry getDataFromDebianFtp parseControl parseChangelog);
 
 sub mkTarballFromRepositoryentry {
   my $repositoryentry = shift;
@@ -32,15 +32,15 @@
 
 }
 
-sub mkRootdirectoryFromPackage {
-  my $package = shift;
+sub mkRootdirectoryFromRepositoryentry {
+  my $repositoryentry = shift;
 
-  my $majorrelease = $$package->svndebrelease;
+  my $majorrelease = $$repositoryentry->svndebrelease;
   return unless $majorrelease;
   $majorrelease =~ s/^\d+://;
   $majorrelease =~ s/-[+0-9A-Za-z\.~]*$//;
 
-  $$package->name.'-'.$majorrelease;
+  $$repositoryentry->sourcepackage_id->name.'-'.$majorrelease;
 }
 
 sub getDataFromDebianFtp {

Modified: svnbuildstat/trunk/script/svnbuildstat_update-bugs.pl
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_update-bugs.pl	2007-12-05 17:51:05 UTC (rev 559)
+++ svnbuildstat/trunk/script/svnbuildstat_update-bugs.pl	2007-12-05 18:11:02 UTC (rev 560)
@@ -22,9 +22,9 @@
 );
 
 my %currentPackage;
-my $package_rs = $schema->resultset('Package');
-while( my $package = $package_rs->next) {
-  $currentPackage{$package->name} = 1;
+my $sourcepackage_rs = $schema->resultset('Sourcepackage');
+while( my $sourcepackage = $sourcepackage_rs->next) {
+  $currentPackage{$sourcepackage->name} = 1;
 }
 my $tmpfile = "/tmp/fullindex".$$;
 
@@ -41,12 +41,12 @@
     if ($h{debbugsSourcePackage} && exists ($currentPackage{$h{debbugsSourcePackage}})) {
       if (!($h{debbugsTag} && $h{debbugsTag} =~ /(pending|wontfix|unreproducible|moreinfo)/)&& $h{debbugsState} =~ /open/) {
 
-	my $package = $schema->resultset('Package')->search({name => $h{debbugsSourcePackage}})->first;
+	my $sourcepackage = $schema->resultset('Sourcepackage')->search({name => $h{debbugsSourcePackage}})->first;
 	my $severity = $schema->resultset('Severity')->find_or_create({name=>$h{debbugsSeverity}});
 	my $bug = $schema->resultset('Bug')->find_or_create({bug_id => $h{debbugsID}});
 
 	$bug->severity_id ($severity->id);
-	$bug->package_id ($package->id);
+	$bug->sourcepackage_id ($sourcepackage->id);
 	$bug->name ($h{debbugsTitle});
 	$bug->update;
 

Modified: svnbuildstat/trunk/script/svnbuildstat_update-repository.pl
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_update-repository.pl	2007-12-05 17:51:05 UTC (rev 559)
+++ svnbuildstat/trunk/script/svnbuildstat_update-repository.pl	2007-12-05 18:11:02 UTC (rev 560)
@@ -41,9 +41,9 @@
 
 sub fetchAndPrepareDirectoryForMergeWithUpstream {
 
-  my ($package, $workdir) = @_;
+  my ($repositoryentry, $workdir) = @_;
 
-  my $tarball = SvnBuildStat::Common::mkTarballFromPackage($package);
+  my $tarball = SvnBuildStat::Common::mkTarballFromRepositoryentry($repositoryentry);
 
   return unless $tarball;
   debug("looks for the tarball");
@@ -52,7 +52,7 @@
   # package repository directly
   if (!-f "$workdir/$tarball") {
     debug("the tarball is needed");
-    my $tarballuri = $$package->tarballuri;
+    my $tarballuri = $$repositoryentry->tarballuri;
     return unless $tarballuri;
     $tarballuri =~ s/\@DEBMIRROR@/$debmirror/;
 
@@ -78,7 +78,7 @@
     info("failed to untar $tarball");
     return;
   }
-  if (!move($rootdirectory, SvnBuildStat::Common::mkRootdirectoryFromPackage($package))) {
+  if (!move($rootdirectory, SvnBuildStat::Common::mkRootdirectoryFromRepositoryentry($repositoryentry))) {
     return;
   }
 
@@ -89,16 +89,16 @@
 
 
 sub prepare {
-  my ($package) = @_;
-  debug("prepareFromSvn: ".$$package->name);
+  my ($repositoryentry) = @_;
+  debug("prepareFromSvn: ".$$repositoryentry->sourcepackage_id->name);
 
-  my $vcsname = $$package->repository_id->vcs_id->name;
-  my $vcs = new SvnBuildStat::Vcs($vcsname, $$package->vcsuri);
+  my $vcsname = $$repositoryentry->repository_id->vcs_id->name;
+  my $vcs = new SvnBuildStat::Vcs($vcsname, $$repositoryentry->vcsuri);
 
-  my $repo_shortname = $$package->repository_id->shortname;
+  my $repo_shortname = $$repositoryentry->repository_id->shortname;
   next unless $repo_shortname;
 
-  my $directory = $$package->name;
+  my $directory = $$repositoryentry->sourcepackage_id->name;
   # TODO replace repo_shortname/ by team short name
   #my $workdir = $config->server_repositorydir."/$repo_shortname/".$$package->name."/tmp";
   my $workdir = $config->server_repositorydir."/tmp";
@@ -107,20 +107,20 @@
   chdir $workdir or die;
 
 
-  if (!$$package->isnative) {
-    return unless fetchAndPrepareDirectoryForMergeWithUpstream($package, $workdir);
+  if (!$$repositoryentry->isnative) {
+    return unless fetchAndPrepareDirectoryForMergeWithUpstream($repositoryentry, $workdir);
   }
   print "cc\n";
 
-  my $packagerootdir = SvnBuildStat::Common::mkRootdirectoryFromPackage($package);
+  my $packagerootdir = SvnBuildStat::Common::mkRootdirectoryFromRepositoryentry($repositoryentry);
   my $vcsrev = $vcs->exportIn($workdir."/".$packagerootdir);
   if (!$vcsrev) {
-    info("failed to export from vcs ".$$package->vcsuri);
+    info("failed to export from vcs ".$$repositoryentry->vcsuri);
     return;
   }
 
   return unless addSubRevInChangelog($packagerootdir, $vcsname.$vcsrev);
-  if ($vcsrev ne $$package->vcsrev) {
+  if ($$repositoryentry->vcsrev && $$repositoryentry->vcsrev ne $vcsrev) {
     #TODO: We're preparing a package that is not up to date in the DB. We should
     # call an update DB here.
   }
@@ -131,8 +131,8 @@
     return;
   }
   my $destdir = $config->server_repositorydir.'/'.
-  $$package->repository_id->team_id->shortname.'/'.
-  $$package->name;
+  $$repositoryentry->repository_id->team_id->shortname.'/'.
+  $$repositoryentry->sourcepackage_id->name;
   `mkdir -p $destdir` unless -d $destdir;
 
   my $dscfile;
@@ -143,10 +143,9 @@
   }
   return unless $dscfile;
 
-#  $$package->dscuri($config->server_repositoryurl.'/'.$$package->repository_id->team_id->shortname.'/'.$$package->name.'/'.$dscfile);
-  $$package->dscuri('@REPOSITORY_URL@/'.$$package->repository_id->team_id->shortname.'/'.$$package->name.'/'.$dscfile);
-  $$package->issrcinmypool(1);#TODO deprecated, we use dscuri instead
-  $$package->update;
+  $$repositoryentry->dscuri('@REPOSITORY_URL@/'.$$repositoryentry->repository_id->team_id->shortname.'/'.$$repositoryentry->sourcepackage_id->name.'/'.$dscfile);
+  $$repositoryentry->issrcinmypool(1);#TODO deprecated, we use dscuri instead
+  $$repositoryentry->update;
   `rm -Rf $workdir`;
   1;
 }
@@ -184,9 +183,9 @@
 
 #purgeOutDated();
 
-my $package_rs = $schema->resultset('Package')->search({ dscuri => undef });
-while (my $package = $package_rs->next) {
-  prepare(\$package);
+my $repositoryentry_rs = $schema->resultset('Repositoryentry')->search({ dscuri => undef });
+while (my $repositoryentry = $repositoryentry_rs->next) {
+  prepare(\$repositoryentry);
 }
 
 




More information about the Collab-qa-commits mailing list