[Collab-qa-commits] r615 - svnbuildstat/trunk/script
goneri-guest at alioth.debian.org
goneri-guest at alioth.debian.org
Fri Dec 21 09:50:05 UTC 2007
Author: goneri-guest
Date: 2007-12-21 09:50:05 +0000 (Fri, 21 Dec 2007)
New Revision: 615
Modified:
svnbuildstat/trunk/script/svnbuildstat_update-repository.pl
Log:
script adjusted for the new DB schema
Modified: svnbuildstat/trunk/script/svnbuildstat_update-repository.pl
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_update-repository.pl 2007-12-19 15:36:00 UTC (rev 614)
+++ svnbuildstat/trunk/script/svnbuildstat_update-repository.pl 2007-12-21 09:50:05 UTC (rev 615)
@@ -2,19 +2,23 @@
use strict;
+use lib '/home/goneri/local/share/perl/5.8.8';
use LWP::Simple;
use File::Basename;
-use File::Glob qw/:globally/;
+use File::Glob qw/:glob/;
use File::Find;
use File::Touch;
use File::Copy;
use File::stat;
use Config::IniFiles;
+use Cwd;
use lib '../lib';
use SvnBuildStat::Schema;
use SvnBuildStat::Common;
use Logger::Syslog;
use SvnBuildStat::Vcs;
+use DBIx::Class::QueryLog;
+use DBIx::Class::QueryLog::Analyzer;
my $cfg = Config::IniFiles->new( -file => $ENV{HOME}."/.svnbuildstat.ini" ) or die "Can't load config file";
@@ -27,7 +31,7 @@
if (!-d $tarballdir) {
die "tarballdir `'".$tarballdir."' doesn't exist\n";
}
-chdir $repositorydir or die;
+#chdir $repositorydir or die;
my $schema;
@@ -64,17 +68,17 @@
$$repositoryentry->changelogentry_id->tarball_id(undef);
}
- my $cmd = "cp -l $tarballdir/$tarball $workdir/$tarball";
+ my $cmd = "cp -v $tarballdir/$tarball $workdir/$tarball";
`$cmd`;
- if (-f "$workdir/$tarball") {
+ if (!-f "$workdir/$tarball") {
debug ("Failed to copy $tarballdir/$tarball to $workdir/$tarball");
return;
}
+ my $cwd = getcwd;
chdir $workdir or die;
my $pkgrootdirectory;
foreach (`tar tf $tarball 2>&1`) {
- print;
if (/^(.\/|)(.*?)\//) {
if ($pkgrootdirectory && $pkgrootdirectory ne $2) {
info("tarball has more than one root directory! I ignore it");
@@ -88,6 +92,9 @@
info("failed to untar $tarball");
return;
}
+ # fix the rights of the files and directories in the tarball
+ `find $pkgrootdirectory -exec chmod +rw {} \\;`;
+ chdir $cwd;
# if (!move($pkgrootdirectory, SvnBuildStat::Common::mkRootdirectoryFromRepositoryentry($repositoryentry))) {
# return;
# }
@@ -117,7 +124,7 @@
my $workdir = $repositorydir."/tmp";
`rm -Rf $workdir; mkdir -p $workdir`;
- chdir $workdir or die;
+# chdir $workdir or die;
my $pkgrootdirectory;
if (!$$repositoryentry->changelogentry_id->isnative) {
@@ -136,32 +143,36 @@
print "exportIn end".$workdir."/".$pkgrootdirectory."\n";
return unless addSubRevInChangelog($workdir."/".$pkgrootdirectory, $vcsname.$vcsrev);
-
- `dpkg-source -b -W $pkgrootdirectory 2>&1`;
+
+ my $cwd = getcwd;
+ chdir $workdir or die;
+ print `dpkg-source -b -W $pkgrootdirectory 2>&1`;
if (($? >> 8)!=0) {
info ("failed to create .dsc");
return;
}
+ chdir $cwd;
my $destdir = $repositorydir.'/'.
$$repositoryentry->repository_id->team_id->shortname.'/'.
- $$repositoryentry->sourcepackage_id->name;
+ $$repositoryentry->sourcepackage_id->name.'/'.
+ $$repositoryentry->changelogentry_id->id;
`mkdir -p $destdir` unless -d $destdir;
-
my $dscfile;
- foreach my $file (<$workdir/*>) {
- next unless -f $file;
- $dscfile = basename($file) if $file =~ /\.dsc/;
- move ($file, $destdir);
- }
- return unless $dscfile;
+ foreach my $file (bsd_glob($workdir.'/*')) {
+ next unless -f $file;
+ $dscfile = basename($file) if $file =~ /\.dsc/;
+ move ($file, $destdir);
+ }
+ print "dscfile: ".$dscfile."\n";
+ return unless $dscfile;
- $$repositoryentry->changelogentry_id->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;
- }
+ my $dscuri = '@REPOSITORY_URL@/'.$$repositoryentry->repository_id->team_id->shortname.'/'.$$repositoryentry->sourcepackage_id->name.'/'.$$repositoryentry->changelogentry_id->id.'/'.$dscfile;
+ $$repositoryentry->changelogentry_id->dscuri($dscuri);
+ $$repositoryentry->changelogentry_id->update;
+ `rm -Rf $workdir`;
+ 1;
+ }
##########################################
##########################################
@@ -188,6 +199,10 @@
$cfg->val('db', 'password'),
{AutoCommit => 1, debug => 1}
);
+my $ql = new DBIx::Class::QueryLog();
+ $schema->storage->debugobj($ql);
+ $schema->storage->debug(1);
+
# It's not a joke since I'll do rm -Rf in this directory and don't want to trash
# the system yet :)
die "repositorydir doesn't exist!\n" unless -d $repositorydir;
More information about the Collab-qa-commits
mailing list