unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>, 66624@debbugs.gnu.org
Cc: cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com
Subject: [bug#66624] [PATCH emacs-team 01/15] guix: emacs-build-system: Process package source in build tree.
Date: Mon, 23 Oct 2023 12:41:29 +0400	[thread overview]
Message-ID: <8734y13f46.fsf@trop.in> (raw)
In-Reply-To: <c2be6951978bbb6d100caaf5d2ddfc52d3375169.1697694142.git.liliana.prikler@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6794 bytes --]

On 2023-10-19 06:06, Liliana Marie Prikler wrote:

> * guix/build/emacs-build-system.scm (ensure-package-description)
> (patch-el-files, make-autoloads): Operate on the current working directory,
> either implicitly, or through (getcwd).

Sounds reasonable and seems to simplify build phases.

> (enable-autoloads-compilation): Deleted variable, logic moved into
> make-autoloads.
> (%standard-phases): Adjust accordingly.
> ---
>  guix/build/emacs-build-system.scm | 85 +++++++++++++------------------
>  1 file changed, 34 insertions(+), 51 deletions(-)
>
> diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
> index 3808b60445..aa083c6409 100644
> --- a/guix/build/emacs-build-system.scm
> +++ b/guix/build/emacs-build-system.scm
> @@ -132,29 +132,25 @@ (define* (build #:key outputs inputs #:allow-other-keys)
>      (parameterize ((%emacs emacs))
>        (emacs-compile-directory (elpa-directory out)))))
>  
> -(define* (patch-el-files #:key outputs #:allow-other-keys)
> -  "Substitute the absolute \"/bin/\" directory with the right location in the
> -store in '.el' files."
> -
> -  (let* ((out (assoc-ref outputs "out"))
> -         (elpa-name-ver (store-directory->elpa-name-version out))
> -         (el-dir (string-append out %install-dir "/" elpa-name-ver))
> -         (el-files (find-files (getcwd) "\\.el$")))
> -    (define (substitute-program-names)
> -      (substitute* el-files
> -        (("\"/bin/([^.]\\S*)\"" _ cmd-name)
> -         (let ((cmd (which cmd-name)))
> -           (unless cmd
> -             (error "patch-el-files: unable to locate " cmd-name))
> -           (string-append "\"" cmd "\"")))))
> -
> -    (with-directory-excursion el-dir
> -      ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still
> -      ;; ISO-8859-1-encoded.
> -      (unless (false-if-exception (substitute-program-names))
> -        (with-fluids ((%default-port-encoding "ISO-8859-1"))
> -          (substitute-program-names))))
> -    #t))
> +(define* (patch-el-files #:key inputs outputs #:allow-other-keys)
> +  "Substitute the absolute \"/bin/\" and \"/sbin\" directories with the right
> +locations in the store in '.el' files."
> +
> +  (define substitute-program-names
> +    (let ((el-files (find-files (getcwd) "\\.el$")))
> +      (lambda ()
> +        (substitute* el-files
> +          (("\"/(s?bin/[^.]\\S*)\"" _ cmd)
> +           (let ((cmd (search-input-file inputs cmd)))
> +             (unless cmd
> +               (error "patch-el-files: unable to locate " (basename cmd)))
> +             (string-append "\"" cmd "\"")))))))
> +
> +  (unless (false-if-exception (substitute-program-names))
> +    ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still
> +    ;; ISO-8859-1-encoded.
> +    (with-fluids ((%default-port-encoding "ISO-8859-1"))
> +      (substitute-program-names))))
>  
>  (define (find-root-library-file name)
>    (let loop ((parts (string-split
> @@ -224,10 +220,8 @@ (define* (ensure-package-description #:key outputs #:allow-other-keys)
>        (emacs-batch-edit-file (string-append name ".el")
>          %write-pkg-file-form)))
>  
> -  (let* ((out (assoc-ref outputs "out"))
> -         (elpa-name-ver (store-directory->elpa-name-version out)))
> -    (with-directory-excursion (elpa-directory out)
> -      (and=> (find-root-library-file elpa-name-ver) write-pkg-file))))
> +  (let ((name (store-directory->elpa-name-version (assoc-ref outputs "out"))))
> +    (and=> (find-root-library-file name) write-pkg-file)))
>  
>  (define* (check #:key tests? (test-command '("make" "check"))
>                  (parallel-tests? #t) #:allow-other-keys)
> @@ -306,24 +300,15 @@ (define* (move-doc #:key outputs #:allow-other-keys)
>                    info-files)))
>      #t))
>  
> -(define* (make-autoloads #:key outputs inputs #:allow-other-keys)
> +(define* (make-autoloads #:key outputs #:allow-other-keys)
>    "Generate the autoloads file."
> -  (let* ((emacs (search-input-file inputs "/bin/emacs"))
> -         (out (assoc-ref outputs "out"))
> -         (elpa-name-ver (store-directory->elpa-name-version out))
> -         (elpa-name (package-name->name+version elpa-name-ver))
> -         (el-dir (elpa-directory out)))
> -    (parameterize ((%emacs emacs))
> -      (emacs-generate-autoloads elpa-name el-dir))))
> -
> -(define* (enable-autoloads-compilation #:key outputs #:allow-other-keys)
> -  "Remove the NO-BYTE-COMPILATION local variable embedded in the generated
> -autoload files."
> -  (let* ((out (assoc-ref outputs "out"))
> -         (autoloads (find-files out "-autoloads.el$")))
> -    (substitute* autoloads
> -      ((";; no-byte-compile.*") ""))
> -    #t))
> +  (emacs-generate-autoloads
> +   (package-name->name+version (store-directory->elpa-name-version
> +                                (assoc-ref outputs "out")))
> +   (getcwd))
> +  ;; Ensure that autoloads can be byte-compiled.
> +  (substitute* (find-files "." "-autoloads\\.el$")
> +    ((";; no-byte-compile.*") "")))
>  
>  (define* (validate-compiled-autoloads #:key outputs #:allow-other-keys)
>    "Verify whether the byte compiled autoloads load fine."
> @@ -358,7 +343,11 @@ (define (elpa-directory store-dir)
>  (define %standard-phases
>    (modify-phases gnu:%standard-phases
>      (replace 'unpack unpack)
> +    (add-after 'unpack 'ensure-package-description
> +      ensure-package-description)
>      (add-after 'unpack 'expand-load-path expand-load-path)
> +    (add-after 'unpack 'patch-el-files patch-el-files)
> +    (add-after 'expand-load-path 'make-autoloads make-autoloads)
>      (add-after 'expand-load-path 'add-install-to-native-load-path
>        add-install-to-native-load-path)
>      (delete 'bootstrap)
> @@ -366,14 +355,8 @@ (define %standard-phases
>      (delete 'build)
>      (replace 'check check)
>      (replace 'install install)
> -    (add-after 'install 'make-autoloads make-autoloads)
> -    (add-after 'make-autoloads 'enable-autoloads-compilation
> -      enable-autoloads-compilation)
> -    (add-after 'enable-autoloads-compilation 'patch-el-files patch-el-files)
> -    (add-after 'patch-el-files 'ensure-package-description
> -      ensure-package-description)
>      ;; The .el files are byte compiled directly in the store.
> -    (add-after 'ensure-package-description 'build build)
> +    (add-after 'install 'build build)
>      (add-after 'build 'validate-compiled-autoloads validate-compiled-autoloads)
>      (add-after 'validate-compiled-autoloads 'move-doc move-doc)))

I didn't spot any obvious issues with the patch series.  Thank you for working on it!

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2023-10-23  8:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  5:42 [bug#66624] [PATCH emacs-team 00/15] Start reworking emacs-build-system Liliana Marie Prikler
2023-10-19  4:06 ` [bug#66624] [PATCH emacs-team 01/15] guix: emacs-build-system: Process package source in build tree Liliana Marie Prikler
2023-10-23  8:41   ` Andrew Tropin [this message]
2023-11-01 19:54     ` Liliana Marie Prikler
2023-11-02  9:32       ` bug#66624: " Liliana Marie Prikler
2023-10-19  4:10 ` [bug#66624] [PATCH emacs-team 09/15] gnu: emacs-geiser-guile: Process autoloads in-tree Liliana Marie Prikler
2023-10-19  4:14 ` [bug#66624] [PATCH emacs-team 02/15] gnu: skktools: Build autoloads before installing them Liliana Marie Prikler
2023-10-19  4:29 ` [bug#66624] [PATCH emacs-team 03/15] gnu: translate-shell: " Liliana Marie Prikler
2023-10-19  4:30 ` [bug#66624] [PATCH emacs-team 04/15] gnu: translate-shell: Compile emacs bytecode Liliana Marie Prikler
2023-10-19  4:53 ` [bug#66624] [PATCH emacs-team 05/15] gnu: emacs-mew: Adjust to changes in emacs-build-system Liliana Marie Prikler
2023-10-19  5:03 ` [bug#66624] [PATCH emacs-team 06/15] gnu: crm114: " Liliana Marie Prikler
2023-10-19  5:09 ` [bug#66624] [PATCH emacs-team 07/15] gnu: guile-wisp: Build autoloads before installing them Liliana Marie Prikler
2023-10-19  5:16 ` [bug#66624] [PATCH emacs-team 08/15] gnu: uim: Keep Emacs files in subdirectory Liliana Marie Prikler
2023-10-19  5:20 ` [bug#66624] [PATCH emacs-team 10/15] gnu: emacs-geiser-gauche: Process autoloads in-tree Liliana Marie Prikler
2023-10-19  5:20 ` [bug#66624] [PATCH emacs-team 11/15] gnu: emacs-geiser-racket: " Liliana Marie Prikler
2023-10-19  5:21 ` [bug#66624] [PATCH emacs-team 12/15] gnu: emacs-geiser-chez: " Liliana Marie Prikler
2023-10-19  5:28 ` [bug#66624] [PATCH emacs-team 13/15] gnu: emacs-libgit: Adjust to changes in emacs-build-system Liliana Marie Prikler
2023-10-19  5:31 ` [bug#66624] [PATCH emacs-team 14/15] gnu: emacs-eweouz: Build autoloads before installing them Liliana Marie Prikler
2023-10-19  5:38 ` [bug#66624] [PATCH emacs-team 15/15] gnu: emacs-pdf-tools: " Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8734y13f46.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=66624@debbugs.gnu.org \
    --cc=cox.katherine.e+guix@gmail.com \
    --cc=liliana.prikler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).