Jelajahi Sumber

Ok, finally upgrade DBIx::SearchBuilder after I've added module 'Want' to perl-util and changed DBIx::SearchBuilder::Record::Cache implementation to use Cache::Cache's Cache::MemoryCache (which is a reasonable implementation we already have) instead of Chache::Simple::TimedExpiry (which is a module we don't have and I don't want to have in perl-cache because IMHO it is really a too 'simple' implementation)

Ralf S. Engelschall 20 tahun lalu
induk
melakukan
4ce78b9145
2 mengubah file dengan 66 tambahan dan 3 penghapusan
  1. 62 0
      perl-dbix/perl-dbix.patch
  2. 4 3
      perl-dbix/perl-dbix.spec

+ 62 - 0
perl-dbix/perl-dbix.patch

@@ -0,0 +1,62 @@
+Index: DBIx-SearchBuilder-1.38/Makefile.PL
+--- DBIx-SearchBuilder-1.38/Makefile.PL.orig	2006-01-04 09:48:34 +0100
++++ DBIx-SearchBuilder-1.38/Makefile.PL	2006-01-04 10:01:18 +0100
+@@ -7,7 +7,7 @@
+ requires('Want');
+ requires('Encode');
+ requires('Class::ReturnValue', 0.40);
+-requires('Cache::Simple::TimedExpiry' => '0.21');
++requires('Cache::MemoryCache');
+ requires('Clone');
+ build_requires('Test::More' => 0.52);
+ build_requires('DBD::SQLite');
+Index: DBIx-SearchBuilder-1.38/SearchBuilder/Record/Cachable.pm
+--- DBIx-SearchBuilder-1.38/SearchBuilder/Record/Cachable.pm.orig	2005-07-15 23:24:29 +0200
++++ DBIx-SearchBuilder-1.38/SearchBuilder/Record/Cachable.pm	2006-01-04 10:00:29 +0100
+@@ -7,7 +7,7 @@
+ use DBIx::SearchBuilder::Handle;
+ @ISA = qw (DBIx::SearchBuilder::Record);
+ 
+-use Cache::Simple::TimedExpiry;
++use Cache::MemoryCache;
+ 
+ use strict;
+ 
+@@ -49,8 +49,10 @@
+ sub _SetupCache {
+     my $self  = shift;
+     my $cache = shift;
+-    $_CACHES{$cache} = Cache::Simple::TimedExpiry->new();
+-    $_CACHES{$cache}->expire_after( $self->_CacheConfig->{'cache_for_sec'} );
++    $_CACHES{$cache} = Cache::MemoryCache->new({
++        'namespace' => 'DBIx::SearchBuilder::Record::Cache($cache)',
++        'default_expires_in' => $self->_CacheConfig->{'cache_for_sec'}
++    });
+ }
+ 
+ =head2 FlushCache 
+@@ -195,7 +197,7 @@
+ 
+ sub _fetch () {
+     my ( $self, $cache_key ) = @_;
+-    my $data = $self->_RecordCache->fetch($cache_key) or return;
++    my $data = $self->_RecordCache->get($cache_key) or return;
+ 
+     @{$self}{keys %$data} = values %$data; # deserialize
+     return 1;
+@@ -306,13 +308,13 @@
+     my $alternate_key = shift;
+     return undef unless ($alternate_key);
+ 
+-    my $primary_key   = $self->_KeyCache->fetch($alternate_key);
++    my $primary_key   = $self->_KeyCache->get($alternate_key);
+     if ($primary_key) {
+         return ($primary_key);
+     }
+ 
+     # If the alternate key is really the primary one
+-    elsif ( $self->_RecordCache->fetch($alternate_key) ) {
++    elsif ( $self->_RecordCache->get($alternate_key) ) {
+         return ($alternate_key);
+     }
+     else {    # empty!

+ 4 - 3
perl-dbix/perl-dbix.spec

@@ -26,7 +26,7 @@
 %define       V_perl                            5.8.7
 %define       V_dbix_dbschema                   0.28
 %define       V_dbix_datasource                 0.02
-%define       V_dbix_searchbuilder              1.33
+%define       V_dbix_searchbuilder              1.38
 %define       V_dbix_dwiw                       0.44
 %define       V_dbix_ha                         0.95
 %define       V_dbix_anydbd                     2.01
@@ -53,7 +53,7 @@ Class:        BASE
 Group:        Language
 License:      GPL/Artistic
 Version:      %{V_perl}
-Release:      20051201
+Release:      20060104
 
 #   list of sources
 Source0:      http://www.cpan.org/modules/by-module/DBIx/DBIx-DBSchema-%{V_dbix_dbschema}.tar.gz
@@ -73,6 +73,7 @@ Source13:     http://www.cpan.org/modules/by-module/Class/Class-DBI-Plugin-Abstr
 Source14:     http://www.cpan.org/modules/by-module/Class/Class-DBI-Plugin-RetrieveAll-%{V_class_dbi_plugin_retrieveall}.tar.gz
 Source15:     http://www.cpan.org/modules/by-module/Class/Class-DBI-AsForm-%{V_class_dbi_asform}.tar.gz
 Source16:     http://www.cpan.org/modules/by-module/Class/Class-DBI-View-%{V_class_dbi_view}.tar.gz
+Patch0:       perl-dbix.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -116,7 +117,6 @@ AutoReqProv:  no
         regex     = DBIx-DBSchema-(__VER__)\.tar\.gz
     }
     prog perl-dbix:DBIx-SearchBuilder = {
-        comment   = "thl/1.35 build broken, tries to download modules from CPAN"
         version   = %{V_dbix_searchbuilder}
         url       = http://www.cpan.org/modules/by-module/DBIx/
         regex     = DBIx-SearchBuilder-(__VER__)\.tar\.gz
@@ -210,6 +210,7 @@ AutoReqProv:  no
     %setup -q -T -D -a 14
     %setup -q -T -D -a 15
     %setup -q -T -D -a 16
+    %patch -p0
 
 %build