Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25498/perlmod/Fink
Modified Files:
ChangeLog Package.pm Services.pm
Log Message:
store_rename into services
Index: Services.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Services.pm,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- Services.pm 28 Apr 2005 05:27:01 -0000 1.164
+++ Services.pm 18 May 2005 18:29:52 -0000 1.165
@@ -52,7 +52,8 @@
&get_system_perl_version &get_path
&eval_conditional &count_files
&call_queue_clear &call_queue_add
&lock_wait
- &dpkg_lockwait &aptget_lockwait);
+ &dpkg_lockwait &aptget_lockwait
+ &store_rename);
}
our @EXPORT_OK;
@@ -1610,6 +1611,32 @@
: $fullpath;
}
+=item store_rename
+
+ my $success = store_rename $ref, $file;
+
+Store $ref in $file using Storable. Use a write-to-temp-and-atomically-
+rename strategy, to prevent corruption. Return true on success.
+
+=cut
+
+sub store_rename {
+ my ($ref, $file) = @_;
+ my $tmp = "${file}.tmp";
+
+ return 0 unless eval { require Storable };
+ if (Storable::lock_store($ref, $tmp)) {
+ unless (rename $tmp, $file) {
+ print_breaking_stderr("Error: could not activate
temporary file $tmp: $!");
+ return 0;
+ }
+ return 1;
+ } else {
+ print_breaking_stderr("Error: could not write temporary file
$tmp: $!");
+ return 0;
+ }
+}
+
=back
=cut
Index: Package.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Package.pm,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- Package.pm 9 May 2005 21:45:08 -0000 1.138
+++ Package.pm 18 May 2005 18:29:52 -0000 1.139
@@ -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);
+ &expand_percent &lock_wait &store_rename);
use Fink::CLI qw(&get_term_width &print_breaking &print_breaking_stderr);
use Fink::Config qw($config $basepath $dbpath $debarch);
use Fink::Command qw(&touch &mkdir_p &rm_rf &rm_f);
@@ -707,31 +707,6 @@
return ($read, $write);
}
-=item store_rename
-
- my $success = Fink::Package->store_rename $ref, $file;
-
-Store $ref in $file using Storable, but using a write-t-o-temp-and-atomically-
-rename strategy. Return true on success.
-
-=cut
-
-sub store_rename {
- my ($class, $ref, $file) = @_;
- my $tmp = "${file}.tmp";
-
- if (Storable::lock_store($ref, $tmp)) {
- unless (rename $tmp, $file) {
- print_breaking_stderr("Error: could not activate
temporary file $tmp: $!");
- return 0;
- }
- return 1;
- } else {
- print_breaking_stderr("Error: could not write temporary file
$tmp: $!");
- return 0;
- }
-}
-
=item update_index
my $fidx = Fink::Package->update_index $fidx, $info, @pvs;
@@ -830,7 +805,7 @@
mkdir_p($dir) unless -f $dir;
my %store = map { $_->get_fullname => $_ } @pvs;
- unless ($class->store_rename(\%store, $fidx->{cache})) {
+ unless (store_rename(\%store, $fidx->{cache})) {
delete $idx->{infos}{$info};
}
}
@@ -840,7 +815,7 @@
if ($uncached) {
if ($ops->{write}) {
$class->update_aptgetable() if
$config->binary_requested();
- $class->store_rename($idx, $class->db_index);
+ store_rename($idx, $class->db_index);
}
print_breaking_stderr("done.") if &get_term_width;
}
@@ -1296,7 +1271,6 @@
return $new_properties;
}
-
=back
=cut
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.1003
retrieving revision 1.1004
diff -u -d -r1.1003 -r1.1004
--- ChangeLog 16 May 2005 05:59:05 -0000 1.1003
+++ ChangeLog 18 May 2005 18:29:51 -0000 1.1004
@@ -1,3 +1,7 @@
+2005-05-18 Dave Vasilevsky <[EMAIL PROTECTED]>
+
+ * Services.pm, Package.pm: Move store_rename into Services.
+
2005-05-16 Daniel Macks <[EMAIL PROTECTED]>
* *: verbosity_level() is now a $config object method
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits