From e251ee8e540b6c08cb1c62509d834c39bcb5e6a3 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 22 Dec 2005 15:14:34 +0000 Subject: New option --auto-update (bug #19819) --- pod/rurpmi.8.pod | 3 ++- pod/urpmi.8.pod | 11 ++++++++--- urpm/args.pm | 1 + urpmi | 17 ++++++++++++++++- urpmi.bash-completion | 2 +- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pod/rurpmi.8.pod b/pod/rurpmi.8.pod index 835faecc..e92d163a 100644 --- a/pod/rurpmi.8.pod +++ b/pod/rurpmi.8.pod @@ -15,7 +15,8 @@ on it, preventing any abuse of this tool to compromise the system. With rurpmi, you can't install arbitrary rpm files; moreoever the B<--keep>, B<--verify-rpm>, and B<--norebuild> options are forced, and several dangerous options are forbidden (B<--root>, B<--use-distrib>, -B<--env>, B<--nolock>, B<--allow-nodeps>, B<--allow-force>, B<--force>). +B<--env>, B<--nolock>, B<--allow-nodeps>, B<--allow-force>, B<--force>, +B<--auto-update>). =head1 CAVEAT diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod index fd79ee4c..da3b9662 100644 --- a/pod/urpmi.8.pod +++ b/pod/urpmi.8.pod @@ -74,11 +74,16 @@ of the urpmi database for searching packages and resolving dependencies. Install all required dependencies without asking. +=item B<--auto-update> + +Like B<--auto-select>, but also updates all relevant media before +selection of upgradeable packages is made. + =item B<--auto-select> -Automatically -select all packages that have to be upgraded, according to already installed -packages and packages listed in various registered media. +Automatically select all packages that have to be upgraded, according to +already installed packages and packages listed in various registered +media. =item B<--no-install> diff --git a/urpm/args.pm b/urpm/args.pm index 4ca21538..7b413b1d 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -68,6 +68,7 @@ my %options_spec = ( 'allow-medium-change' => \$::allow_medium_change, 'gui' => \$::gui, 'auto-select' => \$::auto_select, + 'auto-update' => sub { $::auto_update = $::auto_select = 1 }, 'no-remove|no-uninstall' => \$::no_remove, 'no-install' => \$::no_install, keep => sub { $urpm->{options}{keep} = 1 }, diff --git a/urpmi b/urpmi index 1ca0cab4..4a942631 100755 --- a/urpmi +++ b/urpmi @@ -37,6 +37,7 @@ our $sortmedia = ''; our $synthesis = ''; our $allow_medium_change = 0; our $auto_select = 0; +our $auto_update = 0; our $no_install = 0; our $no_remove = 0; our $src = 0; @@ -201,7 +202,7 @@ if ($restricted) { #- force some options foreach (qw(keep verify-rpm norebuild)) { $urpm->{options}{$_} = 1 } #- forbid some other options - urpm::error_restricted($urpm) if $root || $usedistrib || $force || $env || $parallel || $synthesis || $nolock; + urpm::error_restricted($urpm) if $root || $usedistrib || $force || $env || $parallel || $synthesis || $nolock || $auto_update; foreach (qw(allow-nodeps allow-force curl-options rsync-options wget-options)) { urpm::error_restricted($urpm) if $urpm->{options}{$_}; } @@ -306,6 +307,20 @@ $urpm->configure(nocheck_access => $env || $< != 0, parallel => $parallel, usedistrib => $usedistrib, ); + +if ($auto_update) { + message(N("Updating medias...")); + $urpm->update_media( + all => 1, + callback => \&urpm::download::sync_logger, + compress => $urpm->{options}{compress}, + limit_rate => $urpm->{options}{'limit-rate'}, + noclean => $noclean, + norebuild => $urpm->{options}{norebuild}, + quiet => $verbose < 0, + ); +} + #- get back activated default values of boolean options. exists $urpm->{options}{'split-level'} or $urpm->{options}{'split-level'} = $split_level; exists $urpm->{options}{'split-length'} or $urpm->{options}{'split-length'} = $split_length; diff --git a/urpmi.bash-completion b/urpmi.bash-completion index 53c0c5e9..a67e525d 100644 --- a/urpmi.bash-completion +++ b/urpmi.bash-completion @@ -86,7 +86,7 @@ _urpmi() # return list of available options COMPREPLY=( $( compgen -W '-a -p -P -y -s -q -v -h --help \ --update --media --excludemedia --sortmedia --synthesis \ - --auto --auto-select --no-uninstall --keep --split-level \ + --auto --auto-select --auto-update --no-uninstall --keep --split-level \ --split-length --fuzzy --src --install-src --clean \ --noclean --force --allow-nodeps --allow-force --parallel \ --wget --curl --limit-rate --proxy --proxy-user --bug \ -- cgit v1.2.1