Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?

2020-01-17 Thread Pierre Neidhardt
I have already merged, can you rebase your changes against master? :)

-- 
Pierre Neidhardt
https://ambrevar.xyz/


signature.asc
Description: PGP signature


Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?

2020-01-16 Thread zimoun
On Thu, 16 Jan 2020 at 15:30, Pierre Neidhardt  wrote:

> I've merged your patch 38678.

Cool! Thank you.


> Should I fix this for you?

Yes, for sure.
Patch attached.

Cheers,
simon
From 7ec82e221fdb42b6776ae4c41708d9ec361b4ebf Mon Sep 17 00:00:00 2001
From: zimoun 
Date: Wed, 8 Jan 2020 18:53:01 +0100
Subject: [PATCH v5 3/6] refresh: Add '--load-path' option.

* guix/scripts/refresh.scm (%option): Add '--load-path' option.
* doc/guix.texi: Document it.
---
 doc/guix.texi|  9 -
 guix/scripts/refresh.scm | 18 ++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3d26facd2e..bee4c3b2c9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -69,7 +69,7 @@ Copyright @copyright{} 2019 Jakob L. Kreuze@*
 Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019 Guillaume Le Vaillant@*
-Copyright @copyright{} 2019 Simon Tournier@*
+Copyright @copyright{} 2019, 2020 Simon Tournier@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -9552,6 +9552,13 @@ the user whether to download it or not.  This is the default behavior.
 @item --key-server=@var{host}
 Use @var{host} as the OpenPGP key server when importing a public key.
 
+@item --load-path=@var{directory}
+Add @var{directory} to the front of the package module search path
+(@pxref{Package Modules}).
+
+This allows users to define their own packages and make them visible to
+the command-line tools.
+
 @end table
 
 The @code{github} updater uses the
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index daf6fcf947..efada1df5a 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2017 Mathieu Othacehe 
 ;;; Copyright © 2018 Efraim Flashner 
 ;;; Copyright © 2019 Ricardo Wurmus 
+;;; Copyright © 2020 Simon Tournier 
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
   #:use-module (guix ui)
   #:use-module (gcrypt hash)
   #:use-module (guix scripts)
+  #:use-module ((guix scripts build) #:select (%standard-build-options))
   #:use-module (guix store)
   #:use-module (guix utils)
   #:use-module (guix packages)
@@ -116,6 +118,19 @@
  (leave (G_ "unsupported policy: ~a~%")
 arg)
 
+;; The short option -L is already used by --list-updaters, therefore
+;; it needs to be removed from %standard-build-options.
+(let ((load-path-option (find (lambda (option)
+ (member "load-path"
+ (option-names option)))
+   %standard-build-options)))
+  (option
+   (filter (lambda (name) (not (equal? #\L name)))
+   (option-names load-path-option))
+   (option-required-arg? load-path-option)
+   (option-optional-arg? load-path-option)
+   (option-processor load-path-option)))
+
 (option '(#\h "help") #f #f
 (lambda args
   (show-help)
@@ -165,6 +180,9 @@ specified with `--select'.\n"))
  'always', 'never', and 'interactive', which is also
  used when 'key-download' is not specified"))
   (newline)
+  (display (G_ "
+  --load-path=DIRprepend DIR to the package module search path"))
+  (newline)
   (display (G_ "
   -h, --help display this help and exit"))
   (display (G_ "
-- 
2.23.0



Re: Command line option in addition to GUIX_PACKAGE_PATH - Reason?

2019-12-30 Thread zimoun
Hi Danny,

Thank you for your insights.

On Thu, 26 Dec 2019 at 21:31, Danny Milosavljevic
 wrote:

> ... why?  There's the environment variable already--what does it give us
> to have yet another way to specify the value?

>From my opinion, the answers to the why is:
 - because it is easier to explain to newcomers; only a new option and
not a new concept,
 - because it adds consistency with other commands, as Pierre said,
 - because it is easier to discover via "guix  -h"; even if it
should also be easy to add environment variables documentation via
"guix  -h".


> zimoun wrote:
>
> >But IMHO, the normal use should be via the --load-path option and the
> >GUIX_LOAD_PATH should be less and less used; stay here for historical
> >reason and/or backward compatibility and/or some devel use-case.
>
> Why?  *PATH environment variables have a long tradition in UNIX and are not
> going to vanish (or mean something else any time) soon.  What is the use
> case this change is supposed to enable?

Why? I do not know, maybe gray beard vs young mustache. ;-)
The option "--load-path" is more a flavor of taste than an use case
uncovered by GUIX_PACKAGE_PATH.
And GUIX_PACKAGE_PATH is not going to vanish.


Hope that helps.

All the best,
simon



Command line option in addition to GUIX_PACKAGE_PATH - Reason?

2019-12-26 Thread Danny Milosavljevic
Hi Pierre,
Hi zimoun,

On Thu, 19 Dec 2019 18:14:53 +0100
Pierre Neidhardt  wrote:

> zimoun  writes:
> 
> > Do you have in mind commands where the option --load-path is still missing?
> > Maybe "guix graph"?  
> 
> Yes.
> 
> > Maybe "guix edit"?  
> 
> Yes.

... why?  There's the environment variable already--what does it give us
to have yet another way to specify the value?

Shells allow you to do

  ENVVAR1=value command1

anyway.

zimoun wrote:

>But IMHO, the normal use should be via the --load-path option and the
>GUIX_LOAD_PATH should be less and less used; stay here for historical
>reason and/or backward compatibility and/or some devel use-case.

Why?  *PATH environment variables have a long tradition in UNIX and are not
going to vanish (or mean something else any time) soon.  What is the use
case this change is supposed to enable?


pgpwLwDFlprvi.pgp
Description: OpenPGP digital signature