Hi,

> * Moritz Mühlenhoff <muehlenh...@univention.de> [2011-02-14 10:27:55 CET]:
> > Am Montag 14 Februar 2011 04:24:35 schrieb John Lightsey:
> > > Yes, I can reproduce the FTBFS with 1.14. This was corrected upstream
> > > with 1.16 which is already in testing and unstable. The newer version
> > > doesn't include adjusted prices in any tests since Yahoo changes these
> > > periodically.
> >
> > I've cherrypicked the upstream test suite fixes from 1.16 and now the
> > build succeeds.
>
>  Moritz, can you name which upstream commits are needed to fix this?
>
>  John, what are your plans to get this fixed in squeeze? I just tested,
> the package still FTBFS in squeeze, and in the case of a potential
> needed security or otherwise related update, this *really* needs to get
> fixed for squeeze, too.

Hi Gerfried,

Patch is attached.

Cheers,
Moritz
-- 
Moritz Mühlenhoff                         muehlenh...@univention.de
Open Source Software Engineer and Consultant
Univention GmbH  Linux for Your Business     fon: +49 421 22 232- 0
Mary-Somerville-Str.1  28359 Bremen          fax: +49 421 22 232-99
http://www.univention.de
UCS bug 21410
Debian bug 612914

Backport testsuite fixes from 1.16 to fix build failure

diff -Nru libfinance-quotehist-perl-1.14/lib/Finance/QuoteHist/Yahoo.pm libfinance-quotehist-perl-1.14/lib/Finance/QuoteHist/Yahoo.pm
--- libfinance-quotehist-perl-1.14/lib/Finance/QuoteHist/Yahoo.pm	2010-06-08 01:51:31.000000000 +0200
+++ libfinance-quotehist-perl-1.14/lib/Finance/QuoteHist/Yahoo.pm	2010-09-21 00:43:19.000000000 +0200
@@ -126,75 +126,6 @@
   };
 }
 
-# Newer full-custom direct query for yahoo splits
-sub _splits_old {
-  my $self = shift;
-  my @symbols = @_ ? @_ : $self->symbols;
-  my $target_mode = 'split';
-  # cache check
-  my @not_seen;
-  foreach my $symbol (@symbols) {
-    my @r = $self->result_rows($target_mode, $symbol);
-    push(@not_seen, $symbol) unless @r;
-  }
-  # example URL: http://finance.yahoo.com/q/bc?s=IBM&t=my
-  foreach my $symbol (@not_seen) {
-    my $url = $self->url_base_splits() . "?s=$symbol&t=my";
-    print STDERR "Processing ($symbol:$target_mode) $url\n" if $self->{verbose};
-    my $data = $self->{url_cache}{$url} || $self->fetch($url);
-    $self->{url_cache}{$url} = $data;
-    print STDERR "Custom parse for ($symbol:$target_mode)\n" if $self->{verbose};
-    my $te = HTML::TableExtract->new(headers => ['Splits:'], debug => 5);
-    print STDERR "DATA: |||\n$data\n|||\n";
-    $te->parse($data);
-    my $table = $te->first_table_found;
-    print STDERR "TABLE: ", $table || 'undef', "\n";
-    if ($table) {
-      my($split_line) = grep(defined && /split/i, $table->hrow);
-      $split_line =~ s/^\s*splits:?\s*//i;
-      print STDERR "SPLIT LINE: ||| $split_line |||\n";
-      my @rows;
-      foreach (grep(/\w+/, split(/\]\s*,\s+/, $split_line))) {
-        s/\s+$//;
-        next if /none/i;
-        next unless s/\s*\[(\d+):(\d+).*$//;
-        my($post, $pre) = ($1, $2);
-        my $date = ParseDate($_)
-          or croak "Problem parsing date string '$_'\n";
-        push(@rows, [$date, $post, $pre]);
-      }
-      @rows = $self->rows(\@rows);
-      $self->_store_results($target_mode, $symbol, 0, \@rows);
-      $self->_target_source($target_mode, $symbol, ref $self);
-    }
-  }
-  my @rows = $self->result_rows($target_mode, @symbols);
-  wantarray ? @rows : \@rows;
-}
-
-# Not so direct splits query
-sub splits_alternate {
-  # An HTML quote query is the only way to go for splits on yahoo, so
-  # we have to signal to ourselves what the source mode should be so
-  # that the _urls() method will generate the proper URL...otherwise
-  # we would get CSV, which has no split info.
-  my $self = shift;
-  $self->save_query;
-  $self->parse_mode('html');
-  $self->start_date(undef, 0);
-  $self->end_date('today', 0);
-  $self->{quiet} = 1;
-  $self->target_mode('dividend');
-  my $rows = $self->dividends(@_);
-  if (!@$rows) {
-    $self->target_mode('quote');
-    $self->granularity('monthly');
-    $rows = $self->quotes(@_);
-  }
-  $self->restore_query;
-  $self->result_rows('split');
-}
-
 sub labels {
   my $self = shift;
   my %parms = @_;
diff -Nru libfinance-quotehist-perl-1.14/Makefile.PL libfinance-quotehist-perl-1.14/Makefile.PL
--- libfinance-quotehist-perl-1.14/Makefile.PL	2010-06-05 23:07:38.000000000 +0200
+++ libfinance-quotehist-perl-1.14/Makefile.PL	2010-09-21 00:22:42.000000000 +0200
@@ -7,7 +7,7 @@
   'HTML::TableExtract' => 2.07,
   'MIME::Base64'       => 0,
   'Regexp::Common'     => 0,
-  'Text::CSV_PP'       => 0,
+  'Text::CSV'          => 0,
 );
 
 eval "use Text::CSV_XS";
