Is it possible to undo all changes made by "aptitude build-dep xxxxxx" i.e to un-install all dependencies installed by this command?
I don't think there's an automatic way. Packages installed through
build-dep are recorded in the same way as if they'd been directly requested by name.
If you know approximately when you ran
aptitude build-dep, you can find which packages got installed when you ran the command by looking through the logs in
You can run
apt-cache showsrc PACKAGENAME | grep '^Build-depends:' to list the build dependencies of the package. Review each of them to see if you want them; mark the ones you don't care about as not manually installed (
apt-get markauto PACKAGENAME) and flush the non-required packages (
I found these commands on a Launchpad question:
sudo aptitude markauto $(apt-cache showsrc PACKAGE_NAME | grep Build-Depends | perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
There is also an alternative based around sed that copes with brackets in package names:
sudo aptitude markauto $(apt-cache showsrc PACKAGE_NAME | sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g')
PACKAGE_NAME with your own package.