• [PATCH] dh-elpa: allow parsing of multiline Package-Requires headers

    From Aymeric Agon-Rambosson@21:1/5 to All on Thu Dec 28 14:50:01 2023
    Hello team,

    dh-elpa is not currently able to parse correctly a multiline
    Package-Requires header.

    For instance, on the following header (taken from magit.el) :

    ;; Package-Requires: (
    ;; (emacs "25.1")
    ;; (compat "29.1.4.4")
    ;; (dash "2.19.1")
    ;; (git-commit "3.3.0")
    ;; (magit-section "3.3.0")
    ;; (seq "2.24")
    ;; (transient "0.5.0")
    ;; (with-editor "3.3.2"))

    The form (lm-header "package-requires"), used in function
    dhelpa-buffer-info, when evaluated in the magit.el buffer, returns
    "(", which is not very useful, and which makes dh-elpa error out
    later (Something to the effect of "End of file while parsing",
    because of an unbalanced parenthesis).

    The patch proposes to use lm-header-multiline instead, which is
    capable of correctly parsing multiline headers.

    I have pushed the patch to the temporary "temp-ricorambo" branch
    of the salsa repo. I would be grateful for someone to review and
    eventually merge it. I am also attaching it.

    Thank you very much in advance.

    Best,

    Aymeric

    P.S. The comment of dhelpa-buffer-info mentions that the function
    is inspired/copied from package-buffer-info, in the package
    library. It turns out that the package-buffer-info has been
    modified by upstream some time ago to use lm-header-multiline. So
    another solution would be to rebase dhelpa-buffer-info onto the
    newer package-buffer-info.


    diff --git a/debian/changelog b/debian/changelog
    index 9f30538..f650b1f 100644
    --- a/debian/changelog
    +++ b/debian/changelog
    @@ -1,3 +1,11 @@
    +dh-elpa (2.0.18) unstable; urgency=medium
    +
    + * Team upload.
    + * Get Package-Requires with lm-header-multiline (some upstream
    + maintainers specify one dependency per line).
    +
    + -- Aymeric Agon-Rambosson <aymeric.agon@yandex.com> Mon, 25 Dec 2023 13:17:44 +0100
    +
    dh-elpa (2.1.1) experimental; urgency=medium

    * Remove /usr/share/$flavor/site-lisp/elpa (from emacsen-remove)
    diff --git a/dh-elpa.el b/dh-elpa.el
    index b45734c..c30c954 100644
    --- a/dh-elpa.el
    +++ b/dh-elpa.el
    @@ -83,7 +83,9 @@ set and disagree."
    (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-list (lm-header-multiline "package-requires"))
    + (requires-str (when requires-list
    + (mapconcat 'identity requires-list " ")))
    ;; Prefer Package-Version; if defined, the package author
    ;;