On Gentoo how do I find list of packages installed after some specific date?
You can use app-portage/genlop
for this.
genlop -l --date some_date
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:
genlop -ln --date 2011/10/02 | perl -ne '/>>> (.*)/ and print " =$1";'
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.
#!/bin/bash
stime=$(date -d "$1" +%s)
for dir in /var/db/pkg/*/* ; do
if [ -f $dir/BUILD_TIME ] ; then
btime=$(<$dir/BUILD_TIME)
if [ $btime -ge $stime ] ; then
package=$(basename $dir)
category=$(basename $(dirname $dir))
echo $category/$package
fi
fi
done
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.)
# echo dev-perl/IO-AIO > /etc/portage/sets/my_set
# emerge -a @my_set
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] dev-perl/IO-AIO-2.33
Would you like to merge these packages? [Yes/No] y
>>> Recording @my_set in "world" favorites file...
...
>>> Installing (1 of 1) dev-perl/IO-AIO-2.33
>>> Auto-cleaning packages...
>>> No outdated packages were found on your system.
* GNU info directory index is up-to-date.
# emerge -a --unmerge @my_set
* This action can remove important packages! In order to be safer, use
* `emerge -pv --depclean <atom>` to check for reverse dependencies before
* removing packages.
>>> These are the packages that would be unmerged:
dev-perl/IO-AIO
selected: 2.33
protected: none
omitted: none
All selected packages: dev-perl/IO-AIO-2.33
>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.
Would you like to unmerge these packages? [Yes/No]