[Collab-qa-commits] r1190 - in buildstat/trunk/buildstat-server: lib/SvnBuildStat lib/SvnBuildStat/Vcs script

goneri at alioth.debian.org goneri at alioth.debian.org
Mon Sep 1 13:08:55 UTC 2008


Author: goneri
Date: 2008-09-01 13:08:54 +0000 (Mon, 01 Sep 2008)
New Revision: 1190

Added:
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs/Apt.pm
   buildstat/trunk/buildstat-server/script/svnbuildstat_apt.pl
Modified:
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs.pm
   buildstat/trunk/buildstat-server/script/svnbuildstat_update-db.pl
Log:
different changes to make svnbuildstat_apt.pl works

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm	2008-09-01 13:08:12 UTC (rev 1189)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Common.pm	2008-09-01 13:08:54 UTC (rev 1190)
@@ -3,15 +3,19 @@
 use strict;
 use warnings;
 
+use lib '/usr/share/buildstat-server/lib';
+
 use LWP::UserAgent;
 use Config::IniFiles;
 use LWP::Simple;
 use Logger::Syslog;
 
+use SvnBuildStat::Vcs;
+
 require Exporter;
 
 our @ISA = "Exporter";
-our @EXPORT = qw(mkTarballFromChangelogentry updateRepositoryentryDebianversion checkRepositoryentryWatchfile testUrl mkRootdirectoryFromRepositoryentry getTarballURLFromDebianFtp parseControl parseChangelog getTarballURLFromTarballlayout getTODO getTarballURLFromWatchfile recurseMkdir updateLastBuildSymlink getQajobResultDirectory getFullQajobResultDirectory);
+our @EXPORT = qw(mkTarballFromChangelogentry updateRepositoryentryDebianversion checkRepositoryentryWatchfile testUrl mkRootdirectoryFromRepositoryentry getTarballURLFromDebianFtp parseControl parseChangelog getTarballURLFromTarballlayout getTODO getTarballURLFromWatchfile recurseMkdir updateLastBuildSymlink getQajobResultDirectory getFullQajobResultDirectory updateRepositoryentry updateChangelogentry);
 
 our $archs = "(i386|m68k|sparc|alpha|powerpc|".
         "arm|mips|mipsel|hppa|ia64|s390|amd64|".
@@ -439,4 +443,165 @@
   1;
 }
 
