Mageia Bugzilla – Attachment 6977 Details for
Bug 16134
urpme --auto-orphans proposes to remove package that can't be removed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
fix bogus orphan packages (when one of their file is needed by a file require)
16134.diff (text/plain), 1.19 KB, created by
Thierry Vignaud
on 2015-08-28 16:27:55 CEST
(
hide
)
Description:
fix bogus orphan packages (when one of their file is needed by a file require)
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2015-08-28 16:27:55 CEST
Size:
1.19 KB
patch
obsolete
>diff --git a/urpm/orphans.pm b/urpm/orphans.pm >index 5ba1656..e10f7d7 100644 >--- a/urpm/orphans.pm >+++ b/urpm/orphans.pm >@@ -416,18 +460,32 @@ sub _all_unrequested_orphans { > my $unreq_list = unrequested_list($urpm); > > my ($current_kernel_version, $current_kernel) = _get_current_kernel_package(); >+ # cache costly path lookups: >+ my %looked_paths; > > while (my $pkg = shift @$req) { > # do not do anything regarding kernels if we failed to detect the running one (ie: chroot) > _kernel_callback($pkg, $unreq_list) if $current_kernel; > foreach my $prop ($pkg->requires, $pkg->recommends_nosense) { > my $n = URPM::property2name($prop); >+ my $found; > foreach my $p (@{$provides{$n} || []}) { > if ($p != $pkg && $l{$p->name} && $p->provides_overlap($prop)) { > delete $l{$p->name}; > push @$req, $p; >+ $found = 1; > } > } >+ # special case for file deps (not in provide tags): >+ if (!$found && $n =~ m!^/! && !exists $looked_paths{$n}) { >+ $looked_paths{$n} = undef; >+ my $db = urpm::db_open_or_die_($urpm); >+ $db->traverse_tag_find('path', $n, sub { >+ my ($p) = @_; >+ delete $l{$p->name}; >+ push @$req, $p; >+ }); >+ } > } > } >
diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 5ba1656..e10f7d7 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -416,18 +460,32 @@ sub _all_unrequested_orphans { my $unreq_list = unrequested_list($urpm); my ($current_kernel_version, $current_kernel) = _get_current_kernel_package(); + # cache costly path lookups: + my %looked_paths; while (my $pkg = shift @$req) { # do not do anything regarding kernels if we failed to detect the running one (ie: chroot) _kernel_callback($pkg, $unreq_list) if $current_kernel; foreach my $prop ($pkg->requires, $pkg->recommends_nosense) { my $n = URPM::property2name($prop); + my $found; foreach my $p (@{$provides{$n} || []}) { if ($p != $pkg && $l{$p->name} && $p->provides_overlap($prop)) { delete $l{$p->name}; push @$req, $p; + $found = 1; } } + # special case for file deps (not in provide tags): + if (!$found && $n =~ m!^/! && !exists $looked_paths{$n}) { + $looked_paths{$n} = undef; + my $db = urpm::db_open_or_die_($urpm); + $db->traverse_tag_find('path', $n, sub { + my ($p) = @_; + delete $l{$p->name}; + push @$req, $p; + }); + } } }
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16134
: 6977 |
7635