[PATCH] guix: modify-input: Recommend prepend instead of append.

  • Done
  • quality assurance status badge
Details
3 participants
  • Christopher Baines
  • (
  • Vivien Kraus
Owner
unassigned
Submitted by
Vivien Kraus
Severity
normal
V
V
Vivien Kraus wrote on 5 Nov 2022 12:59
(address . guix-patches@gnu.org)
7c0fbbe321c736a5757c637b33bf3a9909a6f63e.camel@planete-kraus.eu
* doc/guix.texi (Defining Package Variants): Document the "prepend" clause of
modify-inputs first.
* guix/packages.scm (modify-inputs): use "prepend" in the docstring.
---
doc/guix.texi | 12 ++++++------
guix/packages.scm | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)

Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 7806b21a0f..f818643ecd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8057,20 +8057,20 @@ following forms:
@item (delete @var{name}@dots{})
Delete from the inputs packages with the given @var{name}s (strings).
-@item (append @var{package}@dots{})
-Add @var{package}s to the end of the input list.
-
@item (prepend @var{package}@dots{})
Add @var{package}s to the front of the input list.
+
+@item (append @var{package}@dots{})
+Add @var{package}s to the end of the input list.
@end table
The example below removes the GMP and ACL inputs of Coreutils and adds
-libcap to the back of the input list:
+libcap to the front of the input list:
@lisp
(modify-inputs (package-inputs coreutils)
(delete "gmp" "acl")
- (append libcap))
+ (prepend libcap))
@end lisp
The example below replaces the @code{guile} package from the inputs of
@@ -8081,7 +8081,7 @@ The example below replaces the @code{guile} package from the inputs of
(replace "guile" guile-2.2))
@end lisp
-The last type of clause is @code{prepend}, to add inputs to the front of
+The last type of clause is @code{append}, to add inputs at the back of
the list.
@end deffn
diff --git a/guix/packages.scm b/guix/packages.scm
index 704b4ee710..502df7fdd1 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1176,9 +1176,9 @@ (define-syntax modify-inputs
(modify-inputs (package-inputs coreutils)
(delete \"gmp\" \"acl\")
- (append libcap))
+ (prepend libcap))
-Other types of clauses include 'prepend' and 'replace'.
+Other types of clauses include 'append' and 'replace'.
The first argument must be a labeled input list; the result is also a labeled
input list."

base-commit: 84d239599a10f31e7d414d962ae25888ab21165c
--
2.38.0
(
CO4CLB74DR93.33CQP7RGV54CS@guix-framework
On Sat Nov 5, 2022 at 11:59 AM GMT, Vivien Kraus via Guix-patches via wrote:
Toggle quote (4 lines)
> * doc/guix.texi (Defining Package Variants): Document the "prepend" clause of
> modify-inputs first.
> * guix/packages.scm (modify-inputs): use "prepend" in the docstring.

LGTM :)

-- (
C
C
Christopher Baines wrote on 5 Nov 2022 20:17
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87eduhgqgj.fsf@cbaines.net
Vivien Kraus via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (8 lines)
> * doc/guix.texi (Defining Package Variants): Document the "prepend" clause of
> modify-inputs first.
> * guix/packages.scm (modify-inputs): use "prepend" in the docstring.
> ---
> doc/guix.texi | 12 ++++++------
> guix/packages.scm | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)

This seems OK, but it would be good to know why you're wanting to change
this? In other words, how does this make things better?

This information would be good to have in the commit message (I usually
just write a sentance/paragraph above the changelog).

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmNmtwxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xe73BAAoOGvVo5owjpaqhGI8lQJjbSTRIFE/nn1
mKx8hf2kJLfZRDj2wmOp1J2JjtMdIGKOgjp2m+OJTxRTIQEou6hifEJlE0YXbfXd
BFLrcHcgW6c6OKFJd6MqmZko5vFSpTkmjg47ueRZ1GwauwTCF0skEgLE+M8h8amx
zZaLQxAtS/J4TTYjq/3o0htQALMtKX45c8HGkDViNDGJHz+n/JR5yiaqoMdeEPSZ
kndLn+YECFlR5MBhxAlCpxd9sPSQHd2s9b7/5w1HH/VK+bF+ihn4r+YrgbmPM9NM
ZXxJ8x5pHVtaRAxsnIt98fDrDK4JcOyWbzoxmXt1Bz1Hem7aBMky/5KItzCrUpSr
rDFyZdrLbR9Tnr6GmplEkjMrGVWrzqjdZu/VxW4RsoG2G3nPmSUmBus2RqE2jAhd
0Rcc7r96saBlAbMtGLWXYhFsR5ENjxYBTvy6JpNmxW5MujSatVkfIc+W3zYPu+aH
QY0zWn8/MUZyoCpx6/Z9uVuTYT6xlvixQdagEZ9Q7xTJN060v7n3ILVDPhfqnbgr
iu9myu7ovzU+y9PYUM8Y7LnwsC/wcnG4OWLAg/wYSSFoR6lZmU3swZErzB/n0l5M
/QWgDbbUD/9RNeChpvcYLAYAEEMvzCeup0LW6Eu9OunN7QgqtzAa/swBTe/w+lgM
ujdfc4xhqeo=
=/veU
-----END PGP SIGNATURE-----

V
V
Vivien Kraus wrote on 5 Nov 2022 20:47
(name . Christopher Baines)(address . mail@cbaines.net)
ab8ddd08c764b36ef37818e2bfe50d23abb43f4d.camel@planete-kraus.eu
Hello!

Le samedi 05 novembre 2022 à 20:17 +0100, Christopher Baines a écrit :
Toggle quote (17 lines)
>
> Vivien Kraus via Guix-patches via <guix-patches@gnu.org> writes:
>
> > * doc/guix.texi (Defining Package Variants): Document the "prepend"
> > clause of
> > modify-inputs first.
> > * guix/packages.scm (modify-inputs): use "prepend" in the
> > docstring.
> > ---
> >  doc/guix.texi     | 12 ++++++------
> >  guix/packages.scm |  4 ++--
> >  2 files changed, 8 insertions(+), 8 deletions(-)
>
> This seems OK, but it would be good to know why you're wanting to
> change
> this? In other words, how does this make things better?

I’m not sure of anything. What I gathered so far is:

- it could be more efficient;
- most instances in the packages use prepend rather than append:

$ grep -R '(modify-inputs' gnu -A 3 | grep '(append' | wc -l
34
$ grep -R '(modify-inputs' gnu -A 3 | grep '(prepend' | wc -l
128

I’m inviting ( in the discussion because the issue was raised in an IRC
discussion about a previous patch of mine (test).

Now, the old way I would reply to this message would be to attach an
updated patch, but since I have been told to send patches as emails
instead of attachments I don’t know how to proceed.

Vivien
(
CO4MH2A96NIL.15QFTAH8TZBWY@guix-framework
On Sat Nov 5, 2022 at 7:47 PM GMT, Vivien Kraus wrote:
Toggle quote (4 lines)
> Now, the old way I would reply to this message would be to attach an
> updated patch, but since I have been told to send patches as emails
> instead of attachments I don’t know how to proceed.

The "Single Patches" section tells you how to send a v2 patchset; this
applies equally for multiple patches:

If you need to send a revised patch, don’t resend it like this or send a
“fix” patch to be applied on top of the last one; instead, use git commit -a
or git rebase to modify the commit, and use the ISSUE_NUMBER@debbugs.gnu.org
address and the -v flag with git send-email.

$ git commit -a
$ git send-email -1 -a --base=auto -v REVISION \
--to=ISSUE_NUMBER@debbugs.gnu.org


-- (
V
V
Vivien Kraus wrote on 5 Nov 2022 12:59
[PATCH v2] guix: modify-input: Recommend prepend instead of append.
(address . 59048@debbugs.gnu.org)
13852d418ac206841fbb2abb3c19b95641338a94.camel@planete-kraus.eu
Most packages use prepend rather than append. If guix has to decide on an
official policy, it should favor prepend.

* doc/guix.texi (Defining Package Variants): Document the "prepend" clause of
modify-inputs first.
* guix/packages.scm (modify-inputs): use "prepend" in the docstring.
---
doc/guix.texi | 12 ++++++------
guix/packages.scm | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)

Toggle diff (59 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 7806b21a0f..f818643ecd 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -8057,20 +8057,20 @@ following forms:
@item (delete @var{name}@dots{})
Delete from the inputs packages with the given @var{name}s (strings).
-@item (append @var{package}@dots{})
-Add @var{package}s to the end of the input list.
-
@item (prepend @var{package}@dots{})
Add @var{package}s to the front of the input list.
+
+@item (append @var{package}@dots{})
+Add @var{package}s to the end of the input list.
@end table
The example below removes the GMP and ACL inputs of Coreutils and adds
-libcap to the back of the input list:
+libcap to the front of the input list:
@lisp
(modify-inputs (package-inputs coreutils)
(delete "gmp" "acl")
- (append libcap))
+ (prepend libcap))
@end lisp
The example below replaces the @code{guile} package from the inputs of
@@ -8081,7 +8081,7 @@ The example below replaces the @code{guile} package from the inputs of
(replace "guile" guile-2.2))
@end lisp
-The last type of clause is @code{prepend}, to add inputs to the front of
+The last type of clause is @code{append}, to add inputs at the back of
the list.
@end deffn
diff --git a/guix/packages.scm b/guix/packages.scm
index 704b4ee710..502df7fdd1 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1176,9 +1176,9 @@ (define-syntax modify-inputs
(modify-inputs (package-inputs coreutils)
(delete \"gmp\" \"acl\")
- (append libcap))
+ (prepend libcap))
-Other types of clauses include 'prepend' and 'replace'.
+Other types of clauses include 'append' and 'replace'.
The first argument must be a labeled input list; the result is also a labeled
input list."

base-commit: e5a0381e6defd9c1ffd1b57d9de7f31636c87b68
--
2.38.0
C
C
Christopher Baines wrote on 21 Nov 2022 15:36
(name . Vivien Kraus)(address . vivien@planete-kraus.eu)
87wn7otlsl.fsf@cbaines.net
Vivien Kraus via Guix-patches via <guix-patches@gnu.org> writes:

Toggle quote (11 lines)
> Most packages use prepend rather than append. If guix has to decide on an
> official policy, it should favor prepend.
>
> * doc/guix.texi (Defining Package Variants): Document the "prepend" clause of
> modify-inputs first.
> * guix/packages.scm (modify-inputs): use "prepend" in the docstring.
> ---
> doc/guix.texi | 12 ++++++------
> guix/packages.scm | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)

I've now pushed this to master as
9283c80e604324f5449b5a8daf94285cdc6a8604.

For some reason, I think I pushed the v1 of the patch, that's my bad. I
think the changes are still fine, it's just I missed the commit message
changes here.

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmN7jWpfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfuTw/8ClAtMoFmczQ7KKlRWHnOleoNNgi5zM0M
+v1qnejm18riVTWLnqNOER8GfOqX0f6KPW8SAv5EZNGPo9icU81AyNl6B0mVhHOW
R0fYHH51VGoDfFLbDhlO+xow1Y+81Sw7JZmawNIyuIaEFXSncczf4cM/zufTMVq6
s+wdODBcpEOZpYZ9Psbc5xLwh9om6Tbd90McgkOdPhv3Ypt+kp+uDpOhwXhEs6oI
pRYBHTB++W4tnI5eIK6JERDNsZS3ONVExUVfL+iSkVCEGjzrqsfCYU43B6sqvQDX
Jz8+nxV163GaN2vqNUyhNnUo5y7LsXHhXvBCjJGSbTyBwBcIbG+882NLUlczbmve
8ZkNkE8xCV2dT4oqtSzqCaH4Qe1621u0GbuNHV4d75VFwEYU4qsKWQfcyuVECRQU
1bLLoWcZ4NAoDXlGv64goAXGJ9bYs4tMjWBr2KIYw1ataEOfqptckYhKGtB1gwRT
oxw0AJK6fhseejOnR+LvdjThYyzJQqrd0PNKnFbh4CTN3tmDUJN2RAWtwdMe+bvK
NYTCeoobxej1dbkG0Fnk/Vjaqg5VIFOY9XYCyZX8+cTz4f2dSUX7PHOKk9CUOAzb
7HfaFhTahTt+7qm2FVECyErxCmLV3dOhSFCXwsZmDrQNYWRWDdoz0E5TRuBl0x3+
iHh7C4Nv/Yk=
=w/GF
-----END PGP SIGNATURE-----

?