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

Re: python-apt create_pin question



On Wed, Jan 19, 2022 at 07:27:50AM -0700, Antonio Russo wrote:
> 
> Hello! (This was originally posted in debian-user, and it was suggested to
> post this question here.)
> 
> I'm trying to use apt_pkg to get a "best candidate" for a package, but with
> slightly different constraints than I have set up in /etc/apt/preferences.d.
> 
> I am trying to use Policy.create_pin to do so, but cannot seem to get it working:
> 
> import apt_pkg
> 
> apt_pkg.init()
> cache = apt_pkg.Cache(progress=None)
> policy = apt_pkg.Policy(cache)
> #policy.create_pin('origin', '', 'Debian', -1)
> policy.create_pin('origin', 'apt', 'Debian', -1)
> policy.init_defaults()

Well, that's not going to work, Debian is not the hostname
(the "origin" field in apt policy output and preferences files);
what you want to say is

policy.create_pin('release', 'apt', 'o=Debian', -1)

This may or may not work for you, as it does not override
any existing pins in the preferences files.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: