[PATCH] doc: Use G-Expressions for package definition example.

  • Done
  • quality assurance status badge
Details
5 participants
  • Ivan Sokolov
  • Ludovic Courtès
  • Nicolas Goaziou
  • Bruno Victal
  • Simon Tournier
Owner
unassigned
Submitted by
Bruno Victal
Severity
normal
B
B
Bruno Victal wrote on 10 Apr 2023 17:13
(address . guix-patches@gnu.org)(name . Bruno Victal)(address . mirai@makinata.eu)
f895ae0c822a33051cdd9bb23e43a8fda412d962.1681139577.git.mirai@makinata.eu
* doc/guix.texi (Build Phases): Use G-Expressions for example.
---
doc/guix.texi | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)

Toggle diff (47 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index ed42488882..100ad93a3e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10131,21 +10131,26 @@ Build Phases
;; other fields omitted
(build-system gnu-build-system)
(arguments
- '(#:phases (modify-phases %standard-phases
- (delete 'configure)
- (add-before 'build 'set-prefix-in-makefile
- (lambda* (#:key outputs #:allow-other-keys)
- ;; Modify the makefile so that its
- ;; 'PREFIX' variable points to "out".
- (let ((out (assoc-ref outputs "out")))
- (substitute* "Makefile"
- (("PREFIX =.*")
- (string-append "PREFIX = "
- out "\n")))))))))))
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'set-prefix-in-makefile
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Modify the makefile so that its
+ ;; 'PREFIX' variable points to "out" and
+ ;; 'XMLLINT' points to the correct path.
+ (substitute* "Makefile"
+ (("PREFIX =.*")
+ (string-append "PREFIX = " #$output "\n"))
+ (("XMLLINT =.*")
+ (string-append "XMLLINT = "
+ (search-input-file inputs "/bin/xmllint")
+ "\n"))))))))))
@end lisp
The new phase that is inserted is written as an anonymous procedure,
-introduced with @code{lambda*}; it honors the @code{outputs} parameter
+introduced with @code{lambda*}; it honors the @code{inputs} parameter
we have seen before. @xref{Build Utilities}, for more about the helpers
used by this phase, and for more examples of @code{modify-phases}.

base-commit: b78d6ceaa07be3c7582627cd28712b67102e521c
--
2.39.2
I
I
Ivan Sokolov wrote on 10 Apr 2023 21:00
(name . Bruno Victal)(address . mirai@makinata.eu)(address . 62754@debbugs.gnu.org)
873557r292.fsf@ya.ru
Bruno Victal <mirai@makinata.eu> writes:

Toggle quote (51 lines)
> * doc/guix.texi (Build Phases): Use G-Expressions for example.
> ---
> doc/guix.texi | 29 +++++++++++++++++------------
> 1 file changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index ed42488882..100ad93a3e 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -10131,21 +10131,26 @@ Build Phases
> ;; other fields omitted
> (build-system gnu-build-system)
> (arguments
> - '(#:phases (modify-phases %standard-phases
> - (delete 'configure)
> - (add-before 'build 'set-prefix-in-makefile
> - (lambda* (#:key outputs #:allow-other-keys)
> - ;; Modify the makefile so that its
> - ;; 'PREFIX' variable points to "out".
> - (let ((out (assoc-ref outputs "out")))
> - (substitute* "Makefile"
> - (("PREFIX =.*")
> - (string-append "PREFIX = "
> - out "\n")))))))))))
> + (list
> + #:phases
> + #~(modify-phases %standard-phases
> + (delete 'configure)
> + (add-before 'build 'set-prefix-in-makefile
> + (lambda* (#:key inputs #:allow-other-keys)
> + ;; Modify the makefile so that its
> + ;; 'PREFIX' variable points to "out" and
> + ;; 'XMLLINT' points to the correct path.
> + (substitute* "Makefile"
> + (("PREFIX =.*")
> + (string-append "PREFIX = " #$output "\n"))
> + (("XMLLINT =.*")
> + (string-append "XMLLINT = "
> + (search-input-file inputs "/bin/xmllint")
> + "\n"))))))))))
> @end lisp
>
> The new phase that is inserted is written as an anonymous procedure,
> -introduced with @code{lambda*}; it honors the @code{outputs} parameter
> +introduced with @code{lambda*}; it honors the @code{inputs} parameter
> we have seen before. @xref{Build Utilities}, for more about the helpers
> used by this phase, and for more examples of @code{modify-phases}.
>
>
> base-commit: b78d6ceaa07be3c7582627cd28712b67102e521c

inputs parameter has not previously appeared in the documentation, the
sentence before last does not make sense anymore.
B
B
Bruno Victal wrote on 11 Apr 2023 14:19
[PATCH v2] doc: Use G-Expressions for package definition example.
(address . 62754@debbugs.gnu.org)
2db67ea84f7a23bf04280ad1e365ac8709167d66.1681215490.git.mirai@makinata.eu
* doc/guix.texi (Build Phases): Use G-Expressions for example.
---
doc/guix.texi | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)

Toggle diff (51 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index fa6c9f46a3..62513a4182 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10131,23 +10131,28 @@ Build Phases
;; other fields omitted
(build-system gnu-build-system)
(arguments
- '(#:phases (modify-phases %standard-phases
- (delete 'configure)
- (add-before 'build 'set-prefix-in-makefile
- (lambda* (#:key outputs #:allow-other-keys)
- ;; Modify the makefile so that its
- ;; 'PREFIX' variable points to "out".
- (let ((out (assoc-ref outputs "out")))
- (substitute* "Makefile"
- (("PREFIX =.*")
- (string-append "PREFIX = "
- out "\n")))))))))))
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'set-prefix-in-makefile
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Modify the makefile so that its
+ ;; 'PREFIX' variable points to #$output and
+ ;; 'XMLLINT' points to the correct path.
+ (substitute* "Makefile"
+ (("PREFIX =.*")
+ (string-append "PREFIX = " #$output "\n"))
+ (("XMLLINT =.*")
+ (string-append "XMLLINT = "
+ (search-input-file inputs "/bin/xmllint")
+ "\n"))))))))))
@end lisp
The new phase that is inserted is written as an anonymous procedure,
-introduced with @code{lambda*}; it honors the @code{outputs} parameter
-we have seen before. @xref{Build Utilities}, for more about the helpers
-used by this phase, and for more examples of @code{modify-phases}.
+introduced with @code{lambda*}. @xref{Build Utilities}, for more about
+the helpers used by this phase, and for more examples of
+@code{modify-phases}.
@cindex code staging
@cindex staging, of code

base-commit: 0356087f4e669a79d62d413498c32e4ecb79ba6b
--
2.39.2
N
N
Nicolas Goaziou wrote on 21 Apr 2023 10:21
(name . Bruno Victal)(address . mirai@makinata.eu)
87edod63xd.fsf@nicolasgoaziou.fr
Hello,

Bruno Victal <mirai@makinata.eu> writes:

Toggle quote (26 lines)
> + (list
> + #:phases
> + #~(modify-phases %standard-phases
> + (delete 'configure)
> + (add-before 'build 'set-prefix-in-makefile
> + (lambda* (#:key inputs #:allow-other-keys)
> + ;; Modify the makefile so that its
> + ;; 'PREFIX' variable points to #$output and
> + ;; 'XMLLINT' points to the correct path.
> + (substitute* "Makefile"
> + (("PREFIX =.*")
> + (string-append "PREFIX = " #$output "\n"))
> + (("XMLLINT =.*")
> + (string-append "XMLLINT = "
> + (search-input-file inputs "/bin/xmllint")
> + "\n"))))))))))
> @end lisp
>
> The new phase that is inserted is written as an anonymous procedure,
> -introduced with @code{lambda*}; it honors the @code{outputs} parameter
> -we have seen before. @xref{Build Utilities}, for more about the helpers
> -used by this phase, and for more examples of @code{modify-phases}.
> +introduced with @code{lambda*}. @xref{Build Utilities}, for more about
> +the helpers used by this phase, and for more examples of
> +@code{modify-phases}.

