r2583 - in people/goneri: ! dirs' list truncated !
Gonéri Le Bouder
goneri-guest at alioth.debian.org
Thu Apr 19 23:27:50 UTC 2007
Author: goneri-guest
Date: 2007-04-19 23:27:49 +0000 (Thu, 19 Apr 2007)
New Revision: 2583
Added:
people/goneri/svnbuildstat/
people/goneri/svnbuildstat/SvnBuildStat/
people/goneri/svnbuildstat/SvnBuildStat/DB.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/
people/goneri/svnbuildstat/SvnBuildStat/DB/Build.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/Host.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/Maintainer.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/Package.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/Package_Maintainer.pm
people/goneri/svnbuildstat/SvnBuildStat/DB/Repository.pm
people/goneri/svnbuildstat/agent.pl
people/goneri/svnbuildstat/db.sql
people/goneri/svnbuildstat/import-new-report.pl
people/goneri/svnbuildstat/list-pkg2build.pl
people/goneri/svnbuildstat/update-db.pl
Log:
This is an intent to recreate a update-pkg-games like the previous one but
this time with a database :)
So it will be easy to play with bts2ldap and other stuffs.
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Build.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Build.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Build.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,16 @@
+package SvnBuildStat::DB::Build;
+
+use strict;
+
+use Class::DBI::AbstractSearch;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Build->table('build');
+SvnBuildStat::DB::Build->columns(All => qw/build_id package_id date log svndebrelease
+ host_id rev isok duration/);
+SvnBuildStat::DB::Build->has_a(package_id => 'SvnBuildStat::DB::Package');
+SvnBuildStat::DB::Build->has_a(host_id => 'SvnBuildStat::DB::Host');
+
+1;
+
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Host.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Host.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Host.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,12 @@
+package SvnBuildStat::DB::Host;
+
+use strict;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Host->table('host');
+SvnBuildStat::DB::Host->columns(All => qw/host_id name arch maintainer_id/);
+SvnBuildStat::DB::Host->has_a(maintainer_id => 'SvnBuildStat::DB::Maintainer');
+
+1;
+
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Maintainer.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Maintainer.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Maintainer.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,13 @@
+package SvnBuildStat::DB::Maintainer;
+
+use strict;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Maintainer->table('maintainer');
+SvnBuildStat::DB::Maintainer->columns(All => qw/maintainer_id email name/);
+SvnBuildStat::DB::Maintainer->has_many(packages => [
+ 'SvnBuildStat::DB::Package_Maintainer' => 'packages_id' ]);
+
+1;
+
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Package.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Package.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Package.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,14 @@
+package SvnBuildStat::DB::Package;
+
+use strict;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Package->table('package');
+SvnBuildStat::DB::Package->columns(All => qw/package_id repository_id name
+ rev tarballuri istarballpresent isindebian svndebrelease/);
+SvnBuildStat::DB::Package->has_many(maintainers => [
+ 'SvnBuildStat::DB::Package_Maintainer' => 'maintainer_id']);
+SvnBuildStat::DB::Package->has_a(repository_id => 'SvnBuildStat::DB::Repository');
+
+1;
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Package_Maintainer.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Package_Maintainer.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Package_Maintainer.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,13 @@
+package SvnBuildStat::DB::Package_Maintainer;
+
+use strict;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Package_Maintainer->table('package_maintainer');
+SvnBuildStat::DB::Package_Maintainer->columns(All => qw/package_id maintainer_id/);
+SvnBuildStat::DB::Package_Maintainer->has_a(package_id => 'SvnBuildStat::DB::Package');
+SvnBuildStat::DB::Package_Maintainer->has_a(maintainer_id => 'SvnBuildStat::DB::Maintainer');
+
+1;
+
Added: people/goneri/svnbuildstat/SvnBuildStat/DB/Repository.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB/Repository.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB/Repository.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,12 @@
+package SvnBuildStat::DB::Repository;
+
+use strict;
+
+use base 'SvnBuildStat::DB';
+
+SvnBuildStat::DB::Repository->table('repository');
+SvnBuildStat::DB::Repository->columns(All => qw/repository_id uri
+ description tarballlayout/);
+
+1;
+
Added: people/goneri/svnbuildstat/SvnBuildStat/DB.pm
===================================================================
--- people/goneri/svnbuildstat/SvnBuildStat/DB.pm 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/SvnBuildStat/DB.pm 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,29 @@
+package SvnBuildStat::DB;
+
+use strict;
+use warnings;
+
+use base 'Class::DBI';
+
+use SvnBuildStat::DB::Package;
+use SvnBuildStat::DB::Maintainer;
+use SvnBuildStat::DB::Package_Maintainer;
+use SvnBuildStat::DB::Build;
+use SvnBuildStat::DB::Repository;
+
+my ($dsn, $username, $password) = getConfig();
+
+#SvnBuildStat::DB->set_db('Main',$dsn, $username, $password);
+SvnBuildStat::DB->connection($dsn, $username, $password, {AutoCommit=>1});
+
+sub
+getConfig
+{
+ return
+ ('DBI:mysql:database=debpkgstatus;host=127.0.0.1', 'root', '');
+}
+
+
+1;
+
+
Added: people/goneri/svnbuildstat/agent.pl
===================================================================
--- people/goneri/svnbuildstat/agent.pl 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/agent.pl 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,122 @@
+#!/usr/bin/perl -w
+use strict;
+
+use Data::Dumper;
+use Net::FTP;
+use File::Glob ':globally';
+use Sys::Hostname;
+
+my $RELEASE = "0.0.1";
+my $hostname = hostname();
+
+
+my $ftp = Net::FTP->new("nana.rulezlan.org", Debug => 0) or die "Cannot connect to nana.rulezlan.org: $@";
+
+$ftp->login("debpkgstatus","FmM.U8ZN27zFMtk") or die "Cannot login ", $ftp->message;
+
+return if $ftp->get("that.file");
+
+my $svnbase = "svn://svn.debian.org/svn/pkg-games/packages/trunk/bloboats";
+my $tarballdir = "http://pkg-games.alioth.debian.org/tarballs/bloboats_1.0.1.dsfg.orig.tar.gz";
+
+my $distro = "sid";
+my $vardir = "/home/goneri/tmp/debpkgstatus";
+my $workplace = $vardir."/workplace";
+my $pbuilderplace = $vardir."/pbuilder";
+my $tarballsplace = $vardir."/tarballs";
+my $buildarea = $vardir."/build-area";
+my $reportarea = $vardir."/report";
+
+$ENV{LC_ALL} = 'C';
+$ENV{LANG} = 'C';
+
+
+my %report;
+my $tarball;
+
+die "please create: `$vardir'" unless -d $vardir;
+
+# Purge
+if (-d $workplace) {`rm -r $workplace`;}
+if (-d $buildarea) {`rm -r $buildarea`;}
+if (-d $reportarea) {`rm -r $reportarea`;}
+# Create the directorys
+die if (!-d $workplace && !mkdir $workplace);
+die if (!-d $buildarea && !mkdir $buildarea);
+die if (!-d $reportarea && !mkdir $reportarea);
+die if (!-d $pbuilderplace && !mkdir $pbuilderplace);
+die if (!-d $tarballsplace && !mkdir $tarballsplace);
+unlink foreach (<$vardir/report*.tar.bz2>);
+
+$report{'arch'} = `dpkg-architecture -qDEB_HOST_ARCH`;
+$report{hostname} = $hostname;
+
+$report{'release_agent'} = $RELEASE;
+$report{'release_svn-buildpackage'} = `dpkg-query -W -f='\${Version}' svn-buildpackage`;
+$report{'release_linda'} = `dpkg-query -W -f='\${Version}' linda`;
+$report{'release_lintian'} = `dpkg-query -W -f='\${Version}' lintian`;
+$report{'release_pbuilder'} = `dpkg-query -W -f='\${Version}' pbuilder`;
+$report{'release_subversion'} = `dpkg-query -W -f='\${Version}' subversion`;
+
+
+my $pdebuildparam = "--buildplace $pbuilderplace --distribution $distro --basetgz $pbuilderplace/$distro.tar.gz";
+if (! -f "$pbuilderplace/$distro.tar.gz") {
+ `pbuilder create $pdebuildparam >$reportarea/pbuilder-create.log 2>&1`;
+} else {
+ `pbuilder update $pdebuildparam >$reportarea/pbuilder-update.log 2>&1`;
+}
+
+`svn co $svnbase $workplace >$reportarea/svn.log 2>&1`;
+my @tmp = `cd $workplace ; svn log -q --limit 1`;
+$report{'svn_rev'} = $tmp[1];
+$report{'svn_rev'} =~ s/^r(\d+)/$1/;
+
+if (!open CTRL, "<$workplace/debian/control") {
+ $report{checkout} = 'nok';
+} else {
+ $report{checkout} = 'ok';
+
+ close CTRL;
+ foreach (`cd $workplace ; dpkg-parsechangelog 2>&1`) {
+ if (/Source: (.+)/) {
+ $tarball .= $1."_";
+ $report{'source'} = $1;
+ } elsif (/Version: (.+?)(-.+|$)/) {
+ $tarball .= $1.".orig.tar.gz";
+ $report{'release'} = $1;
+ }
+ }
+
+ `cd $tarballsplace ; wget -c $tarballdir >$reportarea/wget.log 2>&1`;
+ if (($? >> 8)!=0) {
+ $report{'download'} = "nok";
+ } else {
+ $report{'download'} = "ok";
+
+ $report{'stamp_build-start'} = time;
+ `cd $workplace ; svn-buildpackage --svn-builder "pdebuild --use-pdebuild-internal -- --buildplace /home/goneri/tmp/debpkgstatus/pbuilder --distribution unstable --basetgz /home/goneri/tmp/debpkgstatus/pbuilder/unstable.tar.gz" --svn-override=origDir=/home/goneri/tmp/debpkgstatus/tarballs --svn-override=buildArea=$buildarea --svn-noninteractive >$reportarea/build.log 2>&1`;
+ $report{'stamp_build-end'} = time;
+
+ if (<$buildarea/*.deb>) {
+ $report{build} = "ok";
+ `cd $buildarea ; lintian --allow-root *.deb *.dsc > $reportarea/lintian.log`;
+ `cd $buildarea ; linda *.deb *.dsc 2>/dev/null > $reportarea/linda.log`;
+ } else {
+ $report{build} = "nok";
+ }
+ }
+}
+
+# Prepare and send the report
+open BUILDREPORT,">".$reportarea."/info";
+foreach (sort keys %report) {
+ chomp $report{$_};
+
+ print BUILDREPORT $_."=".$report{$_}."\n";
+}
+close BUILDREPORT;
+
+`cd $vardir ; tar cfj $reportarea-$hostname.tar.bz2 report 2>&1`;
+
+$ftp->put("$reportarea-$hostname.tar.bz2");
+$ftp->quit;
Property changes on: people/goneri/svnbuildstat/agent.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: people/goneri/svnbuildstat/db.sql
===================================================================
--- people/goneri/svnbuildstat/db.sql 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/db.sql 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,298 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: debpkgstatus
+-- ------------------------------------------------------
+-- Server version 5.0.38-Debian_1-log
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `build`
+--
+
+DROP TABLE IF EXISTS `build`;
+CREATE TABLE `build` (
+ `build_id` int(11) NOT NULL auto_increment,
+ `package_id` int(11) NOT NULL,
+ `svndebrelease` varchar(50) collate utf8_unicode_ci NOT NULL,
+ `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ `log` longtext collate utf8_unicode_ci NOT NULL,
+ `host_id` int(11) NOT NULL,
+ `rev` int(11) NOT NULL,
+ `isok` tinyint(1) NOT NULL default '0',
+ `duration` int(11) NOT NULL,
+ PRIMARY KEY (`build_id`),
+ KEY `host_id` (`host_id`),
+ KEY `rev` (`rev`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `build`
+--
+
+LOCK TABLES `build` WRITE;
+/*!40000 ALTER TABLE `build` DISABLE KEYS */;
+/*!40000 ALTER TABLE `build` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `build_host`
+--
+
+DROP TABLE IF EXISTS `build_host`;
+CREATE TABLE `build_host` (
+ `build_id` int(11) NOT NULL,
+ `host_id` int(11) NOT NULL,
+ KEY `build_id` (`build_id`),
+ KEY `host_id` (`host_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `build_host`
+--
+
+LOCK TABLES `build_host` WRITE;
+/*!40000 ALTER TABLE `build_host` DISABLE KEYS */;
+/*!40000 ALTER TABLE `build_host` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `build_linda`
+--
+
+DROP TABLE IF EXISTS `build_linda`;
+CREATE TABLE `build_linda` (
+ `build_id` int(11) NOT NULL,
+ `linda_id` int(11) NOT NULL,
+ PRIMARY KEY (`build_id`),
+ KEY `linda_id` (`linda_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `build_linda`
+--
+
+LOCK TABLES `build_linda` WRITE;
+/*!40000 ALTER TABLE `build_linda` DISABLE KEYS */;
+/*!40000 ALTER TABLE `build_linda` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `build_lintian`
+--
+
+DROP TABLE IF EXISTS `build_lintian`;
+CREATE TABLE `build_lintian` (
+ `build_id` int(11) NOT NULL,
+ `lintian_id` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `build_lintian`
+--
+
+LOCK TABLES `build_lintian` WRITE;
+/*!40000 ALTER TABLE `build_lintian` DISABLE KEYS */;
+/*!40000 ALTER TABLE `build_lintian` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `host`
+--
+
+DROP TABLE IF EXISTS `host`;
+CREATE TABLE `host` (
+ `host_id` int(11) NOT NULL auto_increment,
+ `name` varchar(255) collate utf8_unicode_ci NOT NULL,
+ `arch` varchar(20) collate utf8_unicode_ci NOT NULL,
+ `maintainer_id` int(11) NOT NULL,
+ PRIMARY KEY (`host_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `host`
+--
+
+LOCK TABLES `host` WRITE;
+/*!40000 ALTER TABLE `host` DISABLE KEYS */;
+/*!40000 ALTER TABLE `host` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `linda`
+--
+
+DROP TABLE IF EXISTS `linda`;
+CREATE TABLE `linda` (
+ `linda_id` int(11) NOT NULL auto_increment,
+ `iswarning` tinyint(4) NOT NULL default '0',
+ `iserror` tinyint(4) NOT NULL default '0',
+ `name` varchar(255) collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`linda_id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `linda`
+--
+
+LOCK TABLES `linda` WRITE;
+/*!40000 ALTER TABLE `linda` DISABLE KEYS */;
+/*!40000 ALTER TABLE `linda` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `lintian`
+--
+
+DROP TABLE IF EXISTS `lintian`;
+CREATE TABLE `lintian` (
+ `lintian_id` int(11) NOT NULL auto_increment,
+ `iswarning` tinyint(1) NOT NULL default '0',
+ `iserror` tinyint(1) NOT NULL default '0',
+ `name` varchar(255) collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`lintian_id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `lintian`
+--
+
+LOCK TABLES `lintian` WRITE;
+/*!40000 ALTER TABLE `lintian` DISABLE KEYS */;
+/*!40000 ALTER TABLE `lintian` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `maintainer`
+--
+
+DROP TABLE IF EXISTS `maintainer`;
+CREATE TABLE `maintainer` (
+ `maintainer_id` int(11) NOT NULL auto_increment,
+ `email` varchar(255) collate utf8_unicode_ci NOT NULL,
+ `name` varchar(255) collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`maintainer_id`),
+ UNIQUE KEY `addr` (`email`)
+) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `maintainer`
+--
+
+LOCK TABLES `maintainer` WRITE;
+/*!40000 ALTER TABLE `maintainer` DISABLE KEYS */;
+/*!40000 ALTER TABLE `maintainer` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `package`
+--
+
+DROP TABLE IF EXISTS `package`;
+CREATE TABLE `package` (
+ `package_id` int(11) NOT NULL auto_increment,
+ `tarballuri` varchar(512) collate utf8_unicode_ci NOT NULL,
+ `repository_id` int(11) NOT NULL,
+ `name` varchar(255) collate utf8_unicode_ci NOT NULL,
+ `rev` int(11) NOT NULL,
+ `istarballpresent` tinyint(1) NOT NULL default '0',
+ `isindebian` tinyint(1) NOT NULL default '0',
+ `svndebrelease` varchar(50) collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`package_id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=MyISAM AUTO_INCREMENT=125 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `package`
+--
+
+LOCK TABLES `package` WRITE;
+/*!40000 ALTER TABLE `package` DISABLE KEYS */;
+/*!40000 ALTER TABLE `package` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `package_maintainer`
+--
+
+DROP TABLE IF EXISTS `package_maintainer`;
+CREATE TABLE `package_maintainer` (
+ `package_id` int(11) NOT NULL,
+ `maintainer_id` int(11) NOT NULL,
+ KEY `package_id` (`package_id`,`maintainer_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `package_maintainer`
+--
+
+LOCK TABLES `package_maintainer` WRITE;
+/*!40000 ALTER TABLE `package_maintainer` DISABLE KEYS */;
+/*!40000 ALTER TABLE `package_maintainer` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `puiparts`
+--
+
+DROP TABLE IF EXISTS `puiparts`;
+CREATE TABLE `puiparts` (
+ `puiparts_id` int(11) NOT NULL auto_increment,
+ `iswarning` tinyint(1) NOT NULL,
+ `iserror` tinyint(1) NOT NULL,
+ `log` longtext collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`puiparts_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `puiparts`
+--
+
+LOCK TABLES `puiparts` WRITE;
+/*!40000 ALTER TABLE `puiparts` DISABLE KEYS */;
+/*!40000 ALTER TABLE `puiparts` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
+-- Table structure for table `repository`
+--
+
+DROP TABLE IF EXISTS `repository`;
+CREATE TABLE `repository` (
+ `repository_id` int(11) NOT NULL,
+ `uri` varchar(512) collate utf8_unicode_ci NOT NULL,
+ `description` varchar(512) collate utf8_unicode_ci NOT NULL,
+ `tarballlayout` varchar(512) collate utf8_unicode_ci NOT NULL,
+ PRIMARY KEY (`repository_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+--
+-- Dumping data for table `repository`
+--
+
+LOCK TABLES `repository` WRITE;
+/*!40000 ALTER TABLE `repository` DISABLE KEYS */;
+/*!40000 ALTER TABLE `repository` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2007-04-19 23:28:50
Added: people/goneri/svnbuildstat/import-new-report.pl
===================================================================
--- people/goneri/svnbuildstat/import-new-report.pl 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/import-new-report.pl 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use lib ".";
+use File::Glob ':globally';
+
+use SvnBuildStat::DB;
+
+use Data::Dumper;
+
+my @dirs = ("/tmp");
+my $tmpdir = "/tmp/work";
+
+die unless -d $tmpdir;
+my @files;
+push @files, <$_/report*.tar.bz2> foreach (@dirs);
+
+#print Dumper(@files);
+
+foreach (@files) {
+ print $_."\n";
+ `cd $tmpdir && tar xfv $_`;
+
+ my $buildstart;
+ my $buildend;
+ open INFO, "<$tmpdir/report/info" or next;
+
+ my %report;
+ foreach (<INFO>) {
+ $report{$1} = $2 if (/(.*)=(.*)/);
+ }
+
+ my $package = SvnBuildStat::DB::Package->retrieve(name => $report{source});
+ my $host = SvnBuildStat::DB::Host->find_or_create(name => $report{hostname});
+ $host->set(arch => $report{arch});
+ $package->update();
+ $host->update();
+
+ SvnBuildStat::DB::Build->create({
+ host_id => $host,
+ package_id => $package,
+ svndebrelease => $report{release},
+ rev => $report{svn_rev},
+ isok => $report{build},
+ duration => $report{'stamp_build-end'}-$report{'stamp_build-start'},
+ });
+
+
+ close INFO;
+# `rm -r $tmpdir/report`;
+}
Property changes on: people/goneri/svnbuildstat/import-new-report.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: people/goneri/svnbuildstat/list-pkg2build.pl
===================================================================
--- people/goneri/svnbuildstat/list-pkg2build.pl 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/list-pkg2build.pl 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+
+use Data::Dumper;
+
+use SvnBuildStat::DB;
+
+my $arch = "i386";
+
+my $iterator = SvnBuildStat::DB::Package->retrieve_all;
+
+while (my $package = $iterator->next) {
+ my $needBuild = 1;
+
+ my $iterator = SvnBuildStat::DB::Build->search_where({
+ package_id => $package,
+ rev => { '>=', $package->rev },
+ },
+ { logic => 'AND' });
+
+ while (my $build = $iterator->next) {
+ if ($build->host_id->arch eq $arch) {
+ $needBuild = 0;
+ last;
+ }
+ }
+
+ print $package->name."\n" if $needBuild;
+
+}
Property changes on: people/goneri/svnbuildstat/list-pkg2build.pl
___________________________________________________________________
Name: svn:executable
+ *
Added: people/goneri/svnbuildstat/update-db.pl
===================================================================
--- people/goneri/svnbuildstat/update-db.pl 2007-04-19 12:25:49 UTC (rev 2582)
+++ people/goneri/svnbuildstat/update-db.pl 2007-04-19 23:27:49 UTC (rev 2583)
@@ -0,0 +1,164 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use SVN::Client;
+use LWP::UserAgent;
+use Data::Dumper;
+
+use SvnBuildStat::DB;
+
+# SVN::Client->cat croak is it try to cat a invalid file
+$SVN::Error::handler=undef;
+
+
+my $ctx;
+my $rev;
+my $uri;
+my $folder;
+
+sub getFile {
+ my $uri = shift;
+
+ my $fh;
+ my $tmp = '';
+ open ($fh, '>', \$tmp) or die;
+ $ctx->cat($fh, $uri, 'HEAD');
+ close ($fh);
+ return unless $tmp;
+
+ my @ret;
+ push @ret, $_ foreach (split $/,$tmp);
+ return @ret;
+}
+
+sub importPkg {
+ my( $repository, $folder, $rev ) = @_;
+
+ my $uri = $$repository->uri."/".$folder;
+ my @maintainer;
+ my $packagesrc;
+ my $svndebrelease;
+ my $tarball;
+ my $tarballuri;
+
+ # I return If the package is already in the DB and unchanged
+ my $package =
+ SvnBuildStat::DB::Package->retrieve(repository_id => $$repository, name =>
+ $folder);
+ return if ($package && $package->rev == $rev);
+ my @control = getFile($uri."/debian/control");
+ return unless @control;
+ foreach (@control) {
+ $packagesrc = $1 if /^Source:\ *(.*)/;
+ if (/^(Maintainer|Uploaders):\ *(.*)/) {
+ my $tmp = $2;
+ foreach (split /,/, $tmp) {
+ if (/(.+)<(.+)>/) {
+ my $name = $1;
+ my $email = $2;
+ $name =~ s/^\ *//;
+ $name =~ s/\ $//;
+ my $maintainer = SvnBuildStat::DB::Maintainer->find_or_create({email=>$email});
+ $maintainer->set(name => $name);
+ $maintainer->update();
+ push @maintainer, $maintainer;
+ }
+
+ }
+ }
+ }
+
+ $package = SvnBuildStat::DB::Package->find_or_create({name=>$packagesrc});
+
+ my @changelog = getFile($uri."/debian/changelog");
+ if (@changelog && $changelog[0] =~ /^.*\ \((.*)\)/) {
+ $svndebrelease = $1;
+ $tarball = $packagesrc."_".$svndebrelease;
+ $tarball .= ".orig" if $tarball =~ s/-\d+$//;
+ $tarball .= ".tar.gz";
+
+ $tarballuri = $$repository->tarballlayout;
+ $tarballuri =~ s/\@TARBALL@/$tarball/;
+ $tarballuri =~ s/\@PACKAGE@/$packagesrc/;
+ }
+
+ $package->set(tarballuri => $tarballuri);
+ $package->set(svndebrelease => $svndebrelease);
+
+ $package->set(rev => $rev);
+ $package->set(repository_id => $$repository);
+ SvnBuildStat::DB::Package_Maintainer->search({package_id =>
+ $package})->delete_all; # TODO
+
+ foreach my $maintainer (@maintainer) {
+ $maintainer->add_to_packages({package_id => $package});
+ $maintainer->update();
+ }
+ $package->update();
+
+}
+
+
+sub updateTarballPresent {
+ my $package = shift;
+
+ my $istarballpresent = 0;
+ my $isindebian = 0;
+
+ my $name = $$package->name;
+ my $tarballuri = $$package->tarballuri;
+ my $svndebrelease = $$package->svndebrelease;
+
+ my $ua = LWP::UserAgent->new;
+ $ua->agent("SvnBuildStat/0.1 ");
+
+ if ($tarballuri) {
+ my $req = HTTP::Request->new(HEAD => $tarballuri);
+ my $res = $ua->request($req);
+ $istarballpresent = 1 if $res->is_success;
+ print "OK in Repo\n" if $istarballpresent;
+ }
+ if ($name && $svndebrelease) {
+ my $debchangelogurl = "http://ftp.debian.org/debian/pool/main";
+ $debchangelogurl .= "/$1" if $$package->name =~ /^(.)/;
+ $debchangelogurl .= "/$name";
+ $debchangelogurl .= "/$name"."_".$svndebrelease.".diff.gz";
+ my $req = HTTP::Request->new(HEAD => $debchangelogurl);
+ my $res = $ua->request($req);
+ $isindebian = 1 if $res->is_success;
+ print "OK in Debian\n" if $isindebian;
+ # TODO update the tarballuri to point on the Debian tarball
+ }
+
+ $$package->set(istarballpresent => $istarballpresent);
+ $$package->set(isindebian => $isindebian);
+ $$package->update();
+}
+
+
+
+$ctx = new SVN::Client(
+ auth => [SVN::Client::get_simple_provider(),
+ SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
+ SVN::Client::get_username_provider()]
+);
+
+# Import packages
+my $iterator = SvnBuildStat::DB::Repository->retrieve_all;
+while (my $repository = $iterator->next) {
+ $uri = $repository->uri;
+ $uri =~ s/\/$//;
+ my $t = $ctx->ls($uri,'HEAD',0);
+ foreach my $folder (keys %$t) {
+ print $folder."\n";
+ $rev = $t->{$folder}->created_rev;
+ importPkg(\$repository,$folder,$rev);
+ }
+}
+
+# Check tarball presence
+$iterator = SvnBuildStat::DB::Package->retrieve_all;
+while (my $package = $iterator->next) {
+ updateTarballPresent(\$package);
+}
Property changes on: people/goneri/svnbuildstat/update-db.pl
___________________________________________________________________
Name: svn:executable
+ *
More information about the Pkg-games-commits
mailing list