+sub updateRepositoryentry {
+  my ($repositoryentry, $schema, $dir) = @_;
+
+  my $finaldir = $dir; # used by apt update
+  if (!$finaldir) {
+      my $cfg = Config::IniFiles->new( -file => "/etc/buildstat-server/buildstat.ini" ) or die "Can't load config file";
+      my $vcscache = $cfg->val('path', 'vcscache');
+      $finaldir = $vcscache.'/'.$$repositoryentry->repository_id->id.$$repositoryentry->subdir;
+  }
+print "-> finaldir: ".$finaldir."\n";
+  my $control = parseControl($finaldir);
+  my $changelog = parseChangelog($finaldir);
+  my $todo = getTODO($finaldir);
+  if (!$control || !$changelog) {
+    debug ("repositoryentry ".$$repositoryentry->id.": failed to parse the debian files");
+    return;
+  }
+
+  my $sourcepackage = $$schema->resultset('Sourcepackage')->find_or_create({name => $control->{packagesrc}});
+  $$repositoryentry->sourcepackage_id($sourcepackage->id);
+#  $$repositoryentry->dscuri(undef);
+#  $$repositoryentry->realsvndebrelease($changelog->{realsvndebrelease});
+#  $$repositoryentry->svndebrelease ($changelog->{svndebrelease});
+#  if ($changelog->{svndebrelease} !~ /-[\d+\.]+$/) {
+#    $$repositoryentry->isnative('t');
+#  } else {
+#    $$repositoryentry->isnative('f');
+#  }
+  $$repositoryentry->debchangelogentry($changelog->{debchangelogentry});
+#  $$repositoryentry->currentpendingbug($changelog->{currentpendingbug});
+  $$repositoryentry->todo($todo);
+  $$repositoryentry->i386($control->{i386});
+  $$repositoryentry->powerpc($control->{powerpc});
+  $$repositoryentry->sparc($control->{sparc});
+  $$repositoryentry->amd64($control->{amd64});
+
+
+# Delete the current relation betwen the maintainers and the repositoryentry
+  $$schema->resultset('RepositoryentryMaintainer')->search({
+      repositoryentry_id => $$repositoryentry->id
+    })->delete;
+
+# And recreate them
+  foreach (@{$control->{maintainers}}) {
+    my $maintainer = $$schema->resultset('Maintainer')->find_or_create({email=>$_->{email}});
+    $maintainer->name($_->{name});
+    $maintainer->update();
+
+    my $repositoryentry_maintainer =
+    $$repositoryentry->find_or_create_related('repositoryentry_maintainers', {'maintainer_id' => $maintainer->id});
+  }
+
+  $$repositoryentry->update();
+
+}
+
+sub updateChangelogentry {
+  my ($repositoryentry, $schema, $dir) = @_;
+
+  my $cfg = Config::IniFiles->new( -file => "/etc/buildstat-server/buildstat.ini" ) or die "Can't load config file";
+  my $vcscache = $cfg->val('path', 'vcscache');
+
+
+  my $finaldir = $dir; # used by apt update
+  if (!$finaldir) {
+        $finaldir = $vcscache.'/'.$$repositoryentry->repository_id->id.$$repositoryentry->subdir;
+  }
+
+  print "finaldir: ".$finaldir."\n";
+
+  my $control = parseControl($finaldir);
+  my $changelog = parseChangelog($finaldir);
+  if (!$control || !$changelog) {
+    debug ("repositoryentry ".$$repositoryentry->id.": failed to parse the debian files");
+    return;
+  }
+
+  my $vcs = new SvnBuildStat::Vcs({
+    vcstype => $$repositoryentry->repository_id->vcs_id->name,
+    localdir => $vcscache.'/'.$$repositoryentry->repository_id->id,
+    subdir => $$repositoryentry->subdir,
+  });
+
+  my $vcschanges = $vcs->getLastVcsChanges(5);
+  my @added_entry_id;
+  my $first = 1;
+  foreach (@$vcschanges) {
+    # TODO Git users put there email address in there login. With it we can link the vcs user
+    # to the package maintainer
+    my $userlogin = $$schema->resultset('Userlogin')->find_or_create({name=>$_->{login}});
+    my $entry = $$schema->resultset('Changelogentry')->find_or_create({
+        userlogin_id =>$userlogin->id,
+        repositoryentry_id => $$repositoryentry->id,
+        date => $_->{date},
+        rev => $_->{rev},
+      });
+    $entry->text($_->{text});
+
+    if ($first) {
+        if ($changelog->{debrevision}) {
+            $entry->isnative('f');
+        } else {
+            $entry->isnative('t');
+        }
+        $entry->debrevision($changelog->{debrevision});
+        $entry->version($changelog->{version});
+        $entry->epoch($changelog->{epoch});
+
+        foreach my $bugnum (@{$changelog->{currentpendingbug}}) {
+            my $bug = $$schema->resultset('Bug')->find_or_create({
+                id => $bugnum
+            });
+
+            $$schema->resultset('ChangelogentryBug')->find_or_create({
+                bug_id => $bug->id, 
+                changelogentry_id => $entry->id,
+            });
+        }
+
+        ######################################################
+        # hack to forge a dscuri if it's a APT repositoryentry 
+        if ($$repositoryentry->repository_id->vcs_id->name eq 'apt') {
+            my $sourcepackage_name = $$repositoryentry->sourcepackage_id->name;
+            my $version = $changelog->{version};
+            $version =~ s/^\d+://;
+            if($changelog->{debrevision}) {
+                $version .= '-'.$changelog->{debrevision};
+            }
+            if ($sourcepackage_name =~ /^(lib.|.)/) {
+
+                $entry->dscuri("\@DEB_MIRROR\@/pool/main/$1/$sourcepackage_name/$sourcepackage_name\_$version.dsc");
+            }
+
+        }
+
+
+
+
+
+        $$repositoryentry->changelogentry_id($entry->id);
+        $$repositoryentry->update();
+        $first = undef;
+    }
+
+    $entry->update;
+    push @added_entry_id, $entry->id;
+  }
+
+  # I remove the old entry TODO
+#  if (@added_entry_id) { 
+#    $schema->resultset('Changelogentry')->search({
+#	id => { '!=', \@added_entry_id },
+#	repositoryentry_id => $$repositoryentry->id
+#      })->delete;
+#  }
+}
+
+
+
+
+
 1;

