aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-07-27 17:10:33 +0200
committerAllan McRae <allan@archlinux.org>2022-07-29 10:17:52 +1000
commit79bd512181af12ec80fd8f79486fc9508fa4a1b3 (patch)
tree35faee3905d517cf9474b466aa42b10e970b46ef
parent51b2e1c973e3466471a1762716e96cf502817c0d (diff)
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.
-rw-r--r--build-aux/edit-script.sh.in1
-rw-r--r--doc/meson.build1
-rw-r--r--doc/pacman-key.8.asciidoc4
-rw-r--r--meson.build3
-rw-r--r--meson_options.txt3
-rw-r--r--scripts/completion/zsh_completion.in2
-rw-r--r--scripts/pacman-key.sh.in4
7 files changed, 13 insertions, 5 deletions
diff --git a/build-aux/edit-script.sh.in b/build-aux/edit-script.sh.in
index 992033b2..c2293217 100644
--- a/build-aux/edit-script.sh.in
+++ b/build-aux/edit-script.sh.in
@@ -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" \
diff --git a/doc/meson.build b/doc/meson.build
index 5a8eb3a4..06df92c9 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -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),
diff --git a/doc/pacman-key.8.asciidoc b/doc/pacman-key.8.asciidoc
index e32fe5d8..4d4210fa 100644
--- a/doc/pacman-key.8.asciidoc
+++ b/doc/pacman-key.8.asciidoc
@@ -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
diff --git a/meson.build b/meson.build
index 6ea97672..c8ee42fd 100644
--- a/meson.build
+++ b/meson.build
@@ -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),
diff --git a/meson_options.txt b/meson_options.txt
index 4d8cc300..d004002a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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')
diff --git a/scripts/completion/zsh_completion.in b/scripts/completion/zsh_completion.in
index 5fd8aebc..f65edeb2 100644
--- a/scripts/completion/zsh_completion.in
+++ b/scripts/completion/zsh_completion.in
@@ -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'
)
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 801ccffa..dfbe9db4 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -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