Subject: bug#36301: Package-Requires should support multiple lines

From: Thomas Fitzsimmons <[email-masked]>
Date: Fri, 16 Aug 2019 17:42:14 -0400

Hi,

Thomas Fitzsimmons <[email-masked]> writes:

> Glenn Morris <[email-masked]> writes:
>
>> This causes test failures; ref
>> https://hydra.nixos.org/build/98765298
>
> OK, thanks for reporting.  I reverted the patch for now.

Here is the updated patch that fixes the test failures the prior one
introduced.  "make check" still fails with and without the patch, but
only on some unrelated Tramp and D-Bus tests.  If this looks OK, I'll
push it to master; in particular I wonder if there's a better way to do
the equivalent of mapconcat but produce nil on a nil input sequence.

Thanks,
Thomas

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index a72522ad8f..b0416cb002 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1028,6 +1028,7 @@ package--prepare-dependencies
               deps))))
 
 (declare-function lm-header "lisp-mnt" (header))
+(declare-function lm-header-multiline "lisp-mnt" (header))
 (declare-function lm-homepage "lisp-mnt" (&optional file))
 (declare-function lm-keywords-list "lisp-mnt" (&optional file))
 (declare-function lm-maintainer "lisp-mnt" (&optional file))
@@ -1054,7 +1055,9 @@ package-buffer-info
     (narrow-to-region start (point))
     (require 'lisp-mnt)
     ;; Use some headers we've invented to drive the process.
-    (let* ((requires-str (lm-header "package-requires"))
+    (let* ((requires-str (lm-header-multiline "package-requires"))
+           (requires-str (when requires-str
+                           (mapconcat 'identity requires-str " ")))
            ;; Prefer Package-Version; if defined, the package author
            ;; probably wants us to use it.  Otherwise try Version.
            (pkg-version