Skip to content

Commit 7e78e9c

Browse files
committed
backports: pin using codename on Debian
Debian 11 bullseye and Debian 12 bookworm backports release files look like this: https://deb.debian.org/debian/dists/bullseye-backports/InRelease: Suite: bullseye-backports Codename: bullseye-backports https://deb.debian.org/debian/dists/bookworm-backports/InRelease: Suite: stable-backports Codename: bookworm-backports Using "release" (aka Suite in the InRelease file) causes our pin to not match for bookworm because they changed it to stable-backports instead of $codename-backports. We can use codename to support both for this pin. Fixes #1187.
1 parent a229aed commit 7e78e9c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

manifests/backports.pp

+6-3
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@
9494
if $pin =~ Hash {
9595
$_pin = $pin
9696
} elsif $pin =~ Numeric or $pin =~ String {
97-
# apt::source defaults to pinning to origin, but we should pin to release
98-
# for backports
97+
$pin_type = $facts['os']['name'] ? {
98+
'Debian' => 'codename',
99+
'Ubuntu' => 'release',
100+
}
101+
99102
$_pin = {
100103
'priority' => $pin,
101-
'release' => $_release,
104+
$pin_type => $_release,
102105
}
103106
} else {
104107
fail('pin must be either a string, number or hash')

spec/classes/apt_backports_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
release: 'bookworm-backports',
3333
pin: {
3434
'priority' => 200,
35-
'release' => 'bookworm-backports'
35+
'codename' => 'bookworm-backports'
3636
},
3737
keyring: '/usr/share/keyrings/debian-archive-keyring.gpg',
3838
)

0 commit comments

Comments
 (0)