synaptic-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Synaptic-devel] Auotmatic dependency handling for apt


From: Michael Hofmann
Subject: [Synaptic-devel] Auotmatic dependency handling for apt
Date: Wed, 15 Dec 2004 21:40:17 +0200

Hi,

it would be nice to have automatic dependency handling in apt and
synaptic.

I implemented a solution for testing in apt, which goes as follows:

dpkg needs to be patched to provide a additional field:
Automatic-Remove. It can contain the values:
- "Manual" - this field is the default and is not written
to /var/lib/dpkg/status, this is like before, manual handling
- "Required" - get uninstalled if the package is not required anymore,
that means there are no more depends, but maybe suggests and recommends
- "Recommended" - get uninstalled if the package is not required or
recommended anymore, but maybe suggests
- "Suggested" - get uninstalled if the package is not required,
recommended and suggested anymore

For this to work two more parameters are introduced:
- --get-remove - works like --get-selection and prints the current
status
- --set-remove <Pkg-Name>/<Automatic-Remove-Value> - this breaks the
convention of --set-selection, for the reason that it is easier to
interface to apt and maybe similar programs

These changes do not affect backwards compatibility (or so it seems).

apt needs to be patched for this to work :-). 

It introduces a couple of fields:
- for the PackageCache: the current Automatic-Remove-state as read from
the status file
- for the DependencyCache: the new state of Automatic-Remove and a
scratch field for the checking whether a package is unused

The state is set in the debian package manager right after the unpack.

The main work is for testing purposes done in apt-get.cc. There is
basically a tree walker that marks all reachable packages and then
selects the remaining ones for deinstallation.

If you feel brave, give it a try with --experimental-automatic-remove
for apt-get. If you still have doubts, use -o Debug::pkgDPkgPM=true to
only see the effects rather than experience them.

This works only for remove and install right now. It is by no means
tested. It installs and deinstalls kdevelop and all the kde stuff
correctly, but thats it. There is not defined update behaviour, so the
Automatic-Remove state disappears. There may be a lot more glitches and
problems, because a have no experience in messing with apt.

The implementation should be moved the one of the Cache classes when
finshed I think.

A script is provided to transfer all automatic aptitude packages to dpkg
--set-remove for testing.

Tha patches are against dpkg-1.10.26 and apt-0.6.27ubuntu3.

Have fun
 Michael

Attachment: autoremove.patch
Description: Text Data

Attachment: aptautoremove.patch
Description: Text Data

Attachment: dpkg-remove-from-aptitude.sh
Description: application/shellscript


reply via email to

[Prev in Thread] Current Thread [Next in Thread]