+if backport_packages.empty?
+ apt_preference "backports" do
+ action :remove
+ end
+else
+ apt_preference "backports" do
+ glob backport_packages.sort.map { |p| "src:#{p}" }.join(" ")
+ pin "release n=#{node[:lsb][:codename]}-backports"
+ pin_priority "500"
+ end
+end
+
+execute "apt-cache-gencaches" do
+ action :nothing
+ command "apt-cache gencaches"
+ subscribes :run, "apt_preference[backports]", :immediately
+end
+