Added: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs/Apt.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs/Apt.pm	                        (rev 0)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs/Apt.pm	2008-09-01 13:08:54 UTC (rev 1190)
@@ -0,0 +1,77 @@
+package SvnBuildStat::Vcs::Apt;
+
+use strict;
+use warnings;
+
+#use File::Temp;
+use File::Basename;
+
+sub new {
+
+    my (undef, $uri, $localdir, $subdir) = @_;
+
+    my $self;
+
+    $self->{uri} = $uri;
+    $self->{localdir} = $localdir;
+    $self->{subdir} = $subdir;
+    if ($uri && !$subdir) {
+        $self->{subdir} = basename($uri);
+    }
+    $self->{finaldir} = $self->{localdir}.'/'.$self->{subdir};
+
+
+    bless $self;
+
+}
+
+
+
+sub getLastVcsChanges {
+
+    my ($self,$nbr) = @_;
+
+    $nbr = 5 unless $nbr =~ /^\d+$/;
+
+    use Data::Dumper;
+
+    my $control = $self->{localdir}.$self->{subdir}."/debian/changelog";
+    open CONTROL, "<$control" or die;
+
+    my $rev;
+    my $login;
+    my $date;
+    my $text;
+
+
+    my $i = 0;
+    my @changes;
+    foreach (<CONTROL>) {
+        if (/^\S+\s\((\S+\))\s\S+\s\S+/) {
+            $rev = $1
+        } elsif (/\s--(\s\S+.*\<\S+\>)\s\s(.*)/) {
+            $login = $1;
+            $date = $2;
+            # Remove the first and the last \n
+            $text =~ s/^\s*\n//s;
+            $text =~ s/\n\s*$//s;
+            push @changes, { rev => $rev, login => $login, date => $date, text => $text};
+            $rev = $login = $date = $text = undef;
+            $i++;
+            last if $i >= $nbr
+
+
+        } elsif ($rev) {
+            $text .= $_;
+        }
+    }
+    close CONTROL;
+    return \@changes;
+
+}
+
+sub currentRev {
+    undef;
+}
+
+1;

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs.pm	2008-09-01 13:08:12 UTC (rev 1189)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Vcs.pm	2008-09-01 13:08:54 UTC (rev 1190)
@@ -6,6 +6,7 @@
 use Logger::Syslog;
 use SvnBuildStat::Vcs::Git;
 use SvnBuildStat::Vcs::Svn;
+use SvnBuildStat::Vcs::Apt;
 
 sub new {
     my (undef, $params) = @_;
@@ -15,6 +16,8 @@
        return new SvnBuildStat::Vcs::Git($params->{uri}, $params->{localdir}, $params->{subdir});
     } elsif ($params->{vcstype} eq "svn") {
        return new SvnBuildStat::Vcs::Svn($params->{uri}, $params->{localdir}, $params->{subdir});
+    } elsif ($params->{vcstype} eq "apt") {
+       return new SvnBuildStat::Vcs::Apt($params->{uri}, $params->{localdir}, $params->{subdir});
     } else {
        debug ("unknow vcs type: ".$params->{vcstype});
     }

