diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-10-21 12:16:31 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-10-21 12:16:31 +0000 |
commit | ca8aeb40d48d21095354e1ce65673035d931f270 (patch) | |
tree | c7eb4481576ae8e9da2cb18662cf6621cb1d317d | |
parent | 9fb1dd823d8ff51280fd7501491b6fd778ae5343 (diff) | |
download | urpmi-ca8aeb40d48d21095354e1ce65673035d931f270.tar urpmi-ca8aeb40d48d21095354e1ce65673035d931f270.tar.gz urpmi-ca8aeb40d48d21095354e1ce65673035d931f270.tar.bz2 urpmi-ca8aeb40d48d21095354e1ce65673035d931f270.tar.xz urpmi-ca8aeb40d48d21095354e1ce65673035d931f270.zip |
add --not-available option to urpmq
Patch from Pascal Terjan, fixes bug #51418
urpmq --not-available shows the packages that are installed but no
longer available in the configured media. This can be helpful to figure
out which packages are obsolete after a few distro upgrades.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | pod/urpmq.8.pod | 6 | ||||
-rw-r--r-- | urpm/args.pm | 1 | ||||
-rwxr-xr-x | urpmq | 20 |
4 files changed, 29 insertions, 1 deletions
@@ -1,4 +1,7 @@ - don't use aria2 when loading mirrorlist from api.mandriva.com, fixes #53434 +- add --not-available option to urpmq to get a list of packages that are + installed but not available from any configured media (Pascal Terjan, + fixes #51418) Version 6.30.1 - 19 October 2009 diff --git a/pod/urpmq.8.pod b/pod/urpmq.8.pod index 0078bbfc..9946b400 100644 --- a/pod/urpmq.8.pod +++ b/pod/urpmq.8.pod @@ -88,6 +88,12 @@ packages and packages listed in various registered media. List orphans. +=item B<--not-available> + +List packages that are not available on any media. This can help to find +packages that are still installed but that are now obsolete because they +have been removed from the current version of Mandriva Linux. + =item B<--no-suggests> With this option, urpmq will not require "suggested" packages. diff --git a/urpm/args.pm b/urpm/args.pm index 1160ba85..1a70d843 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -248,6 +248,7 @@ my %options_spec = ( $options{deps} = $options{upgrade} = $options{auto_select} = 1; }, 'fuzzy|y' => sub { $urpm->{options}{fuzzy} = 1; $options{all} = 1 }, + 'not-available' => \$options{not_available}, keep => \$options{keep}, list => \$options{list}, changelog => \$options{changelog}, @@ -51,6 +51,8 @@ usage: ") . N(" --synthesis - use the given synthesis instead of urpmi db. ") . N(" --auto-select - automatically select packages to upgrade the system. ") . N(" --auto-orphans - list orphans +") . N(" --not-available + - list installed packages not available on any media. ") . N(" --no-suggests - do not auto select \"suggested\" packages. ") . N(" --fuzzy - impose fuzzy search (same as -y). ") . N(" --keep - keep existing packages if possible, reject requested @@ -176,7 +178,7 @@ if ($options{env}) { if ($options{ignorearch}) { urpm::shunt_ignorearch() } my $rpm_lock = - $options{upgrade} && !$options{env} && !$options{nolock} + ($options{upgrade} || $options{not_available}) && !$options{env} && !$options{nolock} && urpm::lock::rpm_db($urpm, '', wait => $options{wait_lock}); my $urpmi_lock = !$options{nolock} && urpm::lock::urpmi_db($urpm, '', wait => $options{wait_lock}); urpm::media::configure($urpm, @@ -249,6 +251,22 @@ if ($options{list_aliases}) { # use the generic code @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = (); } +} elsif ($options{not_available}) { + my %available; + my $to_string = sub { + my ($p) = @_; + $p->name . '-' . $p->version . '-' . $p->release . '.' . $p->arch + }; + foreach my $p (@{$urpm->{depslist}}) { + $available{$to_string->($p)} = 1; + } + my $db = urpm::db_open_or_die_($urpm); + $db->traverse(sub { + my ($p) = @_; + my $s = $to_string->($p); + # FIXME Use $pkg_to_string if some options are set but default to this format ? + $available{$s} || print "$s\n"; + }); } else { %requested = $urpm->register_rpms(@files); |