[Catalyst-commits] r10389 - in trunk/examples/SmokeServer: . script

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sat May 30 13:12:59 GMT 2009


Author: caelum
Date: 2009-05-30 13:12:59 +0000 (Sat, 30 May 2009)
New Revision: 10389

Added:
   trunk/examples/SmokeServer/script/cpan_download
   trunk/examples/SmokeServer/script/cpan_smoke.pl
Removed:
   trunk/examples/SmokeServer/script/cpan_download.pl
Modified:
   trunk/examples/SmokeServer/Makefile.PL
   trunk/examples/SmokeServer/script/cpan_installdeps.pl
Log:
cpan smoker is functional!

Modified: trunk/examples/SmokeServer/Makefile.PL
===================================================================
--- trunk/examples/SmokeServer/Makefile.PL	2009-05-30 10:57:32 UTC (rev 10388)
+++ trunk/examples/SmokeServer/Makefile.PL	2009-05-30 13:12:59 UTC (rev 10389)
@@ -1,4 +1,4 @@
-use inc::Module::Install 0.87;
+use inc::Module::Install 0.91;
 
 name 'SmokeServer';
 all_from 'lib/SmokeServer.pm';
@@ -25,11 +25,13 @@
 requires 'Catalyst::Model::DBIC::Schema' => '0';
 requires 'Catalyst::View::TT::FunctionGenerator' => '0';
 requires 'Catalyst::View::JSON' => '0';
+requires 'File::Find::Rule';
 
 test_requires 'Test::WWW::Mechanize::Catalyst';
 
 build_requires 'DBICx::Deploy';
 
+catalyst_ignore 'cpan';
 catalyst;
 
 install_script glob('script/*.pl');

Copied: trunk/examples/SmokeServer/script/cpan_download (from rev 10385, trunk/examples/SmokeServer/script/cpan_download.pl)
===================================================================
--- trunk/examples/SmokeServer/script/cpan_download	                        (rev 0)
+++ trunk/examples/SmokeServer/script/cpan_download	2009-05-30 13:12:59 UTC (rev 10389)
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# Dumbass minicpan replacement - Matt S Trout 2005/6. Perl license.
+
+# Modified to retrieve and extract dists that depend on Catalyst-Runtime
+# - Rafael Kitover (May 29 2009)
+
+# Pick one from http://cpan.org/SITES.html#RSYNC
+
+REMOTEHOST='mirror.facebook.com'
+REMOTEPREFIX='cpan'
+
+LOCAL=$(perl -MFile::Basename=dirname -MCwd=abs_path -le 'print abs_path(dirname("'$0'")."/../cpan")')
+
+mkdir $LOCAL 2>/dev/null
+
+cd $LOCAL
+
+mkdir -p work authors/id modules
+
+rsync $REMOTEHOST::"$REMOTEPREFIX/modules/03modlist.data.gz $REMOTEPREFIX/modules/02packages.details.txt.gz" modules/
+
+zcat modules/02packages.details.txt.gz | egrep '\.(tar\.gz|tgz|zip)$' | egrep -v '/((perl-|parrot-|ponie-)[0-9]|perl5\.004)' | awk '{print $3}' | sort -u >work/available.dists
+
+perl -MWWW::Mechanize -le '
+    my $mech = WWW::Mechanize->new(stack_depth => 0);
+    $mech->get("http://cpants.perl.org/dist/used_by/Catalyst-Runtime");
+    my %cat_dists = map { $_->text => 1 }
+        $mech->find_all_links(url_regex => qr{^/dist/overview/(?!Catalyst-Runtime).*});
+    while (<>) {
+        chomp;
+        my ($dist) = m{/([^/]+)-\d};
+        print if exists $cat_dists{$dist};
+    }
+' < work/available.dists > work/catalyst.dists
+
+cat work/catalyst.dists | cut -d'/' -f1-3 | sort -u | perl -pe 's!$!/CHECKSUMS!;' >work/catalyst.checksums
+
+cat work/catalyst.dists | perl -pe 's!/[^/]+$!\n!;' >work/catalyst.dirs
+
+cd $LOCAL/authors/id
+
+cat $LOCAL/work/catalyst.dirs | xargs -n100 mkdir -p
+
+cat $LOCAL/work/catalyst.checksums | xargs -n100 touch
+
+cat $LOCAL/work/catalyst.dists | xargs -n100 touch
+
+cd $LOCAL
+
+rsync -vr --size-only --existing $REMOTEHOST::"$REMOTEPREFIX/authors/" authors/
+
+find authors/id -name '*.*' | perl -pe 's!^authors/id/!!;' | sort -u >work/tree.all
+
+sort -u work/catalyst.* | comm -13 - work/tree.all | perl -pe 's!^!authors/id/!;' | xargs rm -v 2>/dev/null
+
+# extract
+
+mkdir extracted 2>/dev/null
+cd extracted
+rm -rf *
+
+find authors/id -name '*.zip'    | while read f; do (cd extracted; unzip ../$f  ); done
+find authors/id -name '*.tar.gz' | while read f; do (cd extracted; tar zxf ../$f); done

