summaryrefslogtreecommitdiffstats
path: root/urpm/media.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-23 10:49:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-23 10:49:51 +0000
commit6aed7e5429cab61514fe2eb3cacad3d11462cd5f (patch)
tree514c973cd20132c03770c87eca82ab248e10446b /urpm/media.pm
parent0bf8f352836b0e1b584638789558246871912a87 (diff)
downloadurpmi-6aed7e5429cab61514fe2eb3cacad3d11462cd5f.tar
urpmi-6aed7e5429cab61514fe2eb3cacad3d11462cd5f.tar.gz
urpmi-6aed7e5429cab61514fe2eb3cacad3d11462cd5f.tar.bz2
urpmi-6aed7e5429cab61514fe2eb3cacad3d11462cd5f.tar.xz
urpmi-6aed7e5429cab61514fe2eb3cacad3d11462cd5f.zip
- move lock functions to a full blown module
- handle get_exclusive and release_exclusive on existing lock, *but* don't use it for now! (not useful) - remove urpmi_db locking from add_medium and update_media - move rpm_db locking into _read_cachedir_pubkey - update_media: restrict rpm_db exclusive locking to parse_pubkeys - urpmi: move locking rpm_db near its use - handle lock directly in urpmi.addmedia, urpmi.update, urpme, urpmf - log locking/unlocking
Diffstat (limited to 'urpm/media.pm')
-rw-r--r--urpm/media.pm16
1 files changed, 5 insertions, 11 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index c55fb786..48687bfd 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -6,6 +6,7 @@ use urpm 'file_from_local_url';
use urpm::msg;
use urpm::util;
use urpm::removable;
+use urpm::lock;
our @PER_MEDIA_OPT = qw(
@@ -600,7 +601,6 @@ sub add_medium {
#- make sure configuration has been read.
$urpm->{media} or die "caller should have used ->read_config or ->configure first";
- my $lock = urpm::sys::lock_urpmi_db($urpm, 'exclusive');
#- if a medium with that name has already been found, we have to exit now
my $medium;
@@ -643,7 +643,6 @@ sub add_medium {
$urpm->{log}(N("added medium %s", $name));
$urpm->{modified} = 1;
- $lock and urpm::sys::unlock($lock);
$name;
}
@@ -1475,6 +1474,8 @@ sub _read_cachedir_pubkey {
$urpm->{log}(N("examining pubkey file of \"%s\"...", $medium->{name}));
+ my $_rpm_lock = urpm::lock::rpm_db($urpm, 'exclusive');
+
my %key_ids;
$urpm->import_needed_pubkeys(
[ $urpm->parse_armored_file("$urpm->{cachedir}/partial/pubkey") ],
@@ -1698,7 +1699,6 @@ sub _update_media__handle_some_flags {
#- force : try to force rebuilding base files
#- force_building_hdlist
#- noclean : keep old files in the header cache directory
-#- nolock : don't lock the urpmi database
#- nomd5sum : don't verify MD5SUM of retrieved files
#- nopubkey : don't use rpm pubkeys
#- probe_with : probe synthesis or hdlist (or none)
@@ -1709,14 +1709,11 @@ sub update_media {
$urpm->{media} or return; # verify that configuration has been read
$options{nopubkey} ||= $urpm->{options}{nopubkey};
- #- get gpg-pubkey signature.
- my $rpm_lock;
if (!$options{nopubkey}) {
- $rpm_lock = urpm::sys::lock_rpm_db($urpm, 'exclusive');
+ #- get gpg-pubkey signature.
+ my $_rpm_lock = urpm::lock::rpm_db($urpm);
$urpm->{keys} or $urpm->parse_pubkeys(root => $urpm->{root});
}
- #- lock database if allowed.
- my $urpmi_lock = urpm::sys::lock_urpmi_db($urpm, 'exclusive') if !$options{nolock};
#- examine each medium to see if one of them needs to be updated.
#- if this is the case and if not forced, try to use a pre-calculated
@@ -1766,9 +1763,6 @@ sub update_media {
#- NB: in case of $urpm->{modified}, write_MD5SUM is called in write_config above
write_MD5SUM($urpm);
}
-
- $urpmi_lock and urpm::sys::unlock($urpmi_lock);
- $rpm_lock and urpm::sys::unlock($rpm_lock);
}
#- clean params and depslist computation zone.