Added: buildstat/trunk/buildstat-server/script/svnbuildstat_apt.pl
===================================================================
--- buildstat/trunk/buildstat-server/script/svnbuildstat_apt.pl	                        (rev 0)
+++ buildstat/trunk/buildstat-server/script/svnbuildstat_apt.pl	2008-09-01 13:08:54 UTC (rev 1190)
@@ -0,0 +1,205 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use lib '/usr/share/buildstat-server/lib';
+
+use DateTime::Format::Pg;
+use DateTime;
+use Config::IniFiles;
+use Cwd;
+use LWP::Simple;
+use File::Copy;
+use File::Glob;
+use Data::Dumper;
+use Logger::Syslog;
+
+use SvnBuildStat::Schema;
+use SvnBuildStat::Common;
+
+my $schema;
+my $cfg;
+
+sub updateAptRepository {
+    my ($repository) = @_;
+
+    my $baseurl;
+    my $distribution;
+    my $suite;
+
+    my $aptline = $$repository->uri;
+    if ($aptline =~ /^(\S+)\s(\S+)\s(\S+)/) {
+        $baseurl = $1;
+        $distribution = $2;
+        $suite = $3;
+    } else {
+        return;
+    }
+
+
+    my $vcscache = $cfg->val('path', 'vcscache');
+    my $tmpdir = $cfg->val('path', 'tmpdir');
+    my $localdir = $vcscache.'/'.$$repository->id;
+
+
+    my $cachedir = "$localdir";
+    my $sourcesfiledir = "$localdir";
+    my $workdir = "$tmpdir/buildstate-apt";
+
+    `mkdir -p $cachedir`;
+    `mkdir -p $sourcesfiledir`;
+    `mkdir -p $workdir`;
+
+
+
+    my $sourcegzurl = $baseurl."/dists/$distribution/$suite/source/Sources.gz";
+    my ( undef, $remotesize ) = head($sourcegzurl);
+    my ( undef, undef, undef, undef, undef, undef, undef, $localsize ) = stat($sourcesfiledir.'/Sources.gz');
+
+    if (!-f "$sourcesfiledir/Sources" || $remotesize != $localsize) {
+        getstore ($sourcegzurl, $sourcesfiledir.'/Sources.gz');
+        `cat $sourcesfiledir/Sources.gz | gunzip -c > $sourcesfiledir/Sources.tmp`;
+        if (0 != $? >> 8) {
+            unlink 'Sources' or warn;
+            unlink 'Sources.gz' or warn;
+            return;
+        }
+
+        my %tmpentryfiles;
+
+        open SOURCES, "<$sourcesfiledir/Sources.tmp" or die;
+        my $directory;
+        my $sourcepackage;
+        my $version;
+        my $raw;
+        foreach (<SOURCES>) {
+            $raw .= $_;
+            $directory = $1 if /^Directory: (\S+)/;
+            $sourcepackage = $1 if /^Package: (\S+)/;
+            $version = $2 if /^Version: (\d+:|)(\S+)/;
+
+            if (/^\s*$/) {
+                my $tmpentry = $sourcepackage.'_'.$version;
+                $tmpentryfiles{$tmpentry} = 1;
+                if (!-s "$cachedir/$tmpentry/debian/changelog" || !-s "$cachedir/$tmpentry/debian/control") {
+                    mkdir "$cachedir/$tmpentry";
+
+                    die unless -d $workdir;
+                    `rm -rf $workdir/* $cachedir/$tmpentry/*`; # Hum
+                    my $basedir = getcwd();
+                    chdir $workdir or die;
+                    `dget -u $baseurl/$directory/$sourcepackage\_$version.dsc`;
+                    if (0 != $? >> 8) {
+                        return;
+                    }
+                    my @t = glob("$sourcepackage-*");
+                    my $directory = $t[0];
+                    chdir $basedir;
+                    move("$workdir/$directory/debian", "$cachedir/$tmpentry/debian") or die;
+                    # Create the repository entry here
+                    my $sourcepackage = $schema->resultset('Sourcepackage')->find_or_create({name => $sourcepackage});
+                    my $repositoryentry = $schema->resultset('Repositoryentry')->find_or_create({
+                            repository_id => $$repository->id,
+                            subdir => "/$tmpentry",
+                        });
+                    $repositoryentry->sourcepackage_id($sourcepackage->id);
+                    updateRepositoryentry(\$repositoryentry, \$schema, "$cachedir/$tmpentry");
+                    updateChangelogentry(\$repositoryentry, \$schema, "$cachedir/$tmpentry");
+                    $repositoryentry->lastcheck('now');
+                    $repositoryentry->update();
+
+                    $raw = '';
+                }
+            }
+        }
+        close SOURCES;
+
+# Remove the old entry
+        opendir(DIR, $cachedir) || die "can't opendir $cachedir\n";
+        foreach my $tmpentry (readdir(DIR)) {
+            if ($tmpentry !~ /^\./ && !$tmpentryfiles{$tmpentry}) {
+                `rm -rf $cachedir/$tmpentry`;
+            }
+        }
+        closedir DIR;
+        move($sourcesfiledir.'/Sources.tmp', $sourcesfiledir.'/Sources');
+    }
+}
+
+
+
+
+
+$cfg = Config::IniFiles->new( -file => "/etc/buildstat-server/buildstat.ini" ) or die "Can't load config file";
+$schema = SvnBuildStat::Schema->connect(
+    $cfg->val('db', 'dsn'),
+    $cfg->val('db', 'user'),
+    undef,
+    {AutoCommit => 1, debug => 1}
+);
+
+my $repository_rs = $schema->resultset('Repository')->search({
+        -and => [
+        'vcs_id.name' => 'apt',
+        'enabled' => 'true',
+        ]},
+    {
+        join => [qw/ vcs_id /],
+    }
+);
+while (my $repository = $repository_rs->next) {
+    my $begin = DateTime->now;
+
+    debug ("scanning ".$repository->name);
+
+#    my $currentrev = 
+    updateAptRepository(\$repository);
+#    if (!$currentrev) {
+#        debug ($repository->name." failed to refresh");
+#        next;
+#    }
+#
+#    if ($repository->rev && ($repository->rev eq $currentrev)) {
+#        debug ($repository->name." didn't change since last check");
+#        next;
+#    }
+
+#    my $repositoryentrys = scanRepositoryForChangedEntry(\$repository);
+#    foreach my $repositoryentry (@$repositoryentrys) {
+#        updateRepositoryentry($repositoryentry);
+#        updateChangelogentry($repositoryentry);
+#        $$repositoryentry->lastcheck('now');
+#        $$repositoryentry->update();
+#
+#    }
+
+
+# Delete removed repository entry
+#  my $repositoryentry_rs = $schema->resultset('Repositoryentry')->search({
+#		  repository_id => $repository->id
+#		  });
+#  while (my $repositoryentry = $repositoryentry_rs->next) {
+#    if (repositoryentryHadBeenDelete(\$repositoryentry)) {
+#      $repositoryentry->delete();
+#    }
+#  }
+
+
+
+    #$repository->rev($currentrev);
+    $repository->lastcheck(DateTime::Format::Pg->format_timestamp_with_time_zone($begin));
+    $repository->update();
+    debug ($repository->name." updated in ".(time-$begin->epoch)." seconde(s)");
+}
+
+
+
+
+
+
+
+
+
+
+


