diff options
author | Francois Pons <fpons@mandriva.com> | 2002-12-13 13:27:45 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-12-13 13:27:45 +0000 |
commit | 90116b81b7e4ce0b99be4c1235ac96702202beaf (patch) | |
tree | 978d05d4f83e595595b2be5ca24e71906d81e467 | |
parent | b147827046fbaede65f06b1b15b8729afc758399 (diff) | |
download | urpmi-90116b81b7e4ce0b99be4c1235ac96702202beaf.tar urpmi-90116b81b7e4ce0b99be4c1235ac96702202beaf.tar.gz urpmi-90116b81b7e4ce0b99be4c1235ac96702202beaf.tar.bz2 urpmi-90116b81b7e4ce0b99be4c1235ac96702202beaf.tar.xz urpmi-90116b81b7e4ce0b99be4c1235ac96702202beaf.zip |
4.1-18mdk
-rw-r--r-- | urpm.pm | 17 | ||||
-rwxr-xr-x | urpmf | 3 | ||||
-rwxr-xr-x | urpmi | 1 | ||||
-rw-r--r-- | urpmi.spec | 7 | ||||
-rwxr-xr-x | urpmq | 5 |
5 files changed, 28 insertions, 5 deletions
@@ -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; } @@ -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, @@ -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 }; @@ -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. @@ -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 }; |