diff -Nru libfinance-quotehist-perl-1.14/t/10_quotes.t libfinance-quotehist-perl-1.14/t/10_quotes.t
--- libfinance-quotehist-perl-1.14/t/10_quotes.t	2010-06-07 23:30:29.000000000 +0200
+++ libfinance-quotehist-perl-1.14/t/10_quotes.t	2010-09-30 06:58:32.000000000 +0200
@@ -13,8 +13,8 @@
   for my $src (sources()) {
     for my $gran (granularities($src)) {
       SKIP: {
-        skip("skip developer $src-$gran test", 2)
-          unless DEV_TESTS || $src eq 'plain';
+        skip("(dev only) $src-$gran test", 2)
+          unless DEV_TESTS || $src eq GOLDEN_CHILD;
         my($m, $sym, $start, $end, $dat) = basis($src, 'quote', $gran);
         next unless $m;
         eval "use $m";
@@ -36,6 +36,8 @@
   my @rows = $q->quotes;
   cmp_ok(scalar @rows, '==', scalar @$dat, "$label (rows)");
   for my $i (0 .. $#rows) {
+    # drop adjusted quotes, too variable for testing
+    pop @{$rows[$i]} while @{$rows[$i]} > 7;
     $rows[$i] = join(':', @{$rows[$i]});
   }
   is_deeply(\@rows, $dat, "$label (content)");
diff -Nru libfinance-quotehist-perl-1.14/t/20_dividends.t libfinance-quotehist-perl-1.14/t/20_dividends.t
--- libfinance-quotehist-perl-1.14/t/20_dividends.t	2010-06-07 23:35:07.000000000 +0200
+++ libfinance-quotehist-perl-1.14/t/20_dividends.t	2010-09-30 06:58:42.000000000 +0200
@@ -14,8 +14,8 @@
     SKIP: {
       my($m, $sym, $start, $end, $dat) = basis($src, 'dividend');
       next unless $m;
-      skip("skip developer dividend $src test", 2)
-        unless DEV_TESTS || $src eq 'plain';
+      skip("(dev only) dividend $src test", 2)
+        unless DEV_TESTS || $src eq GOLDEN_CHILD;
       eval "use $m";
       my %parms = ( class => $m );
       dividend_cmp(
diff -Nru libfinance-quotehist-perl-1.14/t/30_splits.t libfinance-quotehist-perl-1.14/t/30_splits.t
--- libfinance-quotehist-perl-1.14/t/30_splits.t	2010-06-07 23:35:00.000000000 +0200
+++ libfinance-quotehist-perl-1.14/t/30_splits.t	2010-09-30 06:58:20.000000000 +0200
@@ -14,8 +14,8 @@
     SKIP: {
       my($m, $sym, $start, $end, $dat) = basis($src, 'split');
       next unless $m;
-      skip("skip developer split $src test", 2)
-        unless DEV_TESTS || $src eq 'plain';
+      skip("(dev only) split $src test", 2)
+        unless DEV_TESTS || $src eq GOLDEN_CHILD;
       eval "use $m";
       my %parms = ( class => $m );
       dividend_cmp(
diff -Nru libfinance-quotehist-perl-1.14/t/testload.pm libfinance-quotehist-perl-1.14/t/testload.pm
--- libfinance-quotehist-perl-1.14/t/testload.pm	2010-06-08 01:52:41.000000000 +0200
+++ libfinance-quotehist-perl-1.14/t/testload.pm	2010-09-30 06:53:55.000000000 +0200
@@ -10,6 +10,8 @@
 
 use constant DEV_TESTS => $ENV{FQH_DEV_TESTS};
 
+use constant GOLDEN_CHILD => 'yahoo';
+
 use vars qw( @ISA @EXPORT );
 
 require Exporter;
@@ -23,6 +25,7 @@
   granularities
   basis
   csv_content
+  GOLDEN_CHILD
   DEV_TESTS
 );
 
@@ -58,6 +61,14 @@
   my($sym, $start, $end) = split(/,/, shift @lines);
   if ($1 eq 'quote') {
     my($mode, $gran, $source) = split(/_/, $label);
+    if ($lines[0] =~ tr/:/:/ > 6) {
+      # drop adjusted, they've proven to be too variable for testing
+      for my $i (0 .. $#lines) {
+        my @line = split(/:/, $lines[$i]);
+        pop @line while @line > 7;
+        $lines[$i] = join(':', @line);
+      }
+    }
     $Files{$source}{$mode}{$gran} = [$class, $sym, $start, $end, \@lines];
   }
   else {

Reply via email to