In short, is it possible to define Debian package dependencies directly from the backports repository?
I am trying to craft a custom Debian package which builds itself when installing the package. Building said package however requires the latest linux-headers package which is only available from the backports repository (along with the linux-compiler). This is because the kernel is also installed from backports.
I tried including a custom APT preferences file in the package, but that did not help. Which kind of makes sense in that apt will not re-read config files in the middle of an on-going install. Contents of the preferences file is as follows, and does provide the correct versions when installed manually.
Package: linux-headers-amd64 linux-compiler-gcc-6-x86
Pin: release n=stretch-backports
Pin-Priority: 1000
So is there any way I could make this whole thing work simply by saying apt install my-custom-package?