diff --git a/DBD-XBase-0.241-dbfdump-rename.patch b/DBD-XBase-0.241-dbfdump-rename.patch new file mode 100644 index 0000000..2dca097 --- /dev/null +++ b/DBD-XBase-0.241-dbfdump-rename.patch @@ -0,0 +1,593 @@ +diff -ruN DBD-XBase-0.241-orig/bin/dbfdump.PL DBD-XBase-0.241/bin/dbfdump.PL +--- DBD-XBase-0.241-orig/bin/dbfdump.PL 2002-03-07 07:36:02.000000000 +0000 ++++ DBD-XBase-0.241/bin/dbfdump.PL 1970-01-01 01:00:00.000000000 +0100 +@@ -1,189 +0,0 @@ +- +-use Config; +-my $filename = $0; +- +-$filename =~ s/\.PL$//; +-open OUT,">$filename" or die "Can't create $filename: $!"; +-chmod(0755, $filename); +-print "Extracting $filename (with #! and variable substitution)\n"; +- +-print OUT <<"EOHEADER"; +-$Config{'startperl'} -w +- +-EOHEADER +- +-print OUT <<'EOBODY'; +- +-use XBase; +-use Getopt::Long; +-use strict; +-$^W = 1; +- +-my $stdin = 0; +- +-if (defined $ARGV[$#ARGV] and $ARGV[$#ARGV] eq '-') { +- $stdin = 1; pop @ARGV; +-} +- +-my %options; +-Getopt::Long::GetOptions( \%options, +- 'help', 'version', 'info', 'rs=s', 'fs=s', 'undef=s', 'fields=s', +- 'nomemo', 'memofile=s', 'memosep=s', 'table', +- 'SQL', +- ) or exit; +- +-if (defined $options{'version'}) { +- print "This is dbfdump version $XBase::VERSION.\n"; +- exit; +-} +- +-if ($stdin) { +- push @ARGV, '-'; +- $options{'nomemo'} = 1; +-} +- +-if (@ARGV == 0 or defined $options{'help'}) { +- die <<'EOF'; +-Usage: dbfdump [ options ] files +- where the options specify +- --rs output record separator (default newline) +- --fs output field separator (default colon) +- --fields comma separated list of fields to print (default all) +- --undef what to print for NULL values (default empty string) +- --memofile specifies unstandard name of attached memo file +- --memosep separator for dBase III dbt's (default \x1a\x1a) +- --table output in nice table format (needs Data::ShowTable) +- all having as parameter a string; and also +- --nomemo do not try to read the memo (dbt/fpt) file +- --info only print info about the file and fields +- --version print version of the XBase library +-EOF +-} +- +-my %addopts = (); +-if (defined $options{'nomemo'} or defined $options{'info'}) { +- $addopts{'ignorememo'} = 1; +-} +- +-$addopts{'memosep'} = $options{'memosep'}; +-$addopts{'memofile'} = $options{'memofile'}; +- +-if (defined $options{'info'}) { +- $addopts{'ignorebadheader'} = 1; +-} +- +-my $file; +-for $file (@ARGV) { +- my $table = new XBase 'name' => $file, %addopts; +- +- if (not defined $table) { +- print STDERR XBase->errstr; +- next; +- } +- if (defined $options{'info'}) { +- if (not defined $options{'SQL'}) { +- print $table->header_info; +- } else { +- my $name = $file; +- $name =~ s!^.*/|\.dbf$!!ig; +- print "create table $name (\n"; +- my @names = $table->field_names; +- my %conv = qw! +- C varchar +- N numeric +- F numeric +- L boolean +- M blob +- D date +- T time +- !; +- my @types = map { $conv{$_} } $table->field_types; +- my @lengths = $table->field_lengths; +- my @decimals = $table->field_decimals; +- for (my $i = 0; $i < @names; $i++) { +- print "\t$names[$i] $types[$i]"; +- if ($types[$i] eq 'blob') { +- $lengths[$i] = $decimals[$i] = undef; +- } +- if ($lengths[$i] or $decimals[$i]) { +- print "($lengths[$i]"; +- print ", $decimals[$i]" if $decimals[$i]; +- print ")"; +- } +- if (defined $names[$i+1]) { +- print ','; +- } +- print "\n"; +- } +- print ")\n"; +- } +- } else { +- $table->dump_records(%options) or print STDERR $table->errstr; +- } +- $table->close; +-} +- +-1; +- +-__END__ +- +-=head1 NAME +- +-dbfdump - Dump the record of the dbf file +- +-=head1 FORMAT +- +- dbfdump [options] files +- +-where options are +- +- --rs output record separator (default newline) +- --fs output field separator (default colon) +- --fields comma separated list of fields to print (default all) +- --undef string to print for NULL values (default empty) +- --memofile specifies unstandard name of attached memo file +- --memosep separator for dBase III dbt's (default \x1a\x1a) +- +- --nomemo do not try to read the memo (dbt/fpt) file +- --info print info about the file and fields +- with additional --SQL parameter, outputs the SQL create table +- --version print version of the XBase library +- --table output in nice table format (only available when +- Data::ShowTable is installed, overrides rs and fs) +- +-=head1 SYNOPSIS +- +- dbfdump -fields id,msg table.dbf +- dbfdump -fs=' : ' table +- dbfdump --nomemo file.dbf +- +- ssh user@host 'cat file.dbf.gz' | gunzip - | dbfdump - +- +-=head1 DESCRIPTION +- +-Dbfdump prints to standard output the content of dbf files listed. By +-default, it prints all fields, separated by colons, one record on +-a line. The output record and column separators can be changed by +-switches on the command line. You can also ask only for some fields to +-be printed. +- +-The content of associated memo files (dbf, fpt) is printed for memo +-fields, unless you use the C<--nomemo> option. +- +-You can specify reading the standard input by putting dash (-) instead +-of file name. +- +-=head1 AUTHOR +- +-(c) 1998--1999 Jan Pazdziora, adelton@fi.muni.cz, +-http://www.fi.muni.cz/~adelton/ +-at Faculty of Informatics, Masaryk University in Brno, Czech Republic +- +-=head1 SEE ALSO +- +-perl(1); XBase(3) +- +-=cut +- +-EOBODY +- +diff -ruN DBD-XBase-0.241-orig/bin/dbfdump.pl.PL DBD-XBase-0.241/bin/dbfdump.pl.PL +--- DBD-XBase-0.241-orig/bin/dbfdump.pl.PL 1970-01-01 01:00:00.000000000 +0100 ++++ DBD-XBase-0.241/bin/dbfdump.pl.PL 2006-03-16 22:17:24.000000000 +0000 +@@ -0,0 +1,189 @@ ++ ++use Config; ++my $filename = $0; ++ ++$filename =~ s/\.PL$//; ++open OUT,">$filename" or die "Can't create $filename: $!"; ++chmod(0755, $filename); ++print "Extracting $filename (with #! and variable substitution)\n"; ++ ++print OUT <<"EOHEADER"; ++$Config{'startperl'} -w ++ ++EOHEADER ++ ++print OUT <<'EOBODY'; ++ ++use XBase; ++use Getopt::Long; ++use strict; ++$^W = 1; ++ ++my $stdin = 0; ++ ++if (defined $ARGV[$#ARGV] and $ARGV[$#ARGV] eq '-') { ++ $stdin = 1; pop @ARGV; ++} ++ ++my %options; ++Getopt::Long::GetOptions( \%options, ++ 'help', 'version', 'info', 'rs=s', 'fs=s', 'undef=s', 'fields=s', ++ 'nomemo', 'memofile=s', 'memosep=s', 'table', ++ 'SQL', ++ ) or exit; ++ ++if (defined $options{'version'}) { ++ print "This is dbfdump.pl version $XBase::VERSION.\n"; ++ exit; ++} ++ ++if ($stdin) { ++ push @ARGV, '-'; ++ $options{'nomemo'} = 1; ++} ++ ++if (@ARGV == 0 or defined $options{'help'}) { ++ die <<'EOF'; ++Usage: dbfdump.pl [ options ] files ++ where the options specify ++ --rs output record separator (default newline) ++ --fs output field separator (default colon) ++ --fields comma separated list of fields to print (default all) ++ --undef what to print for NULL values (default empty string) ++ --memofile specifies unstandard name of attached memo file ++ --memosep separator for dBase III dbt's (default \x1a\x1a) ++ --table output in nice table format (needs Data::ShowTable) ++ all having as parameter a string; and also ++ --nomemo do not try to read the memo (dbt/fpt) file ++ --info only print info about the file and fields ++ --version print version of the XBase library ++EOF ++} ++ ++my %addopts = (); ++if (defined $options{'nomemo'} or defined $options{'info'}) { ++ $addopts{'ignorememo'} = 1; ++} ++ ++$addopts{'memosep'} = $options{'memosep'}; ++$addopts{'memofile'} = $options{'memofile'}; ++ ++if (defined $options{'info'}) { ++ $addopts{'ignorebadheader'} = 1; ++} ++ ++my $file; ++for $file (@ARGV) { ++ my $table = new XBase 'name' => $file, %addopts; ++ ++ if (not defined $table) { ++ print STDERR XBase->errstr; ++ next; ++ } ++ if (defined $options{'info'}) { ++ if (not defined $options{'SQL'}) { ++ print $table->header_info; ++ } else { ++ my $name = $file; ++ $name =~ s!^.*/|\.dbf$!!ig; ++ print "create table $name (\n"; ++ my @names = $table->field_names; ++ my %conv = qw! ++ C varchar ++ N numeric ++ F numeric ++ L boolean ++ M blob ++ D date ++ T time ++ !; ++ my @types = map { $conv{$_} } $table->field_types; ++ my @lengths = $table->field_lengths; ++ my @decimals = $table->field_decimals; ++ for (my $i = 0; $i < @names; $i++) { ++ print "\t$names[$i] $types[$i]"; ++ if ($types[$i] eq 'blob') { ++ $lengths[$i] = $decimals[$i] = undef; ++ } ++ if ($lengths[$i] or $decimals[$i]) { ++ print "($lengths[$i]"; ++ print ", $decimals[$i]" if $decimals[$i]; ++ print ")"; ++ } ++ if (defined $names[$i+1]) { ++ print ','; ++ } ++ print "\n"; ++ } ++ print ")\n"; ++ } ++ } else { ++ $table->dump_records(%options) or print STDERR $table->errstr; ++ } ++ $table->close; ++} ++ ++1; ++ ++__END__ ++ ++=head1 NAME ++ ++dbfdump.pl - Dump the record of the dbf file ++ ++=head1 FORMAT ++ ++ dbfdump.pl [options] files ++ ++where options are ++ ++ --rs output record separator (default newline) ++ --fs output field separator (default colon) ++ --fields comma separated list of fields to print (default all) ++ --undef string to print for NULL values (default empty) ++ --memofile specifies unstandard name of attached memo file ++ --memosep separator for dBase III dbt's (default \x1a\x1a) ++ ++ --nomemo do not try to read the memo (dbt/fpt) file ++ --info print info about the file and fields ++ with additional --SQL parameter, outputs the SQL create table ++ --version print version of the XBase library ++ --table output in nice table format (only available when ++ Data::ShowTable is installed, overrides rs and fs) ++ ++=head1 SYNOPSIS ++ ++ dbfdump.pl -fields id,msg table.dbf ++ dbfdump.pl -fs=' : ' table ++ dbfdump.pl --nomemo file.dbf ++ ++ ssh user@host 'cat file.dbf.gz' | gunzip - | dbfdump.pl - ++ ++=head1 DESCRIPTION ++ ++Dbfdump prints to standard output the content of dbf files listed. By ++default, it prints all fields, separated by colons, one record on ++a line. The output record and column separators can be changed by ++switches on the command line. You can also ask only for some fields to ++be printed. ++ ++The content of associated memo files (dbf, fpt) is printed for memo ++fields, unless you use the C<--nomemo> option. ++ ++You can specify reading the standard input by putting dash (-) instead ++of file name. ++ ++=head1 AUTHOR ++ ++(c) 1998--1999 Jan Pazdziora, adelton@fi.muni.cz, ++http://www.fi.muni.cz/~adelton/ ++at Faculty of Informatics, Masaryk University in Brno, Czech Republic ++ ++=head1 SEE ALSO ++ ++perl(1); XBase(3) ++ ++=cut ++ ++EOBODY ++ +diff -ruN DBD-XBase-0.241-orig/Changes DBD-XBase-0.241/Changes +--- DBD-XBase-0.241-orig/Changes 2003-11-21 14:13:43.000000000 +0000 ++++ DBD-XBase-0.241/Changes 2006-03-16 22:09:11.000000000 +0000 +@@ -136,7 +136,7 @@ + + 0.1551 Sat Jan 9 19:21:16 CET 2000 + +- dbfdump: Accepts --SQL modifier to --info, prints structure ++ dbfdump.pl: Accepts --SQL modifier to --info, prints structure + of the table as a create table SQL. + + 0.155 Sun Nov 7 15:43:59 CET 1999 +@@ -272,7 +272,7 @@ + XBase::Memo: we now reset next_for_append to point behind the + end of the file, problem pointed out by Artem Belevich. + +- dbfdump: option --table, --fields now handles intervals. ++ dbfdump.pl: option --table, --fields now handles intervals. + + t/2_read.t: fixed problem with order of fields in hash, patch + by Andreas J. Koenig. +@@ -301,7 +301,7 @@ + + XBase::SQL: fix of handling of double quoted strings. + +- dbfdump: memosep and memofile options fixed. ++ dbfdump.pl: memosep and memofile options fixed. + + t/4_dbfdump.t: avoided using cat. + +@@ -427,7 +427,7 @@ + + 0.0632 Wed May 27 12:27:04 MET DST 1998 + +- Added --nomemo option to dbfdump. The list of entires is made ++ Added --nomemo option to dbfdump.pl. The list of entires is made + longer in any non-leaf page in ndx. Added check for the magic + "FFFF0800" tag in dBaseIV dbt file when reading it. + +@@ -479,7 +479,7 @@ + long selects. Method dump_records now prints directly, + doesn't use get_all_records. + +- Added parameter --info into the script dbfdump to print the ++ Added parameter --info into the script dbfdump.pl to print the + header info. + + Changed way of determining the type of the dbt file after +diff -ruN DBD-XBase-0.241-orig/INSTALL DBD-XBase-0.241/INSTALL +--- DBD-XBase-0.241-orig/INSTALL 2003-04-03 18:02:37.000000000 +0100 ++++ DBD-XBase-0.241/INSTALL 2006-03-16 22:08:17.000000000 +0000 +@@ -43,7 +43,7 @@ + If you do not have make or you cannot run it (do you really want to + use Perl on that machine?), just copy the content of the + DBD-XBase-x.xxx/lib directory to wherever you want to have it. That +-should work, even if it won't give you man pages and dbfdump/indexdump ++should work, even if it won't give you man pages and dbfdump.pl/indexdump + scripts. + + If you use a platform supported by ActiveState and run ActiveState +diff -ruN DBD-XBase-0.241-orig/lib/XBase/FAQ.pod DBD-XBase-0.241/lib/XBase/FAQ.pod +--- DBD-XBase-0.241-orig/lib/XBase/FAQ.pod 2002-08-16 10:38:53.000000000 +0100 ++++ DBD-XBase-0.241/lib/XBase/FAQ.pod 2006-03-16 22:06:06.000000000 +0000 +@@ -175,11 +175,11 @@ + + to your script and you will see that it's not B problem. + +-=item The B stops after reading I records ... ++=item The B stops after reading I records ... + + ... why doesn't it read all I<10 x n> records? + +-Check if the file isn't truncated. C will tell ++Check if the file isn't truncated. C will tell + you the expected number of records and length of one record, like + + Filename: file.dbf +@@ -191,7 +191,7 @@ + Num fields: 40 + + So the expected length of the file is at least I<1313 + 65 * 1117>. If +-it's shorter, you've got damaged file and B only ++it's shorter, you've got damaged file and B only + reads as much rows as it can find in the dbf. + + =item How is this B related to B? +diff -ruN DBD-XBase-0.241-orig/lib/XBase.pm DBD-XBase-0.241/lib/XBase.pm +--- DBD-XBase-0.241-orig/lib/XBase.pm 2003-11-21 14:17:49.000000000 +0000 ++++ DBD-XBase-0.241/lib/XBase.pm 2006-03-16 22:05:32.000000000 +0000 +@@ -1341,7 +1341,7 @@ + $table->dump_records("fs" => " | ", "rs" => " <-+\n", + "fields" => [ "id", "msg" ]);' + +-Also note that there is a script dbfdump(1) that does the printing. ++Also note that there is a script dbfdump.pl(1) that does the printing. + + =head2 Errors and debugging + +@@ -1423,7 +1423,7 @@ + =head1 SEE ALSO + + perl(1); XBase::FAQ(3); DBD::XBase(3) and DBI(3) for DBI interface; +-dbfdump(1) ++dbfdump.pl(1) + + =cut + +diff -ruN DBD-XBase-0.241-orig/Makefile.PL DBD-XBase-0.241/Makefile.PL +--- DBD-XBase-0.241-orig/Makefile.PL 2003-04-03 17:37:19.000000000 +0100 ++++ DBD-XBase-0.241/Makefile.PL 2006-03-16 22:20:20.000000000 +0000 +@@ -41,11 +41,11 @@ + 'AUTHOR' => 'Jan Pazdziora (adelton@fi.muni.cz)', + 'ABSTRACT' => 'Reads and writes XBase (dbf) files, includes DBI support', + ) : ()), +- 'PL_FILES' => { 'bin/dbfdump.PL' => 'bin/dbfdump', ++ 'PL_FILES' => { 'bin/dbfdump.pl.PL' => 'bin/dbfdump.pl', + 'bin/indexdump.PL' => 'bin/indexdump' }, +- 'EXE_FILES' => [ 'bin/dbfdump', ' bin/indexdump' ], ++ 'EXE_FILES' => [ 'bin/dbfdump.pl', ' bin/indexdump' ], + 'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', + POSTOP => 'mv $(DISTNAME)-$(VERSION).tar.gz ../' }, +- 'clean' => { FILES => 'bin/dbfdump bin/indexdump t/newtable.dbf t/newtable.dbt t/write.dbf t/write.dbt t/rooms1.dbf t/rooms1.cdx '}, ++ 'clean' => { FILES => 'bin/dbfdump.pl bin/indexdump t/newtable.dbf t/newtable.dbt t/write.dbf t/write.dbt t/rooms1.dbf t/rooms1.cdx '}, + ); + +diff -ruN DBD-XBase-0.241-orig/MANIFEST DBD-XBase-0.241/MANIFEST +--- DBD-XBase-0.241-orig/MANIFEST 2003-07-07 19:30:41.000000000 +0100 ++++ DBD-XBase-0.241/MANIFEST 2006-03-16 22:20:06.000000000 +0000 +@@ -4,7 +4,7 @@ + Makefile.PL + README + ToDo +-bin/dbfdump.PL ++bin/dbfdump.pl.PL + bin/indexdump.PL + dbit/00base.t + dbit/10dsnlist.t +diff -ruN DBD-XBase-0.241-orig/new-XBase DBD-XBase-0.241/new-XBase +--- DBD-XBase-0.241-orig/new-XBase 2001-02-06 10:44:13.000000000 +0000 ++++ DBD-XBase-0.241/new-XBase 2006-03-16 22:09:55.000000000 +0000 +@@ -395,7 +395,7 @@ + $table->dump_records("fs" => " | ", "rs" => " <-+\n", + "fields" => [ "id", "msg" ]);' + +-Also note that there is a command line script dbfdump(1) that does ++Also note that there is a command line script dbfdump.pl(1) that does + the printing. + + =head1 Writing the data +@@ -597,7 +597,7 @@ + + XBase::FAQ(3); XBase::Index(3); + DBD::XBase(3) and DBI(3) for DBI interface; +-dbfdump(1); perl(1) ++dbfdump.pl(1); perl(1) + + =cut + +diff -ruN DBD-XBase-0.241-orig/README DBD-XBase-0.241/README +--- DBD-XBase-0.241-orig/README 2003-04-03 18:02:47.000000000 +0100 ++++ DBD-XBase-0.241/README 2006-03-16 22:09:29.000000000 +0000 +@@ -48,7 +48,7 @@ + my $table = new XBase 'table.dbf'; + my @data = $table->get_record(0); + +- The distribution also includes a dbfdump script that prints ++ The distribution also includes a dbfdump.pl script that prints + the content of the table in readable form. + + +@@ -75,7 +75,7 @@ + native XBase engines produce data incompatible with this + module. + +- Man pages for XBase, DBD::XBase, dbfdump, XBase::Index and ++ Man pages for XBase, DBD::XBase, dbfdump.pl, XBase::Index and + XBase::SDBM are included, examples of little scripts can also + be found in eg/ directory of the distribution. Read the DBI + man page for DBI specific issues, and the XBase::FAQ page. +diff -ruN DBD-XBase-0.241-orig/t/4_dbfdump.t DBD-XBase-0.241/t/4_dbfdump.t +--- DBD-XBase-0.241-orig/t/4_dbfdump.t 2002-05-15 17:18:09.000000000 +0100 ++++ DBD-XBase-0.241/t/4_dbfdump.t 2006-03-16 22:07:14.000000000 +0000 +@@ -9,13 +9,13 @@ + use ExtUtils::testlib; + my $libs = join " -I", '', @INC; + +-my $dbfdump = "$dir/blib/script/dbfdump"; ++my $dbfdump = "$dir/blib/script/dbfdump.pl"; + + my $expected = join '', ; + my $result = ''; + + my $command = qq!$^X $libs $dbfdump "$dir/t/rooms.dbf"!; +-print "Running dbfdump rooms.dbf: $command\n"; ++print "Running dbfdump.pl rooms.dbf: $command\n"; + $result = `$command`; + + if ($result ne $expected) +@@ -23,7 +23,7 @@ + print "ok 1\n"; + + $command = qq!$^X $libs $dbfdump -- - < "$dir/t/rooms.dbf"!; +-print "Running stdin dbfdump < rooms.dbf: $command\n"; ++print "Running stdin dbfdump.pl < rooms.dbf: $command\n"; + $result = `$command`; + + if ($result ne $expected) diff --git a/perl-DBD-XBase.spec b/perl-DBD-XBase.spec index f59bb3b..88bee3b 100644 --- a/perl-DBD-XBase.spec +++ b/perl-DBD-XBase.spec @@ -1,6 +1,6 @@ Name: perl-DBD-XBase Version: 0.241 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Perl module for reading and writing the dbf files Group: Development/Libraries @@ -8,6 +8,7 @@ License: GPL or Artistic URL: http://search.cpan.org/dist/DBD-XBase/ Source0: http://www.cpan.org/authors/id/J/JA/JANPAZ/DBD-XBase-%{version}.tar.gz Patch0: DBD-XBase-0.241-indexdump.PL.patch +Patch1: DBD-XBase-0.241-dbfdump-rename.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -26,6 +27,7 @@ DBI modules and their man pages. %prep %setup -q -n DBD-XBase-%{version} %patch0 -p1 +%patch1 -p1 chmod a-x eg/*table %build @@ -61,6 +63,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Mar 16 2006 Jose Pedro Oliveira - 0.241-4 +- dbfdump renamed to dbfdump.pl to avoid file conflict with shapelib. + * Fri Feb 17 2006 Jose Pedro Oliveira - 0.241-3 - Rebuild for FC5 (perl 5.8.8).