[PATCH 2/2] pactree: Set the gpg directory

Edward E develinthedetail at gmail.com
Sun Jan 5 05:47:24 UTC 2020


Addresses https://github.com/msys2/MSYS2-packages/issues/1720

Signed-off-by: Edward E <develinthedetail at gmail.com>
---
gpgdir is hardcoded here. Also 'plagiarized' from pacman.
 src/Makefile.am | 4 +++-
 src/pactree.c   | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 8d33be8..eef0590 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,7 @@ DIST_SUBDIRS = $(SUBDIRS)
 # paths set at make time
 conffile  = ${sysconfdir}/pacman.conf
 dbpath    = ${localstatedir}/lib/pacman/
+gpgdir    = ${sysconfdir}/pacman.d/gnupg/
 
 bin_SCRIPTS = \
 	$(OURSCRIPTS)
@@ -82,7 +83,8 @@ endif
 AM_CPPFLAGS = \
 	-DLOCALEDIR=\"@localedir@\" \
 	-DCONFFILE=\"$(conffile)\" \
-	-DDBPATH=\"$(dbpath)\"
+	-DDBPATH=\"$(dbpath)\" \
+	-DGPGDIR=\"$(gpgdir)\"
 
 AM_CFLAGS = \
 	-pedantic \
diff --git a/src/pactree.c b/src/pactree.c
index 8b77f05..f7c4d39 100644
--- a/src/pactree.c
+++ b/src/pactree.c
@@ -125,6 +125,7 @@ static int searchsyncs = 0;
 static int debug = 0;
 static const char *dbpath = DBPATH;
 static const char *configfile = CONFFILE;
+static const char *gpgdir = GPGDIR;
 
 void cb_log(alpm_loglevel_t level, const char *fmt, va_list args)
 {
@@ -545,6 +546,9 @@ int main(int argc, char *argv[])
 		alpm_option_set_logcb(handle, cb_log);
 	}
 
+	/* no need to fail on error */
+	alpm_option_set_gpgdir(handle, gpgdir);
+
 	if(searchsyncs) {
 		if(register_syncs() != 0) {
 			cleanup(1);
-- 
2.24.1


More information about the pacman-contrib mailing list