summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-02-25 15:14:37 +0000
committerFrancois Pons <fpons@mandriva.com>2002-02-25 15:14:37 +0000
commit64bb4f33661b7a82f0a3b920e291e3acfeb99868 (patch)
treea6be19a70cce928083d7371e238a5aa672186e05 /urpm.pm
parent4ee73cf79cefc00aabb87b2ccfb4e97fffc03443 (diff)
downloadurpmi-64bb4f33661b7a82f0a3b920e291e3acfeb99868.tar
urpmi-64bb4f33661b7a82f0a3b920e291e3acfeb99868.tar.gz
urpmi-64bb4f33661b7a82f0a3b920e291e3acfeb99868.tar.bz2
urpmi-64bb4f33661b7a82f0a3b920e291e3acfeb99868.tar.xz
urpmi-64bb4f33661b7a82f0a3b920e291e3acfeb99868.zip
3.3-15mdk
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/urpm.pm b/urpm.pm
index 00608151..40853d54 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2,7 +2,6 @@ package urpm;
use strict;
use vars qw($VERSION @ISA);
-use Fcntl ':flock';
$VERSION = '3.3';
@@ -642,13 +641,16 @@ sub build_synthesis_hdlist {
sub update_media {
my ($urpm, %options) = @_; #- do not trust existing hdlist and try to recompute them.
+ #- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
+ my ($LOCK_EX, $LOCK_NB, $LOCK_UN) = (2, 4, 8);
+
#- avoid trashing existing configuration in this case.
$urpm->{media} or return;
#- lock urpmi database.
local (*LOCK_FILE);
open LOCK_FILE, $urpm->{statedir};
- flock LOCK_FILE, LOCK_EX|LOCK_NB or $urpm->{fatal}(7, _("urpmi database locked"));
+ flock LOCK_FILE, $LOCK_EX|$LOCK_NB or $urpm->{fatal}(7, _("urpmi database locked"));
#- examine each medium to see if one of them need to be updated.
#- if this is the case and if not forced, try to use a pre-calculated
@@ -1051,7 +1053,7 @@ sub update_media {
system("sync");
#- release lock on database.
- flock LOCK_FILE, LOCK_UN;
+ flock LOCK_FILE, $LOCK_UN;
close LOCK_FILE;
}