Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 416907 - sys-apps/portage: emerge option to remove package and its dependencies (equivalent to emerge --deselect <packages> && emerge --depclean, but only remove specified <packages> and their dependencies which are no longer needed)
Summary: sys-apps/portage: emerge option to remove package and its dependencies (equiv...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 155723
  Show dependency tree
 
Reported: 2012-05-21 13:00 UTC by Phil Stracchino (Unix Ronin)
Modified: 2021-05-02 18:21 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Stracchino (Unix Ronin) 2012-05-21 13:00:05 UTC
The emerge -C option removes a single package, but does not clean up its dependencies.  The --depclean option does a global dependency cleanup that usually wants to remove more than you intended.  It would be useful to have a less broad option in between -C and --edepclean that could be used along with -C to remove a specified package or packages, plus recursively remove orphaned dependencies of the listed package(s) upon which no other installed package depends.  I might suggest --remove-orphaned-deps as a good descriptive name.

Reproducible: Always
Comment 1 Michael Weber (RETIRED) gentoo-dev 2012-05-22 06:48:26 UTC
I see the point, iff your system is not completely up to date (emerge -avuND world ; emerge -a --depclean ; revdep-rebuild --ignore -- av ).

In all other cases 

emerge -a --deselect <atom>
emerge -a --depclean 

should do the trick.
Comment 2 Phil Stracchino (Unix Ronin) 2012-05-24 13:10:26 UTC
Actually, the use case I have in mind is less "not fully up-to-date system" than the case of a system with some packages locally built from source (or installed from non-Gentoo packages) outside of portage, but for which dependencies were installed from portage.  emerge --depclean sees those as orphan packages, because it doesn't know they're dependencies for something installed outside portage.  So then, if I remove a Gentoo package I'm no longer using, I may want to remove its orphaned dependencies, but *only* its orphaned dependencies, without scanning the entire system for installed packages that have no listed dependencies within portage.

My system, for example, has a lengthy list of Perl packages installed for either my own code or for non-Gentoo Perl programs, which it wants to remove on a depclean.  So what I wind up doing is running emerge --depclean -p, then selecting out of that list the packages I know I'm not using and removing them with emerge -C.
Comment 3 Zac Medico gentoo-dev 2012-05-24 18:46:51 UTC
(In reply to comment #2)
> My system, for example, has a lengthy list of Perl packages installed for
> either my own code or for non-Gentoo Perl programs, which it wants to remove
> on a depclean.  So what I wind up doing is running emerge --depclean -p,
> then selecting out of that list the packages I know I'm not using and
> removing them with emerge -C.

You should do one of the following:

1) Add the wanted packages to your world file with `emerge --noreplace atom`.

2) Create an ebuild (in an overlay) that does nothing more that pull in the wanted packages in RDEPEND, install it, and add it to your world file.
Comment 4 Phil Stracchino (Unix Ronin) 2012-05-25 12:04:21 UTC
Actually, my game plan is to make proper ebuilds for the leaf-node applications...
Comment 5 Joakim Tjernlund 2013-12-09 17:27:56 UTC
I was just about to file my own bug requesting the same when I found this one :)
Using --depclean isn't that easy in all cases as it requires the tree be in sync with your installed pkgs which isn't always easy to do.

An embedded system may not have the space needed to first emerge all new pkgs
the cleanout old stuff.