diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 20:46:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-07 20:46:40 +0000 |
commit | c617573f7ca65da803615991419db926420f22b1 (patch) | |
tree | bb3d7d440cbeec7fee53d0751c5232f31a4c8548 /urpmq | |
parent | c54d9828bb2eb4a38197b8d656aefd52c9c9ea36 (diff) | |
download | urpmi-c617573f7ca65da803615991419db926420f22b1.tar urpmi-c617573f7ca65da803615991419db926420f22b1.tar.gz urpmi-c617573f7ca65da803615991419db926420f22b1.tar.bz2 urpmi-c617573f7ca65da803615991419db926420f22b1.tar.xz urpmi-c617573f7ca65da803615991419db926420f22b1.zip |
o handle "unrequested orphans" (similar to "deborphan")
Diffstat (limited to 'urpmq')
-rwxr-xr-x | urpmq | 31 |
1 files changed, 23 insertions, 8 deletions
@@ -50,6 +50,7 @@ usage: ") . N(" --sortmedia - sort media according to substrings separated by comma. ") . 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(" --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 @@ -137,6 +138,27 @@ $options{nodepslist} = $options{list_aliases} || $options{list_url}; $options{nolock} = 1 if $options{nodepslist}; +#- print sub for query. +my $pkg_to_string = sub { + my ($pkg) = @_; + my $str = ''; + $options{group} and $str .= $pkg->group . '/'; + $str .= $pkg->name; + $options{version} and $str .= '-' . $pkg->version; + $options{release} and $str .= '-' . $pkg->release; + $options{arch} and $str .= '.' . $pkg->arch; + $str; +}; + +if ($options{auto_orphans}) { + !@names && !@src_names or $urpm->{fatal}(1, N("usage: \"urpmq --auto-orphans\" with no argument")); + $options{env} and $urpm->{fatal}(1, N("Can't use %s with %s", '--env', '--auto-orphans')); + require urpm::orphans; + my $orphans = urpm::orphans::get_orphans($urpm); + print "$_\n" foreach sort map { $pkg_to_string->($_) } @$orphans; + exit 0; +} + if ($options{env}) { print N("using specific environment on %s\n", $options{env}); #- setting new environment. @@ -487,14 +509,7 @@ $rpm_lock and $rpm_lock->unlock; #- print sub for query. my $query_sub = sub { my ($id) = @_; - my $pkg = $urpm->{depslist}[$id]; - my $str = ''; - $options{group} and $str .= $pkg->group . '/'; - $str .= $pkg->name; - $options{version} and $str .= '-' . $pkg->version; - $options{release} and $str .= '-' . $pkg->release; - $options{arch} and $str .= '.' . $pkg->arch; - $str; + $pkg_to_string->($urpm->{depslist}[$id]); }; my %hack_only_one; |