Hello, It took me some time to understand how APT computes priorities. Indeed, there is an incoherence between the manpage and the actual behaviour, that is very well illustrated by “apt-cache policy”. But I think APT's behaviour is the most intuitive one – as long as it is correctly documented –, and the manpage should be clarified. I have a patch for that, that I shall submit when something is decided. If I understood the two concurrent behaviours correctly, they consist either in: - for each single available package file, computing the priority, and letting the highest one win; - for each available package version, computing the priority with the most precise, then first preference that applies, and letting the version with the highest single priority win. I find several problems with the second behaviour: - the rules that determine what preference apply can be confused: - is it the first rule that applies, stopping the evaluation, or the last one, that overrides the previous one? - does the default release take precedence or not over the user-defined preferences, as they are written in a different file? - it is possible to define preferences that contradict each other, being very difficult to predict for a user. The first behaviour seems more predictable to me. Indeed, when one write a preference, for instance pinning packages from stable to the priority 400, it will just apply, to all the packages that match. They may get other priorities too, but they *will* get this one, as the user defined it. No exception because this preference was not the last, the first, the middle or the most precise one. In fact, the behaviour I am describing may not be the exact current one of APT, but here is how I would describe it: for each single available package file, for each rule that matches it, create a priority, then let the highest one win. As these observations are quite subjective, here is another approach to the problem. The user defines preferences, so I think they should be the basic object to study (Debian's priorities are its users and free software :-)). Are they: 1. values associated to indexes like (version, origin)? then, the last definition should overrides any previous one; 2. rules? then, the first matching one should stop the evaluation for a given version; 3. preferences (like human tastes)? then, they should either: 3.1. all be taken into account, and the highest one win, 3.2. add themselves (like in “if I like chocolate and cookies, then I love chocolate cookies”). As they are called “preferences”, I think the third one is the most appropriate, and that its second option is the one that allows for the greatest flexibility. -- Tanguy Ortolo
Attachment:
signature.asc
Description: Digital signature