Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7011

Modified Files:
        ChangeLog Engine.pm Package.pm PkgVersion.pm Services.pm 
Log Message:
remove redundant locking

Index: Services.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Services.pm,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- Services.pm 19 Mar 2006 08:50:48 -0000      1.199
+++ Services.pm 19 Mar 2006 09:27:48 -0000      1.200
@@ -34,6 +34,7 @@
 use Data::Dumper;
 use File::Find;
 use File::Spec;
+use File::Temp qw(tempfile);
 use Storable; # safe in the modern world
 
 use strict;
@@ -68,7 +69,7 @@
                                          &store_rename &fix_gcc_repairperms
                                          &spec2struct &spec2string &get_options
                                          $VALIDATE_HELP $VALIDATE_ERROR 
$VALIDATE_OK
-                                         &find_subpackages &lock_store 
&lock_retrieve);
+                                         &find_subpackages);
 }
 our @EXPORT_OK;
 
@@ -1798,10 +1799,10 @@
 
 sub store_rename {
        my ($ref, $file) = @_;
-       my $tmp = "${file}.tmp";
+       my ($dummy, $tmp) = tempfile("$file.XXXXX");
        
        return 0 unless eval { require Storable };
-       if (&lock_store($ref, $tmp)) {
+       if (Storable::store($ref, $tmp)) {
                unless (rename $tmp, $file) {
                        print_breaking_stderr("Error: could not activate 
temporary file $tmp: $!");
                        return 0;
@@ -2208,29 +2209,6 @@
        return @found;
 }
 
-=item lock_store, lock_retrieve
-
-Identical to Storable::lock_store and Storable::lock_retrieve, except that
-they fail gracefully when locking is unavailable.
-
-=cut
-
-sub lock_store {
-       my ($data, $file) = @_;
-       my $fh = lock_wait($file, exclusive => 1);
-       my $ret = Storable::store($data, $file);
-       close $fh;
-       return $ret;
-}
-
-sub lock_retrieve {
-       my ($file) = @_;
-       my $fh = lock_wait($file, shared => 1);
-       my $ret = Storable::retrieve($file);
-       close $fh;
-       return $ret;
-}
-
 =back
 
 =cut

Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.535
retrieving revision 1.536
diff -u -d -r1.535 -r1.536
--- PkgVersion.pm       19 Mar 2006 08:50:48 -0000      1.535
+++ PkgVersion.pm       19 Mar 2006 09:27:48 -0000      1.536
@@ -31,7 +31,7 @@
                                          &get_arch &get_system_perl_version
                                          &get_path &eval_conditional 
&enforce_gcc
                                          &dpkg_lockwait &aptget_lockwait 
&lock_wait
-                                         &store_rename &lock_retrieve);
+                                         &store_rename);
 use Fink::CLI qw(&print_breaking &print_breaking_stderr &rejoin_text
                                 &prompt_boolean &prompt_selection
                                 &should_skip_prompt &die_breaking);
@@ -171,7 +171,7 @@
 #                      print "Loading PkgVersion " . $self->get_fullname . " 
from: $file\n";
                        eval {
                                local $SIG{INT} = 'IGNORE'; # No user interrupts
-                               $loaded = &lock_retrieve($file);
+                               $loaded = Storable::retrieve($file);
                        };
                        if ($@ || !defined $loaded) {
                                die "It appears that part of Fink's package 
database is corrupted "

Index: Engine.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v
retrieving revision 1.357
retrieving revision 1.358
diff -u -d -r1.357 -r1.358
--- Engine.pm   19 Mar 2006 08:50:47 -0000      1.357
+++ Engine.pm   19 Mar 2006 09:27:48 -0000      1.358
@@ -27,7 +27,7 @@
                                          &pkglist2lol &cleanup_lol
                                          &execute &expand_percent
                                          &count_files &get_arch
-                                         &call_queue_clear &call_queue_add 
&lock_wait
+                                         &call_queue_clear &call_queue_add
                                          &dpkg_lockwait &aptget_lockwait 
&store_rename &get_options
                                          $VALIDATE_HELP);
 use Fink::CLI qw(&print_breaking &print_breaking_stderr

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1273
retrieving revision 1.1274
diff -u -d -r1.1273 -r1.1274
--- ChangeLog   19 Mar 2006 08:50:47 -0000      1.1273
+++ ChangeLog   19 Mar 2006 09:27:48 -0000      1.1274
@@ -1,5 +1,10 @@
 2006-03-19  Dave Vasilevsky  <[EMAIL PROTECTED]>
 
+       * Engine.pm, Package.pm, PkgVersion.pm, Services.pm: Remove redundant
+       locking.
+
+2006-03-19  Dave Vasilevsky  <[EMAIL PROTECTED]>
+
        * Engine.pm: We don't need the 'override' code anymore, yay!
        * Package.pm, PkgVersion.pm, Services.pm: Fail gracefully if locking is
        not supported.

Index: Package.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Package.pm,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -d -r1.170 -r1.171
--- Package.pm  19 Mar 2006 08:50:47 -0000      1.170
+++ Package.pm  19 Mar 2006 09:27:48 -0000      1.171
@@ -25,7 +25,7 @@
 use Fink::Base;
 use Fink::Services qw(&read_properties &read_properties_var
                      &latest_version &version_cmp &parse_fullversion
-                     &expand_percent &lock_wait &store_rename &lock_retrieve);
+                     &expand_percent &lock_wait &store_rename);
 use Fink::CLI qw(&get_term_width &print_breaking &print_breaking_stderr
                                 &rejoin_text);
 use Fink::Config qw($config $basepath $dbpath $debarch);
@@ -963,7 +963,7 @@
                $valid_since = (stat($class->db_proxies))[9];
                eval {
                        local $SIG{INT} = 'IGNORE'; # No user interrupts
-                       $packages = &lock_retrieve($class->db_proxies);
+                       $packages = Storable::retrieve($class->db_proxies);
                };
                if ($@ || !defined $packages) {
                        die "It appears that part of Fink's package database is 
corrupted. "
@@ -979,7 +979,7 @@
                if ($idx_ok) {
                        eval {
                                local $SIG{INT} = 'IGNORE'; # No user interrupts
-                               $idx = &lock_retrieve($class->db_index);
+                               $idx = Storable::retrieve($class->db_index);
                        };
                        if ($@ || !defined $idx) {
                                close $lock if $lock;



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to