From ca8aeb40d48d21095354e1ce65673035d931f270 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Wed, 21 Oct 2009 12:16:31 +0000 Subject: 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. --- urpmq | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'urpmq') diff --git a/urpmq b/urpmq index 11c0912d..bed74dbd 100755 --- a/urpmq +++ b/urpmq @@ -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); -- cgit v1.2.1