From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bruno =?UTF-8?Q?F=C3=A9lix?= Rezende Ribeiro Newsgroups: gmane.emacs.bugs Subject: bug#37548: Implement sanitation of single-file package long description Date: Sun, 29 Sep 2019 02:42:54 -0300 Message-ID: <87eezzwtcx.fsf@oitofelix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="10963"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: 37548@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 29 07:43:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iERzH-0002gP-HC for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Sep 2019 07:43:15 +0200 Original-Received: from localhost ([::1]:36926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iERzF-0006TK-PM for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Sep 2019 01:43:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47872) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iERz7-0006TD-BE for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:43:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iERz5-0008IQ-23 for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:43:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43227) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iERz4-0008I8-QG for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iERz4-0005qs-Mr for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bruno =?UTF-8?Q?F=C3=A9lix?= Rezende Ribeiro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Sep 2019 05:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37548 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156973578222485 (code B ref -1); Sun, 29 Sep 2019 05:43:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2019 05:43:02 +0000 Original-Received: from localhost ([127.0.0.1]:52048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iERz3-0005qb-Ku for submit@debbugs.gnu.org; Sun, 29 Sep 2019 01:43:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:42237) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iERz1-0005qT-HJ for submit@debbugs.gnu.org; Sun, 29 Sep 2019 01:43:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47860) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iERz0-0006T8-3U for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:42:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iERyz-0008CU-UZ for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:42:58 -0400 Original-Received: from [189.15.124.78] (port=49010 helo=felix-laptop) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1iERyz-0006pg-8E for bug-gnu-emacs@gnu.org; Sun, 29 Sep 2019 01:42:57 -0400 X-Face: %,T7Hsg=SK$Zh)wiU4Qdv9-fZ26Pf5*+}Ld,{LeV'Cq-1?=kA"hc,'i""S85]g; _W+{nZfx 2GnAMS1K\E_E&:{h[wQd+Tqj5#PtH:W&8^crA0>i?nmD7hOL$K".`@An_8.7gaObQLlMy0\%%I0Jp. Lue$J0B Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACcElEQVRYw93YzXHCQAwF4G0h Fw4caYEW0oJbSAtuwa1AldGg8PKQtP+GMHkHxkDG/qLVrtek6x65UCZPleYdH485HA4zrHHQ4R5F cPSTl4L0qigJDoxpoFRpUmMGKzR1sbpB3DTLsnzd83nL+XyeNHWDoBHEeg9YQlQWCtZrSmOa1YVN ktDkiz0FwmDJVbd7CizTUhcXLByDINXIiGyUQqnkL8Nm8iCY5CD1lkf+9UYQFykEhb7UqEGFeLwK Q6YgnXTovEtDZkHGZFpbR21nkLlhlUFqWig63XYGyevxeGSQXFjXG4lclSnyyekW/Ur+jFfzWRD6 31RoeQxAnxQB6cErQBKsywDpW6Yo93UgFAMg3DqgMaCqaRzEc4pBPh50fdxk9oF4zvPCCBDml6fo sIagnClVNTmQn/BAmOXxn4LMXQan45vrJCg07QPC/JI8BeT3BjidLNkGpOu1anSNbgd5U6qWx4Ak DOL1RotkTLMV8ouEWYc8yNzezcBNVchv5MIK8VKEHjKrM0D+malvyFoqxG2kLBHIMCmo3EAjFfLl MSAeNSzZoeZZIH/SHAim3I1MMwvC7syAeBuEyV++s3aA2suDHkI7nyi6UUTCHwLGKxSCsFjzzpV3 ZNUihc+s9QqF7YwtEW88zAMQt5Ec7AkKx4uvWjChwaujFoAay+PLUHhQ5LQXKeVu7y2a0GRY/LZq +gG1jBROap4Sy0XyX1VNyf8Ekav8lom5dqFyocn0k62QOenWkBC05uNNDyCv2fpj2mUtxve7vGZB 21CqI1X1BaBhTfiz1QDL9tAMaN70C8L8ei/Q32rYlN6hgdj0DS+u5+J4AqFYAAAAAElFTkSuQmCC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:167602 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Emacs developers, The inlined patch implements sanitation of single-file package=E2=80=99s lo= ng description which is derived from the package=E2=80=99s commentary header section. It removes the commentary header, the double semicolon prefix of each line, trailing new-lines and trailing white-space. I think this is the usual practice for packages in GNU ELPA and MELPA repositories. Furthermore it=E2=80=99s aligned with the intended behavior for multi-file packages which is to read the long description from a README file[1] --- which presumably does not have commentary sections nor double semicolon prefixes. Please, let me know of any changes required. Thanks! PS: For some reason I was not able to use a single regexp within a single invocation of =E2=80=98replace-regexp-in-string=E2=80=99, as would b= e natural. It simply didn=E2=80=99t work as expected. It=E2=80=99s working fine now w= ith nested calls. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=package-x-single-file-package-long-description-sanitization.patch diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index 2815be3..7fe6f6d 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -159,6 +159,7 @@ DESCRIPTION is the text of the news item." (declare-function lm-commentary "lisp-mnt" (&optional file)) (defvar tar-data-buffer) +(defvar lm-commentary-header) (defun package-upload-buffer-internal (pkg-desc extension &optional archive-url) "Upload a package whose contents are in the current buffer. @@ -204,7 +205,17 @@ if it exists." (split-version (package-desc-version pkg-desc)) (commentary (pcase file-type - ('single (lm-commentary)) + ('single (replace-regexp-in-string ; Get rid of... + "[[:blank:]]*$" "" ; trailing white-space + (replace-regexp-in-string + (format "%s\\|%s\\|%s" + ;; commentary header + (concat "^;;;[[:blank:]]*\\(" + lm-commentary-header + "\\):[[:blank:]\n]*") + "^;;[[:blank:]]*" ; double semicolon prefix + "[[:blank:]\n]*\\'") ; trailing new-lines + "" (lm-commentary)))) ('tar nil))) ;; FIXME: Get it from the README file. (extras (package-desc-extras pkg-desc)) (pkg-version (package-version-join split-version)) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Footnotes:=20 [1] I=E2=80=99ve implemented that in bug#37546. --=20 88888 FFFFF Bruno F=C3=A9lix Rezende Ribeiro (oitofelix) [0x28D618AF] 8 8 F http://oitofelix.freeshell.org/ 88888 FFFF mailto:oitofelix@gnu.org 8 8 F irc://chat.freenode.org/oitofelix 88888 F xmpp://oitofelix@riseup.net --=-=-=--