From patchwork Tue Jan 7 01:16:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward E X-Patchwork-Id: 1434 X-Patchwork-Delegate: johannes@kyriasis.com Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id 43D4216128E1F for ; Tue, 7 Jan 2020 01:17:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on apollo.archlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED=0.1, DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,FREEMAIL_FROM=0.5, MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_NONE=-0.0001,SPF_HELO_NONE=0.001, T_DMARC_POLICY_NONE=0.01,T_DMARC_SIMPLE_DKIM=0.01 autolearn=ham autolearn_force=no version=3.4.3 X-Spam-BL-Results: [127.0.0.10] [127.0.9.0] [127.0.0.14] Received: from orion.archlinux.org (orion.archlinux.org [IPv6:2a01:4f8:160:6087::1]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Tue, 7 Jan 2020 01:17:06 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id 0E38517E9EE2BF; Tue, 7 Jan 2020 01:17:02 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 00E6417E9EE2BB; Tue, 7 Jan 2020 01:17:00 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Nn1etYhT Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id E023C2BE62; Tue, 7 Jan 2020 01:16:59 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Nn1etYhT Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 6BA982BE61 for ; Tue, 7 Jan 2020 01:16:56 +0000 (UTC) Received: from mail-yw1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by luna.archlinux.org (Postfix) with ESMTPS for ; Tue, 7 Jan 2020 01:16:56 +0000 (UTC) Received: by mail-yw1-xc43.google.com with SMTP id v126so22729620ywc.10 for ; Mon, 06 Jan 2020 17:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UZyvJPmTKqXuB6wEyjQNec32Y87IZ4LiCzNDZY4UXWE=; b=Nn1etYhTfiXRFzibNRhM11IQCWJThjsd+Hz7VfpvuO4S/EnX/G+lQFSHuVsZKhlUEQ BNsd63eMrOMGAL9p96GamtoVOh7kNIM1zMTGMEVhG8Xe4OZfTllmuFPy2vELPyiV04Lf 4g7Z0eDPqBSiI2po+dy7FnUCD7ISKSOHHJyzjysnxi7en6dBzqiNMlqKwhHyfkvk6BTR LmfcmXY6wvwovA66azFIKiIQCRoPTe4M/C8AphNYPXzSyUJx04InlzZYdcnYVYJQZwdW /gyxU/ugaFnhqQ8q0BdrJlTIfLaQq9y9og6wfguShEZGUdsT6kvlnrUzqLilFujZ4upm Mj4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UZyvJPmTKqXuB6wEyjQNec32Y87IZ4LiCzNDZY4UXWE=; b=AIo0mZpJ5Kb5US626MvUXN6rrNma2dduXmXZduIqSLAq0jeYM7rRq2fxDnAH3T1q2q JQ48c56gB0TZDgOHg7sbe5lmu3JvjaaP97EXOaW1IIqEgZtfHgX43IIY4TToXorN80MA eugJcXdk0R1wUGu2aagmldNbrAHMWNLsq8zFsg/avWHb9k8h1LUPal9rzSOjk5RIKWdJ 9w7iQjJFQzm3X2cJUdMcoYi+nDNMxnDdwk3apypjZw6gavQZqdnYZHeo+AlYWkdZ7mrO TSYooaDIKAdURG+d78MSQGC5X+jr7x039LrwSQ32yk6ew7hC3FRC4A94TYa6tBxzBCdx fFSw== X-Gm-Message-State: APjAAAUJIo+uyG6d3kK63KSZjZKnZ2xwGKaZK+1spk6vD3Jg9Zsi8k+v D/H3x5zGcouuQXMPeYHKJPRYvjaT X-Google-Smtp-Source: APXvYqwbqqTGoc0n0/IIZvl2odcn6CGBS4ZcylSXKC4txMCfOAqn3NQT26iJBfXgxJ3rF4+WsOiLaA== X-Received: by 2002:a81:f50:: with SMTP id 77mr82247952ywp.340.1578359815010; Mon, 06 Jan 2020 17:16:55 -0800 (PST) Received: from localhost.localdomain ([172.58.139.245]) by smtp.gmail.com with ESMTPSA id l74sm29103336ywc.45.2020.01.06.17.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 17:16:54 -0800 (PST) From: Edward E To: pacman-contrib@lists.archlinux.org Subject: [PATCH v2 2/2] pactree: Add --gpgdir, set the gpg directory Date: Mon, 6 Jan 2020 19:16:43 -0600 Message-Id: <20200107011643.19462-2-develinthedetail@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107011643.19462-1-develinthedetail@gmail.com> References: <20200107011643.19462-1-develinthedetail@gmail.com> MIME-Version: 1.0 X-BeenThere: pacman-contrib@lists.archlinux.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for pacman-contrib development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Edward E Errors-To: pacman-contrib-bounces@lists.archlinux.org Sender: "pacman-contrib" Addresses https://github.com/msys2/MSYS2-packages/issues/1720 Signed-off-by: Edward E --- Anticipating that someone might need to override the default, this updated patch also adds a --gpgdir option. Both patches tested on msys2/Win10. doc/pactree.8.txt | 4 ++++ src/Makefile.am | 4 +++- src/pactree.c | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/doc/pactree.8.txt b/doc/pactree.8.txt index 57a91cb..296d04e 100644 --- a/doc/pactree.8.txt +++ b/doc/pactree.8.txt @@ -64,6 +64,10 @@ Options *\--debug*:: Print log messages produced by libalpm. +*\--gpgdir *:: + Specify an alternate GnuPG directory for verifying database signatures + (default is /etc/pacman.d/gnupg). + See Also -------- 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 feac956..5bc0032 100644 --- a/src/pactree.c +++ b/src/pactree.c @@ -106,7 +106,8 @@ static struct color_choices no_color = { /* long operations */ enum { OP_CONFIG = 1000, - OP_DEBUG + OP_DEBUG, + OP_GPGDIR }; /* globals */ @@ -125,6 +126,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) { @@ -253,7 +255,8 @@ static void usage(void) " -u, --unique show dependencies with no duplicates (implies -l)\n" " -v, --version display the version\n" " --config set an alternate configuration file\n" - " --debug display debug messages\n"); + " --debug display debug messages\n" + " --gpgdir set an alternate home directory for GnuPG\n"); } static void version(void) @@ -281,6 +284,8 @@ static int parse_options(int argc, char *argv[]) {"config", required_argument, 0, OP_CONFIG}, {"debug", no_argument, 0, OP_DEBUG}, + {"gpgdir", required_argument, 0, OP_GPGDIR}, + {0, 0, 0, 0} }; @@ -301,6 +306,9 @@ static int parse_options(int argc, char *argv[]) case OP_DEBUG: debug = 1; break; + case OP_GPGDIR: + gpgdir = optarg; + break; case 'a': style = &graph_default; break; @@ -539,6 +547,9 @@ int main(int argc, char *argv[]) alpm_option_set_logcb(handle, cb_log); } + /* no need to fail on error here */ + alpm_option_set_gpgdir(handle, gpgdir); + if(searchsyncs) { if(register_syncs() != 0) { cleanup(1);