[perl-DBD-AnyData] fix build for now
Tom Callaway
spot at fedoraproject.org
Thu Feb 27 16:46:03 UTC 2014
commit 96acfec02695c9fcfef8215ad11a08df4b0fffef
Author: Tom Callaway <spot at fedoraproject.org>
Date: Thu Feb 27 11:46:50 2014 -0500
fix build for now
DBD-AnyData-0.110-use-DBD-File.patch | 434 ++++++++++++++++++++++++++++++++++
perl-DBD-AnyData.spec | 17 +-
2 files changed, 447 insertions(+), 4 deletions(-)
---
diff --git a/DBD-AnyData-0.110-use-DBD-File.patch b/DBD-AnyData-0.110-use-DBD-File.patch
new file mode 100644
index 0000000..cae4bc6
--- /dev/null
+++ b/DBD-AnyData-0.110-use-DBD-File.patch
@@ -0,0 +1,434 @@
+diff -up DBD-AnyData-0.110/lib/DBD/AnyData.pm.old DBD-AnyData-0.110/lib/DBD/AnyData.pm
+--- DBD-AnyData-0.110/lib/DBD/AnyData.pm.old 2010-07-17 02:33:53.000000000 -0400
++++ DBD-AnyData-0.110/lib/DBD/AnyData.pm 2014-02-27 11:27:48.429612061 -0500
+@@ -1,7 +1,10 @@
+ #########################################################################
+ # DBD::AnyData - a DBI driver for files and data structures
+ #
+-# This module is copyright (c), 2001 by Jeff Zucker
++# This module is copyright (c)
++# 2001 by Jeff Zucker
++# 2010 by Jens Rehsack
++# 2014 by Lucio Iacolettig
+ # All rights reserved.
+ #
+ # This is free software. You may distribute it under
+@@ -21,48 +24,20 @@ use strict;
+ use warnings;
+
+ use AnyData;
+-require DBI::DBD::SqlEngine;
+-use base qw(DBI::DBD::SqlEngine);
+-require SQL::Statement;
+-require SQL::Eval;
++require DBD::File;
++our @ISA = qw( DBD::File );
+
+-use vars qw($VERSION $err $errstr $sqlstate $drh $methods_already_installed);
++use vars qw(@ISA $VERSION $ATTRIBUTION $drh $err $errstr $sqlstate);
+
+-$VERSION = '0.110';
++$VERSION = '0.111';
++$ATTRIBUTION = "DBD::AnyData $DBD::AnyData::VERSION by Jeff Zucker, Jens
++Rehsack, Lucio Iacolettig";
+
+ $err = 0; # holds error code for DBI::err
+ $errstr = ""; # holds error string for DBI::errstr
+ $sqlstate = ""; # holds SQL state for DBI::state
+ $drh = undef; # holds driver handle once initialized
+
+-sub driver
+-{
+- my ( $class, $attr ) = @_;
+- return $drh if $drh; # already created - return same one
+- $drh = $class->SUPER::driver(
+- {
+- 'Name' => 'AnyData',
+- 'Version' => $VERSION,
+- 'Err' => \$DBD::AnyData::err,
+- 'Errstr' => \$DBD::AnyData::errstr,
+- 'State' => \$DBD::AnyData::sqlstate,
+- 'Attribution' => 'DBD::AnyData by Jens Rehsack',
+- }
+- );
+-
+- unless ( $methods_already_installed++ )
+- {
+- DBD::AnyData::db->install_method('ad_import');
+- DBD::AnyData::db->install_method('ad_catalog');
+- DBD::AnyData::db->install_method('ad_convert');
+- DBD::AnyData::db->install_method('ad_export');
+- DBD::AnyData::db->install_method('ad_clear');
+- DBD::AnyData::db->install_method('ad_dump');
+- }
+-
+- return $drh;
+-}
+-
+ sub CLONE
+ {
+ undef $drh;
+@@ -73,19 +48,17 @@ package DBD::AnyData::dr; # ====== DR
+ use strict;
+ use warnings;
+
+-use vars qw($imp_data_size);
+-
+-$DBD::AnyData::dr::imp_data_size = 0;
+- at DBD::AnyData::dr::ISA = qw(DBI::DBD::SqlEngine::dr);
++use vars qw(@ISA);
+
+-sub disconnect_all
+-{
+- shift->{ad_tables} = {};
+-}
+-
+-sub DESTROY
+-{
+- shift->{ad_tables} = {};
++our $imp_data_size = 0;
++our @ISA = qw(DBD::File::dr);
++our $data_sources_attr = undef;
++
++sub connect {
++ my ($drh, $dbname, $user, $auth, $attr) = @_;
++ my $dbh = $drh->DBD::File::dr::connect ($dbname, $user, $auth, $attr);
++ $dbh->{Active} = 1;
++ $dbh;
+ }
+
+ package DBD::AnyData::db; # ====== DATABASE ======
+@@ -93,13 +66,11 @@ package DBD::AnyData::db; # ====== DA
+ use strict;
+ use warnings;
+
+-use vars qw($imp_data_size);
+-
+ require Cwd;
+ require File::Spec;
+
+-$DBD::AnyData::db::imp_data_size = 0;
+- at DBD::AnyData::db::ISA = qw(DBI::DBD::SqlEngine::db);
++our $imp_data_size = 0;
++our @ISA = qw(DBD::File::db);
+
+ sub init_default_attributes
+ {
+@@ -115,9 +86,9 @@ sub init_default_attributes
+
+ sub set_versions
+ {
+- my $this = $_[0];
+- $this->{ad_version} = $DBD::AnyData::VERSION;
+- return $this->SUPER::set_versions();
++ my $self = shift;
++ $self->{ad_version} = $DBD::AnyData::VERSION;
++ return $self->SUPER::set_versions();
+ }
+
+ sub disconnect
+@@ -210,33 +181,23 @@ sub ad_export
+ #use Data::Dumper; print Dumper $catalog;
+ if ( $catalog->{format} && 'XML HTMLtable' =~ /$catalog->{format}/ )
+ {
+- #use Data::Dumper; print "!",Dumper $catalog; exit;
+ my $sth = $dbh->prepare("SELECT 1 FROM $table_name") or die DBI->errstr;
+ $sth->execute; # or die DBI->errstr;
+-###z return $catalog->{ad}->export($format,$file_name,$flags) if 'XML HTMLtable' =~ /$format/;
+ return $catalog->{ad}->export( $file_name, $flags ) if 'XML HTMLtable' =~ /$format/;
+ $data = $dbh->selectall_arrayref("SELECT * FROM $table_name");
+- #my $sth = $dbh->prepare("SELECT * FROM $table_name");
+- #$sth->execute;
+- #unshift @$data, $sth->{NAME};
+ }
+ else
+ {
+- #z $data = $dbh->func($table_name,'ad_get_catalog')->{records};
+ my $sth = $dbh->prepare("SELECT * FROM $table_name WHERE 1=0");
+ $sth->execute;
+ $data = $catalog->{ad}->{storage}->{records};
+ }
+ $data = $dbh->selectall_arrayref("SELECT * FROM $table_name")
+ if $format =~ /XML|HTMLtable/;
+- #use Data::Dumper;
+- #die Dumper $data;
+- # print Dumper $dbh->func( $table_name,'ad_get_catalog');
+
+ my $newcols = $dbh->func( $table_name, 'ad_get_catalog' )->{ad}->{storage}->{col_names};
+ unshift @$data, $newcols if $newcols;
+ return AnyData::adConvert( 'Base', $data, $format, $file_name, undef, $flags );
+- # return AnyData::adExport({},$format,$data,$file_name,undef,$flags);
+ }
+
+ sub ad_convert
+@@ -274,7 +235,6 @@ sub ad_import
+ $old_columns = $sth->{NAME};
+ }
+ my $sql = $flags->{sql} || "SELECT * FROM $table_name";
+- # die $sql;
+ my @params = $flags->{params} || ();
+ if ( 'XML HTMLtable' =~ /$format/ )
+ {
+@@ -288,21 +248,17 @@ sub ad_import
+ {
+ $flags->{recs} = $file_name;
+ $flags->{storage} = 'RAM';
+- #$flags->{col_names} =$old_columns if $old_columns;
+ $dbh->func( $table_name, $format, '', $flags, 'ad_catalog' );
+ }
+ else
+ {
+ $dbh->func( $table_name, $format, $file_name, $flags, 'ad_catalog' );
+- #$dbh->func(@_,'ad_catalog');
+ }
+ my $dbh2 = $dbh;
+ $dbh2 = $file_name if $format eq 'DBI';
+ my $sth = $dbh2->prepare($sql) or die DBI->errstr;
+- # die "$sql";
+ $sth->execute(@params) or die DBI->errstr;
+ my $cols = $sth->{NAME} or die DBI->errstr;
+- # die @$cols;
+ my $records;
+ if ($old_records)
+ {
+@@ -337,7 +293,6 @@ sub ad_import
+ }
+ if ($dup)
+ {
+- #print "@tmp";
+ $dbh->do("DELETE FROM temp__ WHERE $lookup = $val")
+ or die DBI->errstr;
+ }
+@@ -366,7 +321,6 @@ sub ad_import
+ delete $flags->{recs};
+ delete $flags->{storage};
+ delete $flags->{format};
+- #$flags = {} if 'XML HTMLtable' =~ /$format/;
+ if ( 'XML HTMLtable' =~ /$format/ )
+ {
+ delete $flags->{ad};
+@@ -452,7 +406,6 @@ sub ad_dump
+ }
+
+ # END OF DRIVER PRIVATE METHODS
+-
+ sub get_avail_tables
+ {
+ my $dbh = $_[0];
+@@ -483,26 +436,48 @@ package DBD::AnyData::st; # ====== ST
+ use strict;
+ use warnings;
+
+-use vars qw($imp_data_size);
+-
+-$DBD::AnyData::st::imp_data_size = 0;
+- at DBD::AnyData::st::ISA = qw(DBI::DBD::SqlEngine::st);
+-
+-# sub DESTROY ($) { undef; }
+-
+-# sub finish ($) {}
++our $imp_data_size = 0;
++our @ISA = qw(DBD::File::st);
+
+ package DBD::AnyData::Statement;
++use strict;
++use warnings;
++use Carp;
++
++our @ISA = qw(DBD::File::Statement);
+
++# Table Class
++package DBD::AnyData::Table;
+ use strict;
+ use warnings;
++use Carp;
++
++our @ISA = qw(DBD::File::Table);
++
++sub bootstrap_table_meta
++{
++ my ( $self, $dbh, $meta, $table ) = @_;
++
++ $meta->{ad_class} ||= $dbh->{ad_class} || 'AnyData';
++ $meta->{ad_eol} ||= $dbh->{ad_eol} || "\n";
++ $self->SUPER::bootstrap_table_meta ( $dbh, $meta, $table );
++}
+
+- at DBD::AnyData::Statement::ISA = qw(DBI::DBD::SqlEngine::Statement);
++sub init_table_meta
++{
++ my ( $self, $dbh, $meta, $table ) = @_;
++ $self->SUPER::init_table_meta ( $dbh, $table, $meta );
++ $meta->{dbh} = $dbh;
++}
+
+-sub open_table ($$$$$)
++sub open_data
+ {
+- my ( $self, $data, $tname, $createMode, $lockMode ) = @_;
+- my $dbh = $data->{Database};
++ my ( $self, $meta, $attrs, $flags ) = @_;
++ my $dbh = $meta->{dbh};
++ my $tname = $meta->{table_name};
++ my $createMode = $flags->{createMode};
++ my $lockMode = $flags->{lockMode};
++
+ my $catalog = $dbh->func( $tname, 'ad_get_catalog' );
+ if ( !$catalog )
+ {
+@@ -520,14 +495,10 @@ sub open_table ($$$$$)
+ # || AnyData::adTable( $format, $file, $createMode, $lockMode,
+ # $catalog );
+ || AnyData::adTable( $format, $file, $createMode, $lockMode, $catalog, $tname );
+- #print join("\n", $format,@$file,$createMode), "\n";
+- #use Data::Dumper; print Dumper $catalog;
+- #################################################################
+ my $table = $ad->prep_dbd_table( $tname, $createMode );
+ my $cols = $table->{col_names};
+ if ( $cols and ref $cols ne 'ARRAY' )
+ {
+- #$dbh->DBI::set_err(99, "\n $cols\n ");
+ print "\n $cols\n ";
+ exit;
+ }
+@@ -539,25 +510,8 @@ sub open_table ($$$$$)
+ $dbh->func( $tname, 'ad', $ad, 'ad_mod_catalog' );
+ }
+
+- return DBD::AnyData::Table->new($table);
+-}
+-
+-package DBD::AnyData::Table;
+-
+-use strict;
+-use warnings;
+-
+-use Params::Util qw(_HASH0);
+-
+- at DBD::AnyData::Table::ISA = qw(DBI::DBD::SqlEngine::Table);
+-
+-sub new
+-{
+- my ( $proto, $attr ) = @_;
+- $attr->{col_names} = $attr->{ad}->{storage}->{col_names};
+- $attr->{col_nums} = $attr->{ad}->{storage}->{col_nums};
+- delete $attr->{col_nums} unless ( defined( $attr->{col_nums} ) and defined( _HASH0( $attr->{col_nums} ) ) );
+- return $proto->SUPER::new($attr);
++ $meta->{ad} = $ad;
++ $meta->{col_names} = $cols;
+ }
+
+ sub trim
+@@ -573,7 +527,7 @@ sub fetch_row ($$$)
+ my ( $self, $data, $row ) = @_;
+ my $requested_cols = $data->{sql_stmt}->{NAME};
+ my $dbh = $data->{Database};
+- my $fields = $self->{ad}->fetch_row($requested_cols);
++ my $fields = $self->{meta}->{ad}->fetch_row($requested_cols);
+ if ( $dbh->{ChopBlanks} )
+ {
+ @$fields = map( $_ = &trim($_), @$fields );
+@@ -585,8 +539,7 @@ sub fetch_row ($$$)
+ sub push_names ($$$)
+ {
+ my ( $self, $data, $names ) = @_;
+- #print @$names;
+- $self->{ad}->push_names($names);
++ $self->{meta}->{ad}->push_names($names);
+ }
+
+ sub push_row ($$$)
+@@ -594,38 +547,46 @@ sub push_row ($$$)
+ my ( $self, $data, $fields ) = @_;
+ my $requested_cols = [];
+ my @rc = $data->{sql_stmt}->columns();
++
++ # PATCH: If the value is undefined initialize to avoid field shift (LI 2013-01-13)
++ map {
++ unless(defined($_)) {
++ $_ = '';
++ }
++ } @{$fields};
++
+ push @$requested_cols, $_->{column} for @rc;
+ unshift @$fields, $requested_cols;
+- $self->{ad}->push_row(@$fields);
++ $self->{meta}->{ad}->push_row(@$fields);
++
+ 1;
+ }
+
+ sub seek ($$$$)
+ {
+ my ( $self, $data, $pos, $whence ) = @_;
+- $self->{ad}->seek( $pos, $whence );
++ $self->{meta}->{ad}->seek( $pos, $whence );
+ }
+
+ sub drop ($$)
+ {
+ my ( $self, $data ) = @_;
+- return $self->{ad}->drop();
++ return $self->{meta}->{ad}->drop();
+ }
+
+ sub truncate ($$)
+ {
+ my ( $self, $data ) = @_;
+- $self->{ad}->truncate($data);
++ $self->{meta}->{ad}->truncate( $data );
+ }
+
+ sub DESTROY
+ {
+- # wierd: this is needed to close file handle ???
++ # weird: this is needed to close file handle ???
+ my $self = shift;
+- #print "CLOSING" if $self->{ad}->{storage}->{fh};
+- my $fh = $self->{ad}->{storage}->{fh} or return;
+- $self->{ad}->DESTROY;
+- undef $self->{ad}->{storage}->{fh};
++ my $fh = $self->{meta}->{ad}->{storage}->{fh} or return;
++ $self->{meta}->{ad}->DESTROY;
++ undef $self->{meta}->{ad}->{storage}->{fh};
+ }
+
+ =head1 NAME
+@@ -691,7 +652,7 @@ Here a just a few examples of the capabi
+ # SELECT DATA FROM A PASSWD FILE
+ #
+ $dbh->func( 'users', 'Passwd', '/etc/passwd', 'ad_catalog');
+- my $sth = $dbh->prepare("SELECT username,homedir,GID FROM users');
++ my $sth = $dbh->prepare('SELECT username,homedir,GID FROM users');
+
+ # INSERT A NEW ROW INTO A CSV FILE
+ #
+@@ -719,13 +680,13 @@ Here a just a few examples of the capabi
+ To use DBD::AnyData you will need to install these modules,
+ all available from CPAN and most available from activeState.
+
+- * DBI
+- * DBI::DBD::SqlEngine
+- * SQL::Statement
+- * AnyData
+- * DBD::AnyData
++ * DBI >= 1.623
++ * DBD::File
++ * SQL::Statement >= 1.27
++ * AnyData >= 0.10
++ * DBD::AnyData >= 0.20
+
+-Note: DBI::DBD::SqlEngine is part of the DBI distribution
++Note: DBD::File is part of the DBI distribution
+
+ Some advanced features require additional modules:
+
+@@ -1776,6 +1737,8 @@ Copyright 2000, Jeff Zucker <jeff at vpserv
+
+ Copyright 2010, Jens Rehsack <rehsack at cpan.org>
+
++Copyright 2014, Lucio Iacolettig <liacolettig at over-log.it>
++
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of either: the GNU General Public License as published
+ by the Free Software Foundation; or the Artistic License.
diff --git a/perl-DBD-AnyData.spec b/perl-DBD-AnyData.spec
index 118e6ab..f82ba83 100644
--- a/perl-DBD-AnyData.spec
+++ b/perl-DBD-AnyData.spec
@@ -1,25 +1,30 @@
Name: perl-DBD-AnyData
Summary: DBI access to XML, CSV and other formats
Version: 0.110
-Release: 9%{?dist}
+Release: 10%{?dist}
License: GPL+ or Artistic
Group: Development/Libraries
Source0: http://search.cpan.org/CPAN/authors/id/R/RE/REHSACK/DBD-AnyData-%{version}.tar.gz
+# This is the changes from Lucio Iacolettig, minus the whitespace changes
+# https://rt.cpan.org/Public/Bug/Display.html?id=92103
+Patch0: DBD-AnyData-0.110-use-DBD-File.patch
URL: http://search.cpan.org/dist/DBD-AnyData
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
BuildArch: noarch
BuildRequires: perl(AnyData) >= 0.07
-BuildRequires: perl(DBI) >= 1.611
+BuildRequires: perl(DBI) >= 1.623
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Module::Build) >= 0.36
BuildRequires: perl(Params::Util) >= 1.00
BuildRequires: perl(SQL::Statement) >= 1.27
BuildRequires: perl(Test::More) >= 0.9
+BuildRequires: perl(Test::Pod)
-Requires: perl(AnyData) >= 0.07
-Requires: perl(DBI) >= 1.611_93
+Requires: perl(AnyData) >= 0.10
+Requires: perl(DBD::File)
+Requires: perl(DBI) >= 1.623
Requires: perl(Params::Util) >= 1.00
Requires: perl(SQL::Statement) >= 1.27
@@ -34,6 +39,7 @@ sources.
%prep
%setup -q -n DBD-AnyData-%{version}
+%patch0 -p1 -b .filefix
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -60,6 +66,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Feb 27 2014 Tom Callaway <spot at fedoraproject.org> - 0.110-10
+- fix build now thanks to Lucio Iacolettig (proper upstream fix coming later, hopefully)
+
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.110-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
More information about the scm-commits
mailing list