Powered By

Powered by Blogger

Minggu, 24 Oktober 2010

Undo apt-get build-dep (Remove Build Dependencies)

When you want to compile something from source in Ubuntu/Debian, the easiest way to install the dependencies required to compile it is to run (sudo) "apt-get build-dep PACKAGE_NAME". But there is no built-in command to remove these dependencies (like apt-get remove-dep).

But thanks to tvst and Wesley Schwengle, you can undo "apt-get build-dep" by running the following command:
sudo aptitude markauto $(apt-cache showsrc PACKAGE_NAME | grep Build-Depends | perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
In the above command, replace "PACKAGE_NAME" with the name of the package you've previously ran "apt-get build-dep" for.

Note for Ubuntu 10.10 users: to use the above command, you need to install aptitude (if you haven't already) because it's not installed by default anymore:
sudo apt-get install aptitude


remove apt-get build-dep


In case you're wondering what the above command does:
  • aptitude markauto - Mark packages as having been automatically installed (so if no package depends on them, they will be removed)
  • apt-cache showsrc - Show source records
  • grep Build-Depends: - searches for "Build-Depends:" in the source records
  • perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g' - removes useless stuff from the package names (like "Build-Depends:", the parentheses and what's in between) so we can use the exact package names in the "aptitude markauto" command.


To use it as an alias in your ~/.bashrc file, see wilo108's comment below.



Credits for the command: tvst and Wesley Schwengle @ Launchpad.

Tidak ada komentar:

Posting Komentar