Permalink
Browse files

added uploads_failed table

  • Loading branch information...
1 parent d1bbc25 commit 6a912036810d563348c3866e8c07648084e20c23 @barbie committed Dec 13, 2010
Showing with 51 additions and 13 deletions.
  1. +5 −0 CHANGES
  2. +3 −3 META.yml
  3. +1 −1 Makefile.PL
  4. +12 −0 examples/uploads.sql
  5. +10 −2 lib/CPAN/Testers/Data/Uploads.pm
  6. +20 −7 t/05setup_db-uploads.t
View
@@ -1,6 +1,11 @@
Revision history for Perl distribution CPAN-Testers-Data-Uploads
================================================================
+0.16 13/12/2010
+ - new table 'uploads_failed' to record those distribution uploads that
+ do not parse using CPAN::DistnameInfo.
+ - now require CPAN::DistnameInfo-0.10 or above.
+
0.15 29/11/2010
- fixed UpdateIndex SQL query.
- dropped fast reindex, due to flaw in design.
View
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: CPAN-Testers-Data-Uploads
-version: 0.15
+version: 0.16
abstract: CPAN Testers Uploads Database Generator
author:
- Barbie <barbie@cpan.org>
@@ -11,7 +11,7 @@ installdirs: site
requires:
Class::Accessor::Fast: 0
- CPAN::DistnameInfo: 0
+ CPAN::DistnameInfo: 0.10
CPAN::Testers::Common::Article: 0
CPAN::Testers::Common::DBUtils: 0
Config::IniFiles: 0
@@ -37,7 +37,7 @@ build_requires:
provides:
CPAN::Testers::Data::Uploads:
file: lib/CPAN/Testers/Data/Uploads.pm
- version: 0.15
+ version: 0.16
no_index:
directory:
View
@@ -5,7 +5,7 @@ WriteMakefile(
'PREREQ_PM' => {
'Class::Accessor::Fast' => 0,
- 'CPAN::DistnameInfo' => 0,
+ 'CPAN::DistnameInfo' => '0.10',
'CPAN::Testers::Common::Article' => 0,
'CPAN::Testers::Common::DBUtils' => 0,
'Config::IniFiles' => 0,
View
@@ -37,6 +37,18 @@ CREATE TABLE `page_requests` (
`weight` int(2) unsigned NOT NULL
) ENGINE=MyISAM;
+DROP TABLE IF EXISTS uploads_failed;
+CREATE TABLE uploads_failed (
+ source varchar(255) NOT NULL,
+ type varchar(255),
+ dist varchar(255),
+ version varchar(255),
+ file varchar(255),
+ pause varchar(255),
+ created int(11) unsigned,
+ PRIMARY KEY (source)
+) ENGINE=MyISAM;
+
## SQLite
CREATE TABLE `uploads` (
@@ -4,7 +4,7 @@ use strict;
use warnings;
use vars qw($VERSION);
-$VERSION = '0.15';
+$VERSION = '0.16';
$|++;
#----------------------------------------------------------------------------
@@ -50,6 +50,8 @@ my %phrasebook = (
'InsertRequest' => 'INSERT INTO page_requests (type,name,weight) VALUES (?,?,5)',
+ 'ParseFailed' => 'REPLACE INTO uploads_failed (source,type,dist,version,file,pause,created) VALUES (?,?,?,?,?,?,?)',
+
# SQLite backup
'CreateTable' => 'CREATE TABLE uploads (type text, author text, dist text, version text, filename text, released int)',
);
@@ -273,7 +275,13 @@ sub _parse_archive {
my $filename = $dist->filename; # "CPAN-DistnameInfo-0.02.tar.gz"
my $date = (stat($file))[9];
- return unless($name && $version && $cpanid && $date);
+ unless($name && $version && $cpanid && $date) {
+ $self->_log("PARSE: FAIL file=$file, $type => $name => $version => $cpanid => $date => $filename");
+ $file =~ s!/opt/projects/CPAN/!!;
+ $db->do_query($phrasebook{'ParseFailed'},$file,$type,$name,$version,$filename,$cpanid,$date);
+ return;
+ }
+
#$self->_log("$type => $name => $version => $cpanid => $date");
my @rows = $db->get_query('array',$phrasebook{'FindDistVersion'},$cpanid,$name,$version);
View
@@ -14,13 +14,26 @@ mkpath( dirname($f) );
my $dbh = CPAN::Testers::Common::DBUtils->new(driver => 'SQLite', database => $f);
$dbh->do_query(q{
CREATE TABLE `uploads` (
- `type` text NOT NULL,
- `author` text NOT NULL,
- `dist` text NOT NULL,
- `version` text NOT NULL,
- `filename` text NOT NULL,
- `released` int NOT NULL,
- PRIMARY KEY (`author`,`dist`,`version`)
+ `type` text NOT NULL,
+ `author` text NOT NULL,
+ `dist` text NOT NULL,
+ `version` text NOT NULL,
+ `filename` text NOT NULL,
+ `released` int NOT NULL,
+ PRIMARY KEY (`author`,`dist`,`version`)
+ );
+});
+
+$dbh->do_query(q{
+ CREATE TABLE `uploads_failed` (
+ source text NOT NULL,
+ type text,
+ dist text,
+ version text,
+ file text,
+ pause text,
+ created int,
+ PRIMARY KEY (source)
);
});

0 comments on commit 6a91203

Please sign in to comment.