From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: package-vc support for :files keyword Date: Wed, 27 Sep 2023 14:03:15 +0000 Message-ID: <87pm231zoc.fsf@posteo.net> References: <87ttrshrib.fsf@hyperspace> <871qev6e53.fsf@posteo.net> <87r0mviltd.fsf@hyperspace> <871qevbhru.fsf@posteo.net> <87o7hzi82q.fsf@hyperspace> <87pm2ebldd.fsf@posteo.net> <87o7hyl01m.fsf@hyperspace> <87y1h18flc.fsf@posteo.net> <87jzsgm82h.fsf@hyperspace> <87wmwfbq2o.fsf@posteo.net> <87h6niml91.fsf@hyperspace> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23802"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tony Zorman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 27 16:04:18 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlV9F-0005x4-5x for ged-emacs-devel@m.gmane-mx.org; Wed, 27 Sep 2023 16:04:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlV8Q-0002A1-C3; Wed, 27 Sep 2023 10:03:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlV8N-00029X-74 for emacs-devel@gnu.org; Wed, 27 Sep 2023 10:03:24 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlV8K-0001C4-QU for emacs-devel@gnu.org; Wed, 27 Sep 2023 10:03:22 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 356EB240104 for ; Wed, 27 Sep 2023 16:03:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1695823396; bh=Ep8ubo7a62S45PY/k+kxA/fmRoWmZgQ+jwQrOATApMw=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=UJ2wAe9SaCBfvhnwtll5iSc4OnQpaj2gsELrfJlJFIIWh3k/5CFE+YdxXAUEdy1Fd w+twayiP7bI4pk5Gy7D6QHA8fxy6P0aZELyax+vVuQMvC959yjGYd/XNDOfShw1UZn 7MNv/krO9yUacVOix4MoiHB4dar9RmyvQgzKnIBOtFEulNPMfbDUChJu6EZa0L51st 6+GU5L3kP7eNi4spGUfKsgrLamsZ6KiJk4jf54mjPJ/wmVfWTY7gbKuq0HMT3k3CGB VXvagABum712HdKNFR+CheNn/sPI1uLywCOyNzHSVaFfnrvvVtDaBvfx+mb4Yt5Vm/ t+dxgV7p/B07w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RwdcM4dgrz6v56; Wed, 27 Sep 2023 16:03:15 +0200 (CEST) In-Reply-To: <87h6niml91.fsf@hyperspace> (Tony Zorman's message of "Mon, 25 Sep 2023 15:32:26 +0200") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:311109 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tony Zorman writes: > On Sun, Sep 24 2023 16:31, Philip Kaludercic wrote: >> Tony Zorman writes: >> >>> On Wed, Sep 20 2023 07:32, Philip Kaludercic wrote: >>>> + (unless (string-match-p ignored-files file) >>> >>> One thing that did jump out to me just now, which I hadn't considered >>> before: when ignored-files is the empty string, this will always match >>> any file=E2=80=94not what we want :) >> >> Do you mean because the empty glob expression doesn't match everything, >> but the empty regular expression does? >> >> The easiest solution seems to be to just check if the empty string is >> listed and handle that separately (whatever the correct behaviour is in >> that case), but on the other hand, why should a user list an empty >> string in the list of ignored files? > > The point I was making was that `(mapconcat (=CE=BB=E2=80=A6) nil) =E2=89= =A1 ""`, since > mapconcat always returns a string. Even if there were no :ignored-files > listed, the ignored-files variable would then be the empty string, > matching each and every file. Oops, right, in that case this should be preferable: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index a8393cb7e75..d100e0bcb58 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -213,7 +213,7 @@ package-vc--desc->spec name for PKG-DESC." (alist-get (setq name (or name (package-desc-name pkg-desc))) - (if (and (package-desc-archive pkg-desc) + (if (and pkg-desc (package-desc-archive pkg-desc) (not (alist-get name package-vc-selected-packages nil nil #'string=))) (alist-get (intern (package-desc-archive pkg-desc)) @@ -501,7 +501,8 @@ package-vc--unpack-1 autoloads, generating a package description file (used to identify a package as a VC package later on), building documentation and marking the package as installed." - (let (missing) + (let ((pkg-spec (package-vc--desc->spec pkg-desc)) + missing) ;; Remove any previous instance of PKG-DESC from `package-alist' (let ((pkgs (assq (package-desc-name pkg-desc) package-alist))) (when pkgs @@ -510,17 +511,29 @@ package-vc--unpack-1 ;; In case the package was installed directly from source, the ;; dependency list wasn't know beforehand, and they might have ;; to be installed explicitly. - (let ((deps '())) + (let ((ignored-files + (if (plist-get pkg-spec :ignored-files) + (mapconcat + (lambda (ignore) + (wildcard-to-regexp + (if (string-match-p "\\`/" ignore) + (concat pkg-dir ignore) + (concat "*/" ignore)))) + (plist-get pkg-spec :ignored-files) + "\\|") + regexp-unmatchable)) + (deps '())) (dolist (file (directory-files pkg-dir t "\\.el\\'" t)) - (with-temp-buffer - (insert-file-contents file) - (when-let* ((require-lines (lm-header-multiline "package-requires"))) - (thread-last - (mapconcat #'identity require-lines " ") - package-read-from-string - package--prepare-dependencies - (nconc deps) - (setq deps))))) + (unless (string-match-p ignored-files file) + (with-temp-buffer + (insert-file-contents file) + (when-let* ((require-lines (lm-header-multiline "package-requires"))) + (thread-last + (mapconcat #'identity require-lines " ") + package-read-from-string + package--prepare-dependencies + (nconc deps) + (setq deps)))))) (dolist (dep deps) (cl-callf version-to-list (cadr dep))) (setf missing (package-vc-install-dependencies (delete-dups deps))) @@ -529,8 +542,7 @@ package-vc--unpack-1 missing))) (let ((default-directory (file-name-as-directory pkg-dir)) - (pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir)) - (pkg-spec (package-vc--desc->spec pkg-desc))) + (pkg-file (expand-file-name (package--description-file pkg-dir) pkg-dir))) ;; Generate autoloads (let* ((name (package-desc-name pkg-desc)) (auto-name (format "%s-autoloads.el" name)) --=-=-=--