I think it still makes sense to refer to `inputs'; it could be
unsettling otherwise. Maybe something along those lines:

... introduced with @code{lambda*}; it looks for the @file{xmllint}
executable in a @file{"/bin"} directory among package's inputs
(@pxref{package Reference}). It also honors the @code{outputs}
parameter we have seen before@xref{Build Utilities}, for more...


WDYT?

Regards,
--
Nicolas Goaziou
S
S
Simon Tournier wrote on 5 May 2023 16:06
87fs8a7u0l.fsf@gmail.com
Hi,

On ven., 21 avril 2023 at 10:21, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

Toggle quote (16 lines)
>> The new phase that is inserted is written as an anonymous procedure,
>> -introduced with @code{lambda*}; it honors the @code{outputs} parameter
>> -we have seen before. @xref{Build Utilities}, for more about the helpers
>> -used by this phase, and for more examples of @code{modify-phases}.
>> +introduced with @code{lambda*}. @xref{Build Utilities}, for more about
>> +the helpers used by this phase, and for more examples of
>> +@code{modify-phases}.
>
> I think it still makes sense to refer to `inputs'; it could be
> unsettling otherwise. Maybe something along those lines:
>
> ... introduced with @code{lambda*}; it looks for the @file{xmllint}
> executable in a @file{"/bin"} directory among package's inputs
> (@pxref{package Reference}). It also honors the @code{outputs}
> parameter we have seen before@xref{Build Utilities}, for more...

This tweak looks better to me. Well, Bruno could you send a v3? Or
Nicolas, could you amend the patch and directly apply it?

(Note the typo in « before@xref{Build Utilities} », I guess.)

Cheers,
simon
B
B
Bruno Victal wrote on 6 May 2023 16:19
[PATCH v3] doc: Use G-Expressions for package definition example.
(address . 62754@debbugs.gnu.org)
b8c52652d1a3f3a08f44bf0db59c2f43e3702d57.1683382757.git.mirai@makinata.eu
* doc/guix.texi (Build Phases): Use G-Expressions for example.

Co-authored-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
---
doc/guix.texi | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)

Toggle diff (54 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 55221a10c3..e4b664aba9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -10140,23 +10140,31 @@ Build Phases
;; other fields omitted
(build-system gnu-build-system)
(arguments
- '(#:phases (modify-phases %standard-phases
- (delete 'configure)
- (add-before 'build 'set-prefix-in-makefile
- (lambda* (#:key outputs #:allow-other-keys)
- ;; Modify the makefile so that its
- ;; 'PREFIX' variable points to "out".
- (let ((out (assoc-ref outputs "out")))
- (substitute* "Makefile"
- (("PREFIX =.*")
- (string-append "PREFIX = "
- out "\n")))))))))))
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'set-prefix-in-makefile
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Modify the makefile so that its
+ ;; 'PREFIX' variable points to #$output and
+ ;; 'XMLLINT' points to the correct path.
+ (substitute* "Makefile"
+ (("PREFIX =.*")
+ (string-append "PREFIX = " #$output "\n"))
+ (("XMLLINT =.*")
+ (string-append "XMLLINT = "
+ (search-input-file inputs "/bin/xmllint")
+ "\n"))))))))))
@end lisp
The new phase that is inserted is written as an anonymous procedure,
-introduced with @code{lambda*}; it honors the @code{outputs} parameter
-we have seen before. @xref{Build Utilities}, for more about the helpers
-used by this phase, and for more examples of @code{modify-phases}.
+introduced with @code{lambda*}; it looks for the @file{xmllint}
+executable under a @file{/bin} directory among the package's inputs
+(@pxref{package Reference}). It also honors the @code{outputs} parameter
+we have seen before. @xref{Build Utilities}, for more about
+the helpers used by this phase, and for more examples of
+@code{modify-phases}.
@cindex code staging
@cindex staging, of code

base-commit: 1cb0dee3a31c6d235389d4d9787fa583c2babc30
--
2.39.2
L
L
Ludovic Courtès wrote on 6 May 2023 18:08
Re: bug#62754: [PATCH] doc: Use G-Expressions for package definition example.
(name . Bruno Victal)(address . mirai@makinata.eu)
874jopl9xf.fsf_-_@gnu.org
Hi,

Bruno Victal <mirai@makinata.eu> skribis:

Toggle quote (4 lines)
> * doc/guix.texi (Build Phases): Use G-Expressions for example.
>
> Co-authored-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>

Applied, thank you, and thanks Simon and Nicolas!

Ludo’.
Closed
?