diff options
-rw-r--r-- | urpm.pm | 28 | ||||
-rwxr-xr-x | urpmi | 16 | ||||
-rw-r--r-- | urpmi.spec | 7 |
3 files changed, 28 insertions, 23 deletions
@@ -319,7 +319,7 @@ sub add_medium { }; #- check to see if the medium is using file protocol or removable medium. - if (my ($prefix, $dir) = $url =~ /^(removable_.*?|file):\/(.*)/) { + if (my ($prefix, $dir) = $url =~ /^(removable_?[^_:]*|file):\/(.*)/) { #- the directory given does not exist or may be accessible #- by mounting some other. try to figure out these directory and #- mount everything necessary. @@ -337,7 +337,7 @@ sub add_medium { #- add some more flags for this type of medium. $medium->{clear_url} = $url; - $medium->{removable} = $url =~ /^removable_([^_:]*)(?:_[^:]*)?:/ && "/dev/$1"; #" + $medium->{removable} = $url =~ /^removable_?([^_:]*)(?:_[^:]*)?:/ && "/dev/$1"; #" } #- all flags once everything has been computed. @@ -469,7 +469,7 @@ sub update_media { my ($prefix, $dir, $error, @files); #- check to see if the medium is using file protocol or removable medium. - if (($prefix, $dir) = $medium->{url} =~ /^(removable_.*?|file):\/(.*)/) { + if (($prefix, $dir) = $medium->{url} =~ /^(removable_?[^_:]*|file):\/(.*)/) { #- the directory given does not exist and may be accessible #- by mounting some other. try to figure out these directory and #- mount everything necessary. @@ -642,7 +642,7 @@ sub update_media { $target eq 'END' and $urpm->{modified} = 0, last; #- assume everything is ok. my $basename = $target =~ /^.*\/([^\/]*)$/ && $1; - if (my ($prefix, $dir) = $medium->{url} =~ /^(removable_.*?|file):\/(.*)/) { + if (my ($prefix, $dir) = $medium->{url} =~ /^(removable_?[^_:]*|file):\/(.*)/) { #- the directory should be existing in any cases or this is an error #- so there is no need of trying to mount it. if (-e "$dir/$basedir/$basename") { @@ -1291,6 +1291,7 @@ sub filter_minimal_packages_to_upgrade { foreach (@{$urpm->{params}{provides}{$1}}) { if (/(.*?-[^-]*-[^-]*)\.([^\-\.]*)$/ && $pre_fullname eq $1 && ($found = $urpm->{params}{info}{$_})) { foreach my $tag (keys %info) { + #print STDERR "titi $tag $_, ", join(", ", keys(%$found), values(%$found), 'END'), "\n" if /xterm/; $found->{$tag} ||= $info{$tag}; } return 1; #- we have found the right info. @@ -1433,13 +1434,8 @@ sub filter_minimal_packages_to_upgrade { $r and eval(rpmtools::version_compare($_[0]{release}, $v) . $o . 0) || return; $provides{$n} = "$_[0]{name}-$_[0]{version}-$_[0]{release}"; }; - if ($n =~ m|^/|) { - rpmtools::db_traverse_tag($db, 'path', [ $n ], - [ qw (name version release) ], $check_pkg); - } else { - rpmtools::db_traverse_tag($db, 'whatprovides', [ $n ], - [ qw (name version release) ], $check_pkg); - } + rpmtools::db_traverse_tag($db, $n =~ m|^/| ? 'path' : 'whatprovides', [ $n ], + [ qw (name version release) ], $check_pkg); } }); @@ -1656,12 +1652,12 @@ sub upload_source_packages { my ($id, $device, $copy) = @_; my $medium = $urpm->{media}[$id]; $media{$id} = undef; - if (my ($prefix, $dir) = $medium->{url} =~ /^(removable_[^:]*|file):\/(.*)/) { + if (my ($prefix, $dir) = $medium->{url} =~ /^(removable_?[^_:]*|file):\/(.*)/) { my $count_not_found = sub { my $not_found; if (-e $dir) { foreach (@{$list->[$id]}) { - /^(removable_[^:]*|file):\/(.*\/([^\/]*))/ or next; + /^(removable_?[^_:]*|file):\/(.*\/([^\/]*))/ or next; -r $2 or ++$not_found; } } else { @@ -1684,7 +1680,7 @@ sub upload_source_packages { if (-e $dir) { my @removable_sources; foreach (@{$list->[$id]}) { - /^(removable_[^:]*|file):\/(.*\/([^\/]*))/ or next; + /^(removable_?[^_:]*|file):\/(.*\/([^\/]*))/ or next; -r $2 or $urpm->{error}(_("unable to read rpm file [%s] from medium \"%s\"", $2, $medium->{name})); if ($copy) { push @removable_sources, $2; @@ -1710,7 +1706,7 @@ sub upload_source_packages { #- examine non removable device but that may be mounted. if ($medium->{removable}) { push @{$removables{$medium->{removable}} ||= []}, $_; - } elsif (my ($prefix, $dir) = $medium->{url} =~ /^(removable_[^:]*|file):\/(.*)/) { + } elsif (my ($prefix, $dir) = $medium->{url} =~ /^(removable_?[^_:]*|file):\/(.*)/) { -e $dir || $urpm->try_mounting($dir) or $urpm->{error}(_("unable to access medium \"%s\"", $medium->{name})), next; } @@ -1741,7 +1737,7 @@ sub upload_source_packages { exists $media{$_} and next; @{$list->[$_]} or next; foreach (@{$list->[$_]}) { - if (/^(removable_[^:]*|file):\/(.*)/) { + if (/^(removable_?[^_:]*|file):\/(.*)/) { push @sources, $2; } elsif (/^([^:]*):\/(.*\/([^\/]*))/) { if ($force_local) { @@ -97,6 +97,9 @@ for (@ARGV) { /v/ and do { $verbose = 1; next }; die _("urpmi: unknown option \"-%s\", check usage with --help\n", $1); } next }; @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; + #- only superuser by default can install packages, + #- TODO check for source package, to download but not to install ? + $uid == 0 or $urpm->fatal(1, _("Only superuser is allowed to install packages")); /\.rpm$/ and do { push @files, untaint($_); next }; push @names, $_; } @@ -295,17 +298,18 @@ close STDERR; close STDOUT; sub install { - @_ or return; + my @l = grep { $_ !~ /\.src.\.rpm/ } @_; + @l or return; - printf SAVEOUT _("installing %s\n", join(' ', @_)); + printf SAVEOUT _("installing %s\n", join(' ', @l)); log_it(scalar localtime, " @_\n"); $urpm->{log}("starting installing packages"); - system($X ? ("grpmi", $WID ? ("--WID=$WID") : ()) : ("rpm", $rpm_opt), @_); + system($X ? ("grpmi", $WID ? ("--WID=$WID") : ()) : ("rpm", $rpm_opt), @l); if ($?) { message(_("Installation failed")); $X and exit(($? >> 8) + 32); #- grpmi handles --nodeps and --force by itself, forward grpmi error + 32 - m|^/| && !-e $_ and exit 2 foreach @_; #- missing local file + m|^/| && !-e $_ and exit 2 foreach @l; #- missing local file $noexpr = _("Nn"); $yesexpr = _("Yy"); @@ -313,14 +317,14 @@ sub install { $auto and exit 1; #- if auto has been set, avoid asking user. $force or <STDIN> =~ /[$yesexpr]/ or exit 1; $urpm->{log}("starting installing packages without deps"); - system("rpm", $rpm_opt, "--nodeps", @_); + system("rpm", $rpm_opt, "--nodeps", @l); if ($?) { message(_("Installation failed")); print SAVEOUT _("Try installation even more strongly (--force)? (y/N) "); $force or <STDIN> =~ /[$yesexpr]/ or exit 1; $urpm->{log}("starting force installing packages without deps"); - system("rpm", $rpm_opt, "--nodeps", "--force", @_); + system("rpm", $rpm_opt, "--nodeps", "--force", @l); } } } @@ -2,7 +2,7 @@ Name: urpmi Version: 2.0 -Release: 1mdk +Release: 2mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -112,6 +112,11 @@ rm -f /var/lib/urpmi/depslist %changelog +* Fri Nov 9 2001 François Pons <fpons@mandrakesoft.com> 2.0-2mdk +- added error message if not root. +- fixed some removable device bad regexp (to support new format). +- avoid installing source package (downloaded but ignored). + * Tue Nov 6 2001 François Pons <fpons@mandrakesoft.com> 2.0-1mdk - no more need for removable device selection in URL (autoprobe but need removable://) but old description still accepted. |