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

apt_preferences: can one invert the Package: match?



Hey there.


Maybe someone can help me with the following :-)


What I basically want to do is to set a -1 Priority for all packages
matching some criterion, except a few ones which I literally name.

The practical idea is, that I want to disallow "accidental"
installation of all non-free packages but some a few ones which I
consider okay to be installed, e.g. either because at least its sources
are available (like unrar) or there is not much way around using it
(like CPU microcode).


So what I did so far was something like this:
> Explanation: Disable non-free packages.
> Package: *
> Pin: release c=non-free
> Pin-Priority: -1
> 
> Explanation: Enable selected non-free packcages.
> Package: intel-microcode unrar
> Pin: release c=non-free
> Pin-Priority: 500

That is, first set a -1 prio for all non-free, then relieve that for
the ones I want.


AFAIU, this has however some subtle undesired side effect:
I really set 500 on all the ones I selected, ... even if normally
they'd get something else, which can happen in at least these cases, I
think:

- I have another rule which would set another priority (and then it
depends on their order, AFAIU)

- I use repos, where the default priority is already not 500, which,
AFAIU, happens right now only in cases like Backports when
"NotAutomatic: yes" and "ButAutomaticUpgrades: yes" are set.
Then I'd actually want the above packages get just the 100 instead of
my 500.



Not sure if I understand it correctly, but I think what I'd actually
really want is something like:

> Explanation: Disable non-free packages except the ones listed below.
> Package: ! intel-microcode unrar
> Pin: release c=non-free
> Pin-Priority: -1

Where the ! would indicate that anything is matched except the ones
following.


I've seen in the manpage that one can use POSIX EREs... but I don't
think it's possible with them either (with PCRE one could perhaps hack
something together).


Any ideas? :-)


Thanks,
Chris.


Reply to: