Packages installed with apt-get build-dep should be set to auto-installed for easy removal

Bug #248268 reported by Aaron Haviland
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
APT
Fix Released
Unknown
apt (Ubuntu)
Fix Released
Wishlist
Michael Vogt

Bug Description

Binary package hint: apt

Reference Debian bug report #448743. I just submitted a patch for fixing this behaviour there.

When installing a package's build-dependancies, they are all marked manually-installed. This creates a situation where they must all be manually removed afterwards. (usually uninstalling libc6-dev takes care of a large portion)

orion@eris:~$ sudo apt-get build-dep bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  autoconf autotools-dev bison libncurses5-dev m4 tex-common texi2html texinfo texlive-base texlive-base-bin texlive-common texlive-doc-base texlive-latex-base
0 upgraded, 13 newly installed, 0 to remove and 16 not upgraded.
Need to get 14.9MB of archives.

orion@eris:~$ sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.

This patch sets the status of the installed build-dependancies to Auto, so that they are available for removal with apt-get autoremove.

orion@eris:~$ sudo apt-get build-dep bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  autoconf autotools-dev bison libncurses5-dev m4 tex-common texi2html texinfo texlive-base texlive-base-bin texlive-common texlive-doc-base texlive-latex-base
0 upgraded, 13 newly installed, 0 to remove and 16 not upgraded.
Need to get 14.9MB of archives.

orion@eris:~$ sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  texlive-common texi2html bison libncurses5-dev texlive-base-bin texlive-latex-base autoconf texlive-base texlive-doc-base autotools-dev tex-common texinfo
The following packages will be REMOVED:
  autoconf* autotools-dev* bison* libncurses5-dev* tex-common* texi2html* texinfo* texlive-base* texlive-base-bin* texlive-common* texlive-doc-base* texlive-latex-base*
0 upgraded, 0 newly installed, 12 to remove and 16 not upgraded.

This patch applies cleanly to apt currently in hardy (0.7.9ubuntu17), at least through apt currently in debian/unstable (0.7.14).

Related branches

Revision history for this message
Aaron Haviland (aaron-haviland) wrote :
Changed in apt:
status: Unknown → New
Revision history for this message
James Westby (james-w) wrote :

Hi,

Thanks for your bug report. As you also filed the bug in Debian
we will wait for their response on the bug.

Thanks,

James

Changed in apt:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugrpeort and your patch!

I commited the patch with the slight modification that there is a option "APT::Get::Build-Dep-Automatic" that can override this behavior.

Changed in apt:
assignee: nobody → mvo
status: Triaged → In Progress
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.7.14ubuntu5

---------------
apt (0.7.14ubuntu5) intrepid; urgency=low

  * fix various -Wall warnings
  * make "apt-get build-dep" installed packages marked automatic
    by default. This can be changed by setting the value of
    APT::Get::Build-Dep-Automatic to false (thanks to Aaron
    Haviland, closes: #44874, LP: #248268)

 -- Michael Vogt <email address hidden> Wed, 06 Aug 2008 14:00:51 +0200

Changed in apt:
status: Fix Committed → Fix Released
Revision history for this message
Doug McMahon (mc3man) wrote :

This can be changed by setting the value of
    APT::Get::Build-Dep-Automatic to false

Would be useful if how to do this was documented so users who want build-deps to be marked as manual could do so.
Or those you wish to use aptitude which is no longer an option due to this 'bug' fix

Revision history for this message
Chadwick (lavacano) wrote :

This should be an option tunable through configuration.

I want to keep my build-dep's on board and still be able to remove package dependencies (orphans)

Revision history for this message
Chadwick (lavacano) wrote :

ignore my last comment workaround is to manually install the build-dep packages.

Revision history for this message
jeremy-list (quick-dudley) wrote :

Simply setting all build-deps for autoremoval is heinous far beyond the original complaint. It would really be better to have a command like apt-get remove-deps which removes all build dependencies involved in the named package without touching anything required for building any other package.

Revision history for this message
J. Bruce Fields (bfields-fieldses) wrote :

I don't see an argument for why the previous behavior (which many of us depend on) was considered a bug. Could we please revert this? It seems to me that "build-dep" is clearly "manual". If I did a build-dep, it's because I wanted those build dependencies installed, so the result is to render autoremove useless to me thereafter.

Revision history for this message
Aaron Haviland (aaron-haviland) wrote :

Michael, perhaps this apt should get the same treatment as the same bug/patch in Debian?

Revision history for this message
Faris Chebib (octaflop) wrote :

I agree with jeremy and J. Bruce: I stumbled upon this bug report when I was looking for a way to keep my build-dep'd packages manually installed — I didn't realize that it was a patch that was prompting me to autoremove my packages. I like jeremy's idea of the "remove-deps [package]" approach; it seems more developers would also find it helpful as well.

Revision history for this message
Ben Bucksch (benbucksch) wrote :

I was just about to file the behaviour that was added here as bug.
I think Jeremy-list's suggestion on 2008-12-05 is very good and would suit both the needs of the original bug filer as well as ours, without the need for a pref.

Here's the use-case:
I am a developer. I want to install all packages needed to compile Foo, and I need to keep them. Manually installing them is too much hassle given the strange library package names in Debian, build-dep is really useful and an important criteria when choosing the distro.
This (me wanting to keep the deps) is the common case. OTOH, I occasionally have to compile a package from source that I just want to use. Esp. in cases like mplayer, it's nice to be able to easily remove the build deps again. In this case, having them all set to manually installed and removing them manually is just as hassle-some as having to install them manually. (That's probably where the original complaint here comes from.)

Thus, I think that tracking (for autoremove) the build-dep installs differently from the normal package installs, and allowing a "remove-dep Foo" (which only removes the build deps that are not needed by some other build-dep Bar that I also did), is the ideal.

Revision history for this message
Ben Bucksch (benbucksch) wrote :

Workaround:
For packages where I want to keep the deps, do "apt-get build-dep Foo", abort, copy&paste the packages listed as NEW install into a "apt-get install" commandline.

Revision history for this message
Aaron Haviland (aaron-haviland) wrote :

Likewise, I had been using, as a workaround for years, before autoremove came on the scene, "apt-get build-dep Foo", abort, copy... for later, build what I need, and then paste into a "apt-get remove" commandline.

As an example of the reverse use-case:
I regularly hobby with building .debs, and getting the build-dependancies right is very important to me. If I cannot be sure what extra stuff is installed, before I start building something, I cannot be sure the build-deps are set correctly. (Outside of playing with deborphan and such) This is what drove me to find this bug (as it was already submitted on bugs.debian.org) and patch it myself for my own use.

I had no idea what other people thought or wanted, besides a few people in support of it pre-implementation. Obviously nobody said anything against it until it was implemented.

Revision history for this message
unggnu (unggnu) wrote :

The problem has reappeared in Jaunty.

I really think that people who need the build packages permanently should install the manual. I guess most people use apt-get build-dep or apt-src if they need one or two packages.

Is this a final decision or a bug in Jaunty?

Revision history for this message
tolostoi (tolostoi) wrote :

So, the Google say this
apt-get remove $(apt-get --simulate build-dep xxx|grep "^Inst"|awk '{print $2}')
:D

Changed in apt:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Patches

Remote bug watches

Bug watches keep track of this bug in other bug trackers.