apt and automatic removal of unused dependencies
Michael Vogt
michael.vogt at ubuntu.com
Tue Jul 5 07:16:50 CDT 2005
Hi,
I build a testversion of apt and (most) of the dependent packages
(aptitude, synaptic, python-apt) with support for automatic removal of
unused depedencies.
This feature was pioneered by Daniel Burrows aptitude [1] and it works
by keeping track of what packages where installed as part of a
automatic dependency resolution and what where installed manually. If
a packages P was installed to satisfy a depedency and no other package
needs that depedency anymore, P will be removed automatically.
The patched version of apt support keeping track of automatic
depedencies now regardless if you install packages with apt-get,
aptitutde, python-apt or synaptic. The removal will happen if you run:
$ sudo apt-get remove --auto-remove $packagename
Example (after a normal apt-get install licq):
# apt-get remove licq
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
licq licq-plugin-rms
0 upgraded, 0 newly installed, 2 to remove and 462 not upgraded.
# apt-get remove --auto-remove licq
Reading package lists... Done
Building dependency tree
Reading state information... Done
We could delete libgpgme6
The following packages will be REMOVED:
libgpgme6 licq licq-plugin-rms
0 upgraded, 0 newly installed, 3 to remove and 461 not upgraded.
Synaptic also supports this now and will automatically mark unused
dependencies for removal (it ask kindly first of course before it
removes anything). It can be turned off by starting synaptic with:
# synaptic -o Synaptic::AutoRemove=false
(it will save that option on exit).
Aptitude will work as before, but apt does not know about the
information from aptitude. You will have to run the attached script to
bring aptitudes information to apt. aptitude will not (yet) make use
of the information from apt, but I'm in contact with Daniel and once
we resolved the remaining (small) issues, he will add support for the
new libapt support.
The repository (source, i386) is available at:
deb http://people.ubuntu.com/~mvo/apt/auto-remove /
signed with my gpg key.
Please test it and see if it is doing what it should do. Remember that
this is pretty new code, so keep a backup copy of the breezy apt
around in case there are problems (also it apt will only do
auto-removals when run with --auto-remove, so it _should_ be pretty
save). There may be some debug output here and there, sorry for
that. If apt acts strange you can get debug information of what it is
doing with:
# apt-get -o Debug::pkgAutoRemove=true remove --auto-remove $packagename
it also supports the config option:
APT::NeverAutoremove
(for things like "^linux-kernel.*")
The code is available in
michael.vogt at ubuntu.com--2005/apt--auto-mark--0 [2]
Cheers,
Michael
P.S. Please mail problems (like apt forgetting about auto installed
packages, stupid suggestion to remove packages etc) to me
directly. Keep a eye on /var/lib/apt/pkgstates, that's where it stores
it's information. I'll be on vacation next week so don't worry if I
don't answer immediately.
[1] And Daniel was very helpfull and answered all my silly questions
when I worked on the version for libapt
[2] at http://people.ubuntu.com/~mvo/arch/ubuntu
--
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aptitude2apt.py
Type: text/x-python
Size: 384 bytes
Desc: not available
Url : http://lists.ubuntu.com/archives/ubuntu-devel/attachments/20050705/33b5ca16/aptitude2apt.py
More information about the ubuntu-devel
mailing list