summaryrefslogtreecommitdiffstats
path: root/urpmq
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 /urpmq
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.
Diffstat (limited to 'urpmq')
-rwxr-xr-xurpmq20
1 files changed, 19 insertions, 1 deletions
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);