summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm.pm17
-rwxr-xr-xurpmf3
-rwxr-xr-xurpmi1
-rw-r--r--urpmi.spec7
-rwxr-xr-xurpmq5
5 files changed, 28 insertions, 5 deletions
diff --git a/urpm.pm b/urpm.pm
index 43a7f1f7..ff42826e 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2007,6 +2007,15 @@ sub download_source_packages {
$urpm->{error}(_("incoherent medium \"%s\" marked removable but not really", $medium->{name}));
}
};
+
+ #- avoid putting a require on Fcntl ':flock' (which is perl and not perl-base).
+ my ($LOCK_EX, $LOCK_UN) = (2, 8);
+
+ #- lock urpmi database, but keep lock to wait for an urpmi.update to finish.
+ local (*LOCK_FILE);
+ open LOCK_FILE, $urpm->{statedir};
+ flock LOCK_FILE, $LOCK_EX or $urpm->{fatal}(7, _("urpmi database locked"));
+
foreach (0..$#$list) {
values %{$list->[$_]} or next;
my $medium = $urpm->{media}[$_];
@@ -2085,7 +2094,6 @@ sub download_source_packages {
};
if ($@) {
$urpm->{log}(_("...retrieving failed: %s", $@));
- #delete @sources{keys %distant_sources};
}
#- clean files that have not been downloaded, but keep mind there
#- has been problem downloading them at least once, this is
@@ -2100,6 +2108,13 @@ sub download_source_packages {
#- clean failed download which have succeeded.
delete @error_sources{keys %sources};
+ #- now everything is finished.
+ system("sync");
+
+ #- release lock on database.
+ flock LOCK_FILE, $LOCK_UN;
+ close LOCK_FILE;
+
#- return the hash of rpm file that have to be installed, they are all local now.
%$local_sources, %sources, %error_sources;
}
diff --git a/urpmf b/urpmf
index 185fe6f2..c0777aee 100755
--- a/urpmf
+++ b/urpmf
@@ -108,8 +108,9 @@ foreach (qw(group size epoch summary description provides requires files conflic
$params{$_} and $callback .= 'foreach my $e ($pkg->'.$_.') { local $_ = $pkg->'.$full.'name."'.(!$quiet && ":$_").':$e"; '.$expr.' or next; print "$_\n" }';
}
$callback .= ' 1; }';
+$urpm->{log}(_("callback is :\n%s\n", $callback));
$callback = eval $callback;
-$@ and die;
+$@ and usage;
$urpm->configure(nocheck_access => 1,
media => $media,
diff --git a/urpmi b/urpmi
index 3772e333..6b1cf3f9 100755
--- a/urpmi
+++ b/urpmi
@@ -122,6 +122,7 @@ usage:
#- parse arguments list.
my @nextargv;
my $command_line = join " ", @ARGV;
+@ARGV or usage;
while (defined($_ = shift @ARGV)) {
/^--help$/ and do { usage; next };
/^--no-locales$/ and do { undef *_; undef *urpm::_; *_ = *urpm::_ = sub { sprintf(shift @_, @_) }; next };
diff --git a/urpmi.spec b/urpmi.spec
index b27231a4..285cf691 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,7 +2,7 @@
Name: urpmi
Version: 4.1
-Release: 17mdk
+Release: 18mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
@@ -204,6 +204,11 @@ fi
%changelog
+* Fri Dec 13 2002 François Pons <fpons@mandrakesoft.com> 4.1-18mdk
+- fixed urpmf so that if callback is not compilable display help.
+- fixed urpmq and urpmi call without parameter to display help.
+- added donwload lock to avoid clashes from urpmi.update.
+
* Fri Dec 13 2002 François Pons <fpons@mandrakesoft.com> 4.1-17mdk
- added mput or scp exit code checking.
- temporaly using hdlist file for --summary of urpmf.
diff --git a/urpmq b/urpmq
index 445fd8c2..13e3b10e 100755
--- a/urpmq
+++ b/urpmq
@@ -80,8 +80,9 @@ my $urpm = new urpm;
#- parse arguments list.
my @nextargv;
-for (@ARGV) {
- /^--help$/ and do { usage; next };
+@ARGV or usage;
+while (defined($_ = shift @ARGV)) {
+ /^--help$/ and do { usage };
/^--update$/ and do { $query->{update} = 1; next };
/^--media$/ and do { push @nextargv, \$query->{media}; next };
/^--mediums$/ and do { push @nextargv, \$query->{media}; next };