Deleted: trunk/examples/SmokeServer/script/cpan_download.pl
===================================================================
--- trunk/examples/SmokeServer/script/cpan_download.pl	2009-05-30 10:57:32 UTC (rev 10388)
+++ trunk/examples/SmokeServer/script/cpan_download.pl	2009-05-30 13:12:59 UTC (rev 10389)
@@ -1,64 +0,0 @@
-#!/bin/sh
-
-# Dumbass minicpan replacement - Matt S Trout 2005/6. Perl license.
-
-# Modified to retrieve and extract dists that depend on Catalyst-Runtime
-# - Rafael Kitover (May 29 2009)
-
-# Pick one from http://cpan.org/SITES.html#RSYNC
-
-REMOTEHOST='mirror.facebook.com'
-REMOTEPREFIX='cpan'
-
-LOCAL=$(perl -MFile::Basename=dirname -MCwd=abs_path -le 'print abs_path(dirname("'$0'")."/../cpan")')
-
-mkdir $LOCAL 2>/dev/null
-
-cd $LOCAL
-
-mkdir -p work authors/id modules
-
-rsync $REMOTEHOST::"$REMOTEPREFIX/modules/03modlist.data.gz $REMOTEPREFIX/modules/02packages.details.txt.gz" modules/
-
-zcat modules/02packages.details.txt.gz | egrep '\.(tar\.gz|tgz|zip)$' | egrep -v '/((perl-|parrot-|ponie-)[0-9]|perl5\.004)' | awk '{print $3}' | sort -u >work/available.dists
-
-perl -MWWW::Mechanize -le '
-    my $mech = WWW::Mechanize->new(stack_depth => 0);
-    $mech->get("http://cpants.perl.org/dist/used_by/Catalyst-Runtime");
-    my %cat_dists = map { $_->text => 1 }
-        $mech->find_all_links(url_regex => qr{^/dist/overview/(?!Catalyst-Runtime).*});
-    while (<>) {
-        chomp;
-        my ($dist) = m{/([^/]+)-\d};
-        print if exists $cat_dists{$dist};
-    }
-' < work/available.dists > work/catalyst.dists
-
-cat work/catalyst.dists | cut -d'/' -f1-3 | sort -u | perl -pe 's!$!/CHECKSUMS!;' >work/catalyst.checksums
-
-cat work/catalyst.dists | perl -pe 's!/[^/]+$!\n!;' >work/catalyst.dirs
-
-cd $LOCAL/authors/id
-
-cat $LOCAL/work/catalyst.dirs | xargs -n100 mkdir -p
-
-cat $LOCAL/work/catalyst.checksums | xargs -n100 touch
-
-cat $LOCAL/work/catalyst.dists | xargs -n100 touch
-
-cd $LOCAL
-
-rsync -vr --size-only --existing $REMOTEHOST::"$REMOTEPREFIX/authors/" authors/
-
-find authors/id -name '*.*' | perl -pe 's!^authors/id/!!;' | sort -u >work/tree.all
-
-sort -u work/catalyst.* | comm -13 - work/tree.all | perl -pe 's!^!authors/id/!;' | xargs rm -v 2>/dev/null
-
-# extract
-
-mkdir extracted 2>/dev/null
-cd extracted
-rm -rf *
-
-find authors/id -name '*.zip'    | while read f; do (cd extracted; unzip ../$f  ); done
-find authors/id -name '*.tar.gz' | while read f; do (cd extracted; tar zxf ../$f); done

