I have Gentoo VM that I use to test different puppet recipes and I frequently need to remove packages to bring it to clean initial state. While I could do this by hand when there are only few packages installed (and remove dependencies with emerge -av --depclean
) but there are some recipes involving installation of few dozen of perl modules which I need to clean after testing. I think about packing them into single virtual ebuild but I already have test system dirty with many installed packages and I want to avoid reviewing them one by one. So question is how do I find list of packages installed after some specific date?
On Gentoo how to find list of packages installed after some specific date
emergegentoopackage-management
Best Answer
You can use
app-portage/genlop
for this.will list all packages merged on or after that date. (You can also specify an end date.)
To get a list of packages suitable for
emerge --unmerge
, try something like:Do double-check that list before actually unmerging, removing system packages by accident is not fun.
Another way of getting a list of things merged after a given date is looking at the
BUILD_TIME
saved in the portage database.Call this with a date (i.e.
./script "2001/09/30 21:32"
) and you'll get a list of packages merged since that date.Portage doesn't store whether a merge was a new install or an update in its database. You could reconstruct that information from the
emerge.log
file assuming you have all your system's history there.A simpler way of handling all this would be to use package sets. Create a set each time you try out a new recipe, and use that to do your cleanups. (Depclean is still necessary.)