From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jens Lechtenboerger Newsgroups: gmane.emacs.devel Subject: Re: GnuPG homedir and package.el? Date: Sat, 01 Apr 2017 18:08:20 +0200 Message-ID: <87y3vkcdqj.fsf@informationelle-selbstbestimmung-im-internet.de> References: <87zih1gfjh.fsf@informationelle-selbstbestimmung-im-internet.de> <87k27rejkw.fsf@lifelogs.com> <87lgs2esh6.fsf@informationelle-selbstbestimmung-im-internet.de> <87k27k9iil.fsf@lifelogs.com> <874lynsv2p.fsf@informationelle-selbstbestimmung-im-internet.de> <87bmso8oyt.fsf@informationelle-selbstbestimmung-im-internet.de> <87o9wggrbl.fsf@informationelle-selbstbestimmung-im-internet.de> <83tw68438k.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1491062935 19408 195.159.176.226 (1 Apr 2017 16:08:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Apr 2017 16:08:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 01 18:08:48 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuLZw-0003pg-Rj for ged-emacs-devel@m.gmane.org; Sat, 01 Apr 2017 18:08:41 +0200 Original-Received: from localhost ([::1]:52184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuLa2-0004c2-U1 for ged-emacs-devel@m.gmane.org; Sat, 01 Apr 2017 12:08:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuLZq-0004bm-M1 for emacs-devel@gnu.org; Sat, 01 Apr 2017 12:08:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuLZp-0003NZ-4P for emacs-devel@gnu.org; Sat, 01 Apr 2017 12:08:34 -0400 Original-Received: from mx1.mailbox.org ([80.241.60.212]:46341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cuLZl-0003EU-42; Sat, 01 Apr 2017 12:08:29 -0400 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 7009445CED; Sat, 1 Apr 2017 18:08:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id Phf5ENheSCct; Sat, 1 Apr 2017 18:08:22 +0200 (CEST) OpenPGP: id=0xA142FD84; url=https://www.informationelle-selbstbestimmung-im-internet.de/A142FD84.asc Mail-Followup-To: Eli Zaretskii , emacs-devel@gnu.org In-Reply-To: <83tw68438k.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 01 Apr 2017 17:22:19 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.241.60.212 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213583 Archived-At: --=-=-= Content-Type: text/plain On 2017-04-01, at 17:22, Eli Zaretskii wrote: > They should be mentioned in NEWS, definitely. > > As for the manual (I guess you meant the user manual), it depends on > whether you think the added option is important for users to know > about. (Btw, your ':version' rag is incorrect, it should be "26.1".) The attached patch contains the above changes. Best wishes Jens --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Introduce-customizable-variable-package-gnupghome-di.patch >From e7997d0e3bac084bbc1097ec7a3186146f77127d Mon Sep 17 00:00:00 2001 From: Jens Lechtenboerger Date: Sat, 1 Apr 2017 17:57:54 +0200 Subject: [PATCH] Introduce customizable variable package-gnupghome-dir * lisp/emacs-lisp/package.el (package-import-keyring, package--check-signature-content, package-check-signature): Use new variable package-gnupghome-dir to control which GnuPG homedir to use. * doc/emacs/package.texi: Mention this. * etc/NEWS: Mention this. --- doc/emacs/package.texi | 5 +++-- etc/NEWS | 7 +++++++ lisp/emacs-lisp/package.el | 28 +++++++++++++++++++--------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index d6f88aa..de8f4d2 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -200,8 +200,9 @@ Package Installation on how you can obtain their public key. One way is to download the key from a server such as @url{http://pgp.mit.edu/}. Use @kbd{M-x package-import-keyring} to import the key into Emacs. -Emacs stores package keys in the @file{gnupg} subdirectory -of @code{package-user-dir}. +Emacs stores package keys in the directory specified by the variable +@code{package-gnupghome-dir}, by default in the @file{gnupg} +subdirectory of @code{package-user-dir}. The public key for the GNU package archive is distributed with Emacs, in the @file{etc/package-keyring.gpg}. Emacs uses it automatically. diff --git a/etc/NEWS b/etc/NEWS index bfd7d2b..2bc3e18 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -629,6 +629,13 @@ In 'visual-line-mode' it will look for the true beginning of a header while in non-'visual-line-mode' it will move the point to the indented header's value. +** Package + ++++ +*** The new variable 'package-gnupghome-dir' has been added to control +where the GnuPG home directory (used for signature verification) is +located. + ** Tramp +++ diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8d5fac9..12635b3 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -305,6 +305,16 @@ package-directory-list (declare-function epg-find-configuration "epg-config" (protocol &optional no-cache program-alist)) +(defcustom package-gnupghome-dir (expand-file-name "gnupg" package-user-dir) + "Directory containing GnuPG keyring or nil. +This variable specifies the GnuPG home directory used by package. +That directory is passed via the option \"--homedir\" to GnuPG. +If nil, do not use the option \"--homedir\", but stick with GnuPG's +default directory." + :type 'directory + :risky t + :version "26.1") + (defcustom package-check-signature (if (and (require 'epg-config) (epg-find-configuration 'OpenPGP)) @@ -1207,9 +1217,9 @@ package--check-signature-content "Check signature CONTENT against STRING. SIG-FILE is the name of the signature file, used when signaling errors." - (let* ((context (epg-make-context 'OpenPGP)) - (homedir (expand-file-name "gnupg" package-user-dir))) - (setf (epg-context-home-directory context) homedir) + (let ((context (epg-make-context 'OpenPGP))) + (when package-gnupghome-dir + (setf (epg-context-home-directory context) package-gnupghome-dir)) (condition-case error (epg-verify-string context content string) (error (package--display-verify-error context sig-file) @@ -1236,7 +1246,7 @@ package--check-signature "Check signature of the current buffer. Download the signature file from LOCATION by appending \".sig\" to FILE. -GnuPG keyring is located under \"gnupg\" in `package-user-dir'. +GnuPG keyring location depends on `package-gnupghome-dir'. STRING is the string to verify, it defaults to `buffer-string'. If ASYNC is non-nil, the download of the signature file is done asynchronously. @@ -1476,11 +1486,11 @@ package-import-keyring "Import keys from FILE." (interactive "fFile: ") (setq file (expand-file-name file)) - (let ((context (epg-make-context 'OpenPGP)) - (homedir (expand-file-name "gnupg" package-user-dir))) - (with-file-modes 448 - (make-directory homedir t)) - (setf (epg-context-home-directory context) homedir) + (let ((context (epg-make-context 'OpenPGP))) + (when package-gnupghome-dir + (with-file-modes 448 + (make-directory package-gnupghome-dir t)) + (setf (epg-context-home-directory context) package-gnupghome-dir)) (message "Importing %s..." (file-name-nondirectory file)) (epg-import-keys-from-file context file) (message "Importing %s...done" (file-name-nondirectory file)))) -- 2.7.4 --=-=-=--