summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-10-21 12:16:31 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-10-21 12:16:31 +0000
commitca8aeb40d48d21095354e1ce65673035d931f270 (patch)
treec7eb4481576ae8e9da2cb18662cf6621cb1d317d
parent9fb1dd823d8ff51280fd7501491b6fd778ae5343 (diff)
downloadurpmi-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--NEWS3
-rw-r--r--pod/urpmq.8.pod6
-rw-r--r--urpm/args.pm1
-rwxr-xr-xurpmq20
4 files changed, 29 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 5214a953..0f4c8bbd 100644
--- a/NEWS
+++ b/NEWS
@@ -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},
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);