Modified: trunk/examples/SmokeServer/script/cpan_installdeps.pl
===================================================================
--- trunk/examples/SmokeServer/script/cpan_installdeps.pl	2009-05-30 10:57:32 UTC (rev 10388)
+++ trunk/examples/SmokeServer/script/cpan_installdeps.pl	2009-05-30 13:12:59 UTC (rev 10389)
@@ -11,14 +11,10 @@
 
 my $dir = "$Bin/../cpan/extracted";
 
-opendir my($dists), $dir;
+opendir my($dists), $dir
+    or die "run $Bin/cpan_download first\n";
 
 my @dists = grep !/^\.\.?\z/, readdir $dists;
-my @dist_names = @dists;
-s/-\d.*// for @dist_names;
-my %dists;
- at dists{@dist_names} = @dists;
-
 closedir $dists;
 
 # set up CPAN
@@ -50,7 +46,7 @@
 $CPAN::Config->{buildpl_arg} = '--install_path libdoc="" --install_path bindoc=""';
 
 for my $dist (@dists) {
-    chdir "$dir/$dist";
+    chdir "$dir/$dist" or die $!;
 
 # stolen from confound at https://trac.opensourcery.com/public/elementalclinic/browser/trunk/build_scripts/deps/install
     my $d = CPAN::Shell->expandany("$dir/$dist/.");
@@ -60,7 +56,8 @@
         CPAN::Shell->notest(install => $name);
     }
 
-    system "make realclean >/dev/null 2>&1";
+    (system "make realclean >/dev/null 2>&1" == 0)
+        or die "make realclean in $dir/$dist failed";
 }
 
 print "************ DONE ***************\n";

Added: trunk/examples/SmokeServer/script/cpan_smoke.pl
===================================================================
--- trunk/examples/SmokeServer/script/cpan_smoke.pl	                        (rev 0)
+++ trunk/examples/SmokeServer/script/cpan_smoke.pl	2009-05-30 13:12:59 UTC (rev 10389)
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use FindBin qw($Bin);
+use lib "$Bin/../lib";
+use lib 'lib'; # in dist dirs
+use Test::TAP::Model;
+use Test::TAP::Model::Smoke;
+use File::Find::Rule;
+use IO::Handle;
+
+die("$0 http://smokeserver:3000\n") unless scalar(@ARGV);
+my $uri = shift;
+
+my $dir = "$Bin/../cpan/extracted";
+
+opendir my($dists), $dir
+    or die "run $Bin/cpan_download && $Bin/cpan_installdeps.pl first\n";
+
+my @dists = grep !/^\.\.?\z/, readdir $dists;
+my @dist_names = @dists;
+s/-\d.*// for @dist_names;
+my %dists;
+ at dists{@dist_names} = @dists;
+closedir $dists;
+
+open my $log, '>', "$Bin/../cpan_smoke.log" or die $!;
+$log->autoflush(1);
+
+for my $dist (@dist_names) {
+    my $dist_dir = $dists{$dist};
+    chdir "$dir/$dist_dir" or die $!;
+
+    my ($dist_version) = $dist_dir =~ /^${dist}-(.*)/;
+
+    my @test_files = File::Find::Rule->file->name('*.t')->in('t/');
+
+    print "*** Now testing $dist version $dist_version\n";
+
+    my $model  = Test::TAP::Model->new_with_tests(@test_files);
+
+    print $log (($model->ok ? 'PASS' : 'FAIL') . " $dist $dist_version "
+        . $model->ratio . "\n");
+
+    my $report = Test::TAP::Model::Smoke->new($model,
+        "cpan.$dist",
+        "cpan.$dist.$dist_version"
+    );
+
+    my $result = $report->upload($uri . "/upload");
+
+    unless ($result->code == 200 && $result->content eq 'OK') {
+        warn("Error " . $result->content . "\n");
+        exit 1;
+    }
+}
+
+print "************** DONE ****************\n";


Property changes on: trunk/examples/SmokeServer/script/cpan_smoke.pl
___________________________________________________________________
Name: svn:executable
   + *




More information about the Catalyst-commits mailing list