Here's another patch to fix up the bug/support/patches/rfe count extraction, and a new test '6.tracker.t' to test it.
Bryce
On Wed, Nov 16, 2005 at 11:25:44AM -0800, Bryce Harrington wrote:
Hi Kang-min,
I don't know if you noticed, but SourceForge changed their look and feel yesterday. Unfortunately, this had the effect of breaking WWW::SourceForge rather severely. Attached is a patch that partially fixes up WWW::SourceForge::Project.
This fixes the loading of the description, detection of invalid projects, and the MailingList code. It doesn't fix the admin listing though, so you will want to look at that. With these changes, tests 1, 2, and 4 now work, but 3 does not.
I'm also attaching a new test file for you for the MailingList code, 5.mailstats.t. I figured this breakage was a good opportunity to write tests. ;-)
Anyway, hope this helps. Thanks again for the module! Bryce
On Wed, Aug 31, 2005 at 10:19:06AM +0800, Kang-min Liu wrote:
On 8/20/05, Bryce Harrington <bryce@...1...> wrote:
Hi Kang-min,
I noticed when installing WWW::SourceForge through cpan, that it fails to install due to one of the tests that requires YAML.pm. Below is a little patch that adds this as a requirement to the Makefile.PL:
Thank you :)
Btw, what I'm working on is a perl module for downloading files out of the SourceForge file tracker. We need an ability to automatically download new versions of packages we use for testing (such as the monthly LTP releases), but SourceForge's mirror system has made this a convoluted process. (I want to try to design my module to be compatible with yours so users could use both together if they want.)
This is one thing wanted in WWW::SourceForge. I didn't write such feature. If you're willing to do it, maybe we should put a releases() method in WWW::SourceForge::Project.
But,IMHO, for the new-releases polling, I suggest that you put this into another module, like POE::Component::SourceForge or something, and let WWW::SourceForge be only a front-end to the website.
-- ??? Cheers, Kang-min Liu
--- WWW-SourceForge-0.09/lib/WWW/SourceForge/Project.pm 2005-10-06 20:07:01.000000000 -0700 +++ WWW-SourceForge-0.09-patched/lib/WWW/SourceForge/Project.pm 2005-11-16 10:53:13.000000000 -0800 @@ -47,18 +47,34 @@ my $proj; my $wa = WWW::Mechanize->new( autocheck => 1); $wa->get($url);
- my $content = $wa->content;
my $content = $wa->content or die "Could not retrieve content from '$url'\n";
# Wrong project unixname ? if($content =~ m{<H2><font color="#FF3333">Invalid Project</font></H2>}i) {
return;
warn "Invalid project '$pname'\n";
return undef;
} elsif ($content =~ m{<H2 class="error">Invalid Project</H2>}i) {
warn "Invalid project '$pname'\n";
return undef;
}
# Project description
- my ($desc,$meta) = $content =~ m{<HR SIZE="1" NoShade><BR>
-[\s\n]*<TABLE WIDTH="100%" BORDER="0"> -[\s\n]*<TR><TD WIDTH="99%" VALIGN="top"> -[\s\n]*<p>(.+?)<UL>(.+?)</UL>}s;
my ($desc) = $content =~ m{<div class="tbox">
<h3>About .+?</h3>
</div>
<b class="tbtm"><b class="t2 tbg"></b><b class="t1 tbg"></b></b>
</div>
<p>
(.+?)
</p>}is;
# TODO
# my ($meta) = $content =~ m{}s;
if (! $desc) { warn $content; }
die "Could not recognize project page format - has SF changed its layout?\n" unless $desc;
--- WWW-SourceForge-0.09-patched/lib/WWW/SourceForge/Project.pm 2005-11-16 11:44:52.000000000 -0800 +++ WWW-SourceForge-0.09/lib/WWW/SourceForge/Project.pm 2005-10-06 20:07:01.000000000 -0700 @@ -47,34 +47,18 @@ my $proj; my $wa = WWW::Mechanize->new( autocheck => 1); $wa->get($url); - my $content = $wa->content or die "Could not retrieve content from '$url'\n"; + my $content = $wa->content;
# Wrong project unixname ? if($content =~ m{<H2><font color="#FF3333">Invalid Project</font></H2>}i) { - warn "Invalid project '$pname'\n"; - return undef; - } elsif ($content =~ m{<H2 class="error">Invalid Project</H2>}i) { - warn "Invalid project '$pname'\n"; - return undef; + return; }
- - # Project description - my ($desc) = $content =~ m{<div class="tbox"> - <h3>About .+?</h3> - </div> - <b class="tbtm"><b class="t2 tbg"></b><b class="t1 tbg"></b></b> - </div> - <p> - (.+?) - - </p>}is; - - # TODO - # my ($meta) = $content =~ m{}s; - - if (! $desc) { warn $content; } + my ($desc,$meta) = $content =~ m{<HR SIZE="1" NoShade><BR> +[\s\n]*<TABLE WIDTH="100%" BORDER="0"> +[\s\n]*<TR><TD WIDTH="99%" VALIGN="top"> +[\s\n]*<p>(.+?)<UL>(.+?)</UL>}s;
die "Could not recognize project page format - has SF changed its layout?\n" unless $desc; @@ -99,20 +83,11 @@ }
# Parse Track Numbers -# @$proj{'Homepage'} = $content =~ m{<!-- end sub section title--><A href="(.+?)"> Project Home Page</A>}s; - - @$proj{'oBugs','nBugs'} = $content =~ m{Bugs</a> - <span> - : (([\d,]+?) open / ([\d,]+?) total)}is; - @$proj{'oSupports','nSupports'} = $content =~ m{Support Requests</a> - <span> - : (([\d,]+?) open / ([\d,]+?) total)}; - @$proj{'oPatches','nPatches'} = $content =~ m{Patches</a> - <span> - : (([\d,]+?) open / ([\d,]+?) total)}; - @$proj{'oFeatures','nFeatures'} = $content =~ m{Feature Requests</a> - <span> - : (([\d,]+?) open / ([\d,]+?) total)}; + @$proj{'Homepage'} = $content =~ m{<!-- end sub section title--><A href="(.+?)"> Project Home Page</A>}s; + @$proj{'oBugs','nBugs'} = $content =~ m{Bugs</A>\s+( <B>(\d+?) open / (\d+?) total</B> )}; + @$proj{'oSupports','nSupports'} = $content =~ m{Requests</A>\s+( <B>(\d+?) open / (\d+?) total</B> )<BR>}; + @$proj{'oPatches','nPatches'} = $content =~ m{Patches</A>\s+( <B>(\d+?) open / (\d+?) total</B> )<BR>}; + @$proj{'oFeatures','nFeatures'} = $content =~ m{Feature Requests</A>\s+( <B>(\d+) open / (\d+) total</B> )};
# Parse Admin my @admin;
----- End forwarded message -----
On Nov 22, 2005, at 7:24 AM, Bryce Harrington wrote:
Here's another patch to fix up the bug/support/patches/rfe count extraction, and a new test '6.tracker.t' to test it.
Bryce
Hello, Bryce
Thanks for your work again. But I didn't see the test '6.tracker.t' attached. Maybe you forgot to actually attach it ?
Cheers, Kang-min Liu
Ah, sorry, yes you're right; I've attached the patches and tests.
Bryce
On Tue, Nov 22, 2005 at 08:54:17PM +0800, Kang-min Liu wrote:
On Nov 22, 2005, at 7:24 AM, Bryce Harrington wrote:
Here's another patch to fix up the bug/support/patches/rfe count extraction, and a new test '6.tracker.t' to test it.
Bryce
Hello, Bryce
Thanks for your work again. But I didn't see the test '6.tracker.t' attached. Maybe you forgot to actually attach it ?
Cheers, Kang-min Liu
participants (2)
-
Bryce Harrington
-
Kang-min Liu