Property changes on: buildstat/trunk/buildstat-server/script/svnbuildstat_apt.pl
___________________________________________________________________
Name: svn:executable
   + *

Modified: buildstat/trunk/buildstat-server/script/svnbuildstat_update-db.pl
===================================================================
--- buildstat/trunk/buildstat-server/script/svnbuildstat_update-db.pl	2008-09-01 13:08:12 UTC (rev 1189)
+++ buildstat/trunk/buildstat-server/script/svnbuildstat_update-db.pl	2008-09-01 13:08:54 UTC (rev 1190)
@@ -116,134 +116,7 @@
   return 1;
 }
 
-sub updateRepositoryentry {
-  my $repositoryentry = shift;
 
-  my $vcscache = $cfg->val('path', 'vcscache');
-  my $finaldir = $vcscache.'/'.$$repositoryentry->repository_id->id.$$repositoryentry->subdir;
-print "-> finaldir: ".$finaldir."\n";
-  my $control = parseControl($finaldir);
-  my $changelog = parseChangelog($finaldir);
-  my $todo = getTODO($finaldir);
-  if (!$control || !$changelog) {
-    debug ("repositoryentry ".$$repositoryentry->id.": failed to parse the debian files");
-    return;
-  }
-
-  my $sourcepackage = $schema->resultset('Sourcepackage')->find_or_create({name => $control->{packagesrc}});
-  $$repositoryentry->sourcepackage_id($sourcepackage->id);
-#  $$repositoryentry->dscuri(undef);
-#  $$repositoryentry->realsvndebrelease($changelog->{realsvndebrelease});
-#  $$repositoryentry->svndebrelease ($changelog->{svndebrelease});
-#  if ($changelog->{svndebrelease} !~ /-[\d+\.]+$/) {
-#    $$repositoryentry->isnative('t');
-#  } else {
-#    $$repositoryentry->isnative('f');
-#  }
-  $$repositoryentry->debchangelogentry($changelog->{debchangelogentry});
-#  $$repositoryentry->currentpendingbug($changelog->{currentpendingbug});
-  $$repositoryentry->todo($todo);
-  $$repositoryentry->i386($control->{i386});
-  $$repositoryentry->powerpc($control->{powerpc});
-  $$repositoryentry->sparc($control->{sparc});
-  $$repositoryentry->amd64($control->{amd64});
-
-
-# Delete the current relation betwen the maintainers and the repositoryentry
-  $schema->resultset('RepositoryentryMaintainer')->search({
-      repositoryentry_id => $$repositoryentry->id
-    })->delete;
-
-# And recreate them
-  foreach (@{$control->{maintainers}}) {
-    my $maintainer = $schema->resultset('Maintainer')->find_or_create({email=>$_->{email}});
-    $maintainer->name($_->{name});
-    $maintainer->update();
-
-    my $repositoryentry_maintainer =
-    $$repositoryentry->find_or_create_related('repositoryentry_maintainers', {'maintainer_id' => $maintainer->id});
-  }
-
-  $$repositoryentry->update();
-
-}
-
-sub updateChangelogentry {
-  my $repositoryentry = shift;
-
-  my $vcscache = $cfg->val('path', 'vcscache');
-  my $localdir = $vcscache.'/'.$$repositoryentry->repository_id->id;
-  my $subdir = $$repositoryentry->subdir;
-  my $finaldir = $localdir.'/'.$subdir;
-  print "finaldir: ".$finaldir."\n";
-
-  my $control = parseControl($finaldir);
-  my $changelog = parseChangelog($finaldir);
-  if (!$control || !$changelog) {
-    debug ("repositoryentry ".$$repositoryentry->id.": failed to parse the debian files");
-    return;
-  }
-
-  my $vcs = new SvnBuildStat::Vcs({
-    vcstype => $$repositoryentry->repository_id->vcs_id->name,
-    localdir => $localdir,
-    subdir => $subdir,
-  });
-
-  my $vcschanges = $vcs->getLastVcsChanges(5);
-  my @added_entry_id;
-  my $first = 1;
-  foreach (@$vcschanges) {
-    # TODO Git users put there email address in there login. With it we can link the vcs user
-    # to the package maintainer
-    my $userlogin = $schema->resultset('Userlogin')->find_or_create({name=>$_->{login}});
-    my $entry = $schema->resultset('Changelogentry')->find_or_create({
-        userlogin_id =>$userlogin->id,
-        repositoryentry_id => $$repositoryentry->id,
-        date => $_->{date},
-        rev => $_->{rev},
-      });
-    $entry->text($_->{text});
-
-    if ($first) {
-        if ($changelog->{debrevision}) {
-            $entry->isnative('f');
-        } else {
-            $entry->isnative('t');
-        }
-        $entry->debrevision($changelog->{debrevision});
-        $entry->version($changelog->{version});
-        $entry->epoch($changelog->{epoch});
-
-        foreach my $bugnum (@{$changelog->{currentpendingbug}}) {
-            my $bug = $schema->resultset('Bug')->find_or_create({
-                id => $bugnum
-            });
-
-            $schema->resultset('ChangelogentryBug')->find_or_create({
-                bug_id => $bug->id, 
-                changelogentry_id => $entry->id,
-            });
-        }
-        $$repositoryentry->changelogentry_id($entry->id);
-        $$repositoryentry->update();
-        $first = undef;
-    }
-
-    $entry->update;
-    push @added_entry_id, $entry->id;
-  }
-
-  # I remove the old entry TODO
-#  if (@added_entry_id) { 
-#    $schema->resultset('Changelogentry')->search({
-#	id => { '!=', \@added_entry_id },
-#	repositoryentry_id => $$repositoryentry->id
-#      })->delete;
-#  }
-}
-
-
 $cfg = Config::IniFiles->new( -file => "/etc/buildstat-server/buildstat.ini" ) or die "Can't load config file";
 $schema = SvnBuildStat::Schema->connect(
   $cfg->val('db', 'dsn'),
@@ -277,8 +150,8 @@
 
   my $repositoryentrys = scanRepositoryForChangedEntry(\$repository);
   foreach my $repositoryentry (@$repositoryentrys) {
-    updateRepositoryentry($repositoryentry);
-    updateChangelogentry($repositoryentry);
+    updateRepositoryentry($repositoryentry, \$schema);
+    updateChangelogentry($repositoryentry, \$schema);
     $$repositoryentry->lastcheck('now');
     $$repositoryentry->update();
 




More information about the Collab-qa-commits mailing list