Add --keyringdir meson option to configure the keyring directory

On Debian, keyrings are stored in /usr/share/keyrings. To support
this, let's add a new --keyringdir option that allows configuring
the directory under datarootdir where the keyrings should be
imported from. We default to 'pacman/keyrings' for backwards
compatibility.
This commit is contained in:
Daan De Meyer 2022-07-27 17:10:33 +02:00 committed by Allan McRae
parent 51b2e1c973
commit 79bd512181
7 changed files with 13 additions and 5 deletions

View file

@ -11,6 +11,7 @@ sed \
-e "s|@localstatedir[@]|@localstatedir@|g" \
-e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
-e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
-e "s|@keyringdir[@]|@KEYRINGDIR@|g" \
-e "s|@prefix[@]|@PREFIX@|g" \
-e "1s|#!/bin/bash|#!@BASH@|g" \
-e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \

View file

@ -28,6 +28,7 @@ asciidoc_opts = [
'-a', 'srcext=@0@'.format(get_option('src-ext')),
'-a', 'pkgext=@0@'.format(get_option('pkg-ext')),
'-a', 'pkgdatadir=@0@'.format(PKGDATADIR),
'-a', 'keyringdir=@0@'.format(KEYRINGDIR),
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),

View file

@ -86,7 +86,7 @@ Operations
*\--populate*::
Reload the default keys from the (optionally provided) keyrings in
+{pkgdatadir}/keyrings+. For more information, see
+{keyringdir}+. For more information, see
<<PK,Providing a Keyring for Import>> below.
*-u, \--updatedb*::
@ -129,7 +129,7 @@ A distribution or other repository provided may want to provide a set of
PGP keys used in the signing of its packages and repository databases that can
be readily imported into the pacman keyring. This is achieved by providing a
PGP keyring file `foo.gpg` that contains the keys for the foo keyring in the
directory +{pkgdatadir}/keyrings+.
directory +{keyringdir}+.
Optionally, the file `foo-trusted` can be provided containing a list of trusted
key IDs for that keyring. This is a file in a format compatible with 'gpg

View file

@ -26,6 +26,7 @@ MANDIR = join_paths(PREFIX, get_option('mandir'))
BUILDSCRIPT = get_option('buildscript')
LIBMAKEPKGDIR = join_paths(PREFIX, DATAROOTDIR, 'makepkg')
PKGDATADIR = join_paths(PREFIX, DATAROOTDIR, meson.project_name())
KEYRINGDIR = join_paths(PREFIX, DATAROOTDIR, get_option('keyringdir'))
PYTHON = import('python').find_installation('python3')
LDCONFIG = get_option('ldconfig')
@ -266,6 +267,7 @@ substs.set('LOCALEDIR', LOCALEDIR)
substs.set('sysconfdir', SYSCONFDIR)
substs.set('localstatedir', LOCALSTATEDIR)
substs.set('PKGDATADIR', PKGDATADIR)
substs.set('KEYRINGDIR', KEYRINGDIR)
substs.set('PREFIX', PREFIX)
substs.set('BASH', BASH.full_path())
substs.set('PACKAGE_VERSION', PACKAGE_VERSION)
@ -440,6 +442,7 @@ message('\n '.join([
' localstatedir : @0@'.format(LOCALSTATEDIR),
' database dir : @0@'.format(join_paths(LOCALSTATEDIR, 'lib/pacman/')),
' cache dir : @0@'.format(join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/')),
' keyringdir : @0@'.format(KEYRINGDIR),
' compiler : @0@ @1@'.format(cc.get_id(), cc.version()),
'',
' Architecture : @0@'.format(carch),

View file

@ -26,6 +26,9 @@ option('buildscript', type : 'string', value : 'PKGBUILD',
option('datarootdir', type : 'string', value : 'share',
description : 'FIXME')
option('keyringdir', type : 'string', value: 'pacman/keyrings',
description : 'Where to look for keyring files under datarootdir')
option('makepkg-template-dir', type : 'string', value : '/usr/share/makepkg-template',
description : 'template dir used by makepkg-template')

View file

@ -616,7 +616,7 @@ _key_longopts=(
'--init[Ensure the keyring is properly initialized]'
'--list-sigs[List keys and their signatures]:*: :_keys'
'--lsign-key[Locally sign the specified keyid]:*: :_keys'
'--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
'--populate[Reload the default keys from the (given) keyrings in '@keyringdir@']: :_path_files -W @keyringdir@'
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
)

View file

@ -75,7 +75,7 @@ usage() {
printf -- "$(gettext " --list-sigs List keys and their signatures")\n"
printf -- "$(gettext " --lsign-key Locally sign the specified keyid")\n"
printf -- "$(gettext " --populate Reload the default keys from the (given) keyrings\n\
in '%s'")\n" "@pkgdatadir@/keyrings"
in '%s'")\n" "@keyringdir@"
printf -- "$(gettext " --refresh-keys Update specified or all keys from a keyserver")\n"
printf -- "$(gettext " --verbose Show extra information")\n"
echo
@ -283,7 +283,7 @@ check_keyring() {
}
populate_keyring() {
local KEYRING_IMPORT_DIR='@pkgdatadir@/keyrings'
local KEYRING_IMPORT_DIR='@keyringdir@'
local keyring KEYRINGIDS=("$@")
local ret=0