Skip to content

Commit

Permalink
backports: pin using codename on Debian
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kenyon committed Nov 21, 2024
1 parent a229aed commit 7e78e9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions manifests/backports.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@
if $pin =~ Hash {
$_pin = $pin
} elsif $pin =~ Numeric or $pin =~ String {
# apt::source defaults to pinning to origin, but we should pin to release
# for backports
$pin_type = $facts['os']['name'] ? {
'Debian' => 'codename',
'Ubuntu' => 'release',
}

$_pin = {
'priority' => $pin,
'release' => $_release,
$pin_type => $_release,
}
} else {
fail('pin must be either a string, number or hash')
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/apt_backports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
release: 'bookworm-backports',
pin: {
'priority' => 200,
'release' => 'bookworm-backports'
'codename' => 'bookworm-backports'
},
keyring: '/usr/share/keyrings/debian-archive-keyring.gpg',
)
Expand Down

0 comments on commit 7e78e9c

Please sign in to comment.