* [PATCH] scripts: package: Add --install-from-file option.
@ 2015-08-09 15:59 David Thompson
2015-08-10 14:22 ` Alex Kost
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: David Thompson @ 2015-08-09 15:59 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 650 bytes --]
In my personal projects, I keep a 'package.scm' file in the root of the
source tree for use with 'guix environment -l'. However, it's also
handy to install that package by using 'guix package -e':
guix package -e '(primitive-load "package.scm")'
This patch adds a shorthand for this:
guix package -f package.scm
The motivation for this is to ultimately encourage other people to keep
a 'package.scm' file in their own repos for building reproducible
development environments and easily testing development snapshots, like
what we do with our 'guix-devel' package.
I'd like to add the same option for 'guix build', if this is approved.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-scripts-package-Add-install-from-file-option.patch --]
[-- Type: text/x-patch, Size: 3335 bytes --]
From 07c9b35facf810872f3bc8342e18b33033714adf Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sun, 9 Aug 2015 11:35:51 -0400
Subject: [PATCH] scripts: package: Add --install-from-file option.
* guix/scripts/package.scm (show-help): Add help text for --install-from-file
option.
(%options): Add --install-from-file option.
* doc/guix.texi ("invoking guix package"): Document it.
---
doc/guix.texi | 31 +++++++++++++++++++++++++++++++
guix/scripts/package.scm | 10 ++++++++++
2 files changed, 41 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index bcf07a6..dda478f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1167,6 +1167,37 @@ Note that this option installs the first output of the specified
package, which may be insufficient when needing a specific output of a
multiple-output package.
+@item --install-from-file=@var{file}
+@itemx -f @var{file}
+Install the package that the code within @var{file} evaluates to.
+
+As an example, @var{file} might contain a definition like this
+(@pxref{Defining Packages}):
+
+@example
+(use-modules (guix packages)
+ (guix download)
+ (guix build-system gnu)
+ (guix licenses))
+
+(package
+ (name "hello")
+ (version "2.8")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/hello/hello-" version
+ ".tar.gz"))
+ (sha256
+ (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))))
+ (build-system gnu-build-system)
+ (arguments `(#:configure-flags '("--enable-silent-rules")))
+ (inputs `(("gawk" ,gawk)))
+ (synopsis "Hello, GNU world: An example GNU package")
+ (description "Guess what GNU Hello prints!")
+ (home-page "http://www.gnu.org/software/hello/")
+ (license gpl3+))
+@end example
+
@item --remove=@var{package} @dots{}
@itemx -r @var{package} @dots{}
Remove the specified @var{package}s.
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index b545ea2..23f1597 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -381,6 +381,10 @@ Install, remove, or upgrade packages in a single transaction.\n"))
-e, --install-from-expression=EXP
install the package EXP evaluates to"))
(display (_ "
+ -f, --install-from-file=FILE
+ install the package that the code within FILE
+ evaluates to"))
+ (display (_ "
-r, --remove PACKAGE ...
remove PACKAGEs"))
(display (_ "
@@ -454,6 +458,12 @@ Install, remove, or upgrade packages in a single transaction.\n"))
(values (alist-cons 'install (read/eval-package-expression arg)
result)
#f)))
+ (option '(#\f "install-from-file") #t #f
+ (lambda (opt name arg result arg-handler)
+ (values (alist-cons 'install
+ (load* arg (make-user-module '()))
+ result)
+ #f)))
(option '(#\r "remove") #f #t
(lambda (opt name arg result arg-handler)
(let arg-handler ((arg arg) (result result))
--
2.4.3
[-- Attachment #3: Type: text/plain, Size: 38 bytes --]
--
David Thompson
GPG Key: 0FF1D807
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-09 15:59 [PATCH] scripts: package: Add --install-from-file option David Thompson
@ 2015-08-10 14:22 ` Alex Kost
2015-08-18 19:30 ` Ludovic Courtès
2015-08-19 8:27 ` Amirouche Boubekki
2 siblings, 0 replies; 13+ messages in thread
From: Alex Kost @ 2015-08-10 14:22 UTC (permalink / raw)
To: David Thompson; +Cc: guix-devel
David Thompson (2015-08-09 18:59 +0300) wrote:
> In my personal projects, I keep a 'package.scm' file in the root of the
> source tree for use with 'guix environment -l'. However, it's also
> handy to install that package by using 'guix package -e':
>
> guix package -e '(primitive-load "package.scm")'
>
> This patch adds a shorthand for this:
>
> guix package -f package.scm
>
> The motivation for this is to ultimately encourage other people to keep
> a 'package.scm' file in their own repos for building reproducible
> development environments and easily testing development snapshots, like
> what we do with our 'guix-devel' package.
>
> I'd like to add the same option for 'guix build', if this is approved.
I agree that it will be easy for users than -e option.
And I'm also for adding --from-file option to 'guix build'. Thank you.
[...]
> +@example
> +(use-modules (guix packages)
> + (guix download)
> + (guix build-system gnu)
> + (guix licenses))
(gnu packages gawk) module should also be put there, as the package uses
'gawk' input.
> +(package
> + (name "hello")
> + (version "2.8")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "mirror://gnu/hello/hello-" version
> + ".tar.gz"))
> + (sha256
> + (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))))
> + (build-system gnu-build-system)
> + (arguments `(#:configure-flags '("--enable-silent-rules")))
> + (inputs `(("gawk" ,gawk)))
> + (synopsis "Hello, GNU world: An example GNU package")
> + (description "Guess what GNU Hello prints!")
> + (home-page "http://www.gnu.org/software/hello/")
> + (license gpl3+))
> +@end example
--
Alex
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-09 15:59 [PATCH] scripts: package: Add --install-from-file option David Thompson
2015-08-10 14:22 ` Alex Kost
@ 2015-08-18 19:30 ` Ludovic Courtès
2015-08-19 0:17 ` Thompson, David
2015-08-19 8:27 ` Amirouche Boubekki
2 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2015-08-18 19:30 UTC (permalink / raw)
To: David Thompson; +Cc: guix-devel
David Thompson <dthompson2@worcester.edu> skribis:
> In my personal projects, I keep a 'package.scm' file in the root of the
> source tree for use with 'guix environment -l'. However, it's also
> handy to install that package by using 'guix package -e':
>
> guix package -e '(primitive-load "package.scm")'
>
> This patch adds a shorthand for this:
>
> guix package -f package.scm
Makes sense.
> The motivation for this is to ultimately encourage other people to keep
> a 'package.scm' file in their own repos for building reproducible
> development environments and easily testing development snapshots, like
> what we do with our 'guix-devel' package.
Nice. The bottom line though is that we don’t quite guarantee stability
of the “API” of the package modules.
> I'd like to add the same option for 'guix build', if this is approved.
Sure.
> From 07c9b35facf810872f3bc8342e18b33033714adf Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sun, 9 Aug 2015 11:35:51 -0400
> Subject: [PATCH] scripts: package: Add --install-from-file option.
>
> * guix/scripts/package.scm (show-help): Add help text for --install-from-file
> option.
> (%options): Add --install-from-file option.
> * doc/guix.texi ("invoking guix package"): Document it.
[...]
> +(use-modules (guix packages)
> + (guix download)
> + (guix build-system gnu)
> + (guix licenses))
Just (use-modules (guix) (guix licenses))?
Can you put the example in a separate file (like
doc/environment-gdb.scm)? That will allow us to easily check that the
file is indeed valid.
> + (arguments `(#:configure-flags '("--enable-silent-rules")))
> + (inputs `(("gawk" ,gawk)))
I think these two lines can be removed.
> +@end example
Here it would be good to add a sentence or two like the paragraph you
wrote above about the motivation for all this.
Could you send an updated patch?
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-18 19:30 ` Ludovic Courtès
@ 2015-08-19 0:17 ` Thompson, David
2015-08-19 22:38 ` Ludovic Courtès
0 siblings, 1 reply; 13+ messages in thread
From: Thompson, David @ 2015-08-19 0:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2692 bytes --]
On Tue, Aug 18, 2015 at 3:30 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> David Thompson <dthompson2@worcester.edu> skribis:
>
>> In my personal projects, I keep a 'package.scm' file in the root of the
>> source tree for use with 'guix environment -l'. However, it's also
>> handy to install that package by using 'guix package -e':
>>
>> guix package -e '(primitive-load "package.scm")'
>>
>> This patch adds a shorthand for this:
>>
>> guix package -f package.scm
>
> Makes sense.
>
>> The motivation for this is to ultimately encourage other people to keep
>> a 'package.scm' file in their own repos for building reproducible
>> development environments and easily testing development snapshots, like
>> what we do with our 'guix-devel' package.
>
> Nice. The bottom line though is that we don’t quite guarantee stability
> of the “API” of the package modules.
Understood. In practice, I haven't found this to be a big deal. I
provide package.scm files in all of my projects now and it's been a
huge win for making it easier to quickly get hacking on a new machine.
>> I'd like to add the same option for 'guix build', if this is approved.
>
> Sure.
Great. :)
>> From 07c9b35facf810872f3bc8342e18b33033714adf Mon Sep 17 00:00:00 2001
>> From: David Thompson <dthompson2@worcester.edu>
>> Date: Sun, 9 Aug 2015 11:35:51 -0400
>> Subject: [PATCH] scripts: package: Add --install-from-file option.
>>
>> * guix/scripts/package.scm (show-help): Add help text for --install-from-file
>> option.
>> (%options): Add --install-from-file option.
>> * doc/guix.texi ("invoking guix package"): Document it.
>
> [...]
>
>> +(use-modules (guix packages)
>> + (guix download)
>> + (guix build-system gnu)
>> + (guix licenses))
>
> Just (use-modules (guix) (guix licenses))?
I needed: (use-modules (guix) (guix build-system gnu) (guix licenses))
> Can you put the example in a separate file (like
> doc/environment-gdb.scm)? That will allow us to easily check that the
> file is indeed valid.
Done.
>> + (arguments `(#:configure-flags '("--enable-silent-rules")))
>> + (inputs `(("gawk" ,gawk)))
>
> I think these two lines can be removed.
Yeah. BTW, I copy/pasted this from the "Defining Packages" section,
and that example appears to be broken because it doesn't import the
(gnu packages gawk) module.
>> +@end example
>
> Here it would be good to add a sentence or two like the paragraph you
> wrote above about the motivation for all this.
Added a sentence about it.
> Could you send an updated patch?
Attached. Thanks for the review.
- Dave
[-- Attachment #2: 0001-scripts-package-Add-install-from-file-option.patch --]
[-- Type: text/x-patch, Size: 4686 bytes --]
From 471fff182b632fc3b6f99925ff6c7bd25850a841 Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Sun, 9 Aug 2015 11:35:51 -0400
Subject: [PATCH] scripts: package: Add --install-from-file option.
* guix/scripts/package.scm (show-help): Add help text for --install-from-file
option.
(%options): Add --install-from-file option.
* doc/guix.texi ("invoking guix package"): Document it.
* doc/package-hello.scm: New file.
* doc.am (EXTRA_DIST): Add it.
---
doc.am | 3 ++-
doc/guix.texi | 18 +++++++++++++++++-
doc/package-hello.scm | 18 ++++++++++++++++++
guix/scripts/package.scm | 10 ++++++++++
4 files changed, 47 insertions(+), 2 deletions(-)
create mode 100644 doc/package-hello.scm
diff --git a/doc.am b/doc.am
index 02b80ec..1f0b832 100644
--- a/doc.am
+++ b/doc.am
@@ -26,7 +26,8 @@ EXTRA_DIST += \
doc/images/bootstrap-graph.eps \
doc/images/bootstrap-graph.pdf \
doc/images/coreutils-size-map.eps \
- doc/environment-gdb.scm
+ doc/environment-gdb.scm \
+ doc/package-hello.scm
OS_CONFIG_EXAMPLES_TEXI = \
doc/os-config-bare-bones.texi \
diff --git a/doc/guix.texi b/doc/guix.texi
index a20bca6..5550582 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1167,6 +1167,22 @@ Note that this option installs the first output of the specified
package, which may be insufficient when needing a specific output of a
multiple-output package.
+@item --install-from-file=@var{file}
+@itemx -f @var{file}
+Install the package that the code within @var{file} evaluates to.
+
+As an example, @var{file} might contain a definition like this
+(@pxref{Defining Packages}):
+
+@example
+@verbatiminclude package-hello.scm
+@end example
+
+Developers may find it useful to include such a @file{package.scm} file
+in the root of their project's source tree that can be used to test
+development snapshots and create reproducible development environments
+(@pxref{Invoking guix environment}).
+
@item --remove=@var{package} @dots{}
@itemx -r @var{package} @dots{}
Remove the specified @var{package}s.
@@ -2841,7 +2857,7 @@ omitted since it will take place implicitly, as we will see later
@end example
@c See
-@c <https://syntaxexclamation.wordpress.com/2014/06/26/escaping-continuations/>
+@c <https://syntaxexclamation.wordpress.com/2014/06/26/escaping-continuations/>
@c for the funny quote.
Calling the monadic @code{sh-symlink} has no effect. As someone once
said, ``you exit a monad like you exit a building on fire: by running''.
diff --git a/doc/package-hello.scm b/doc/package-hello.scm
new file mode 100644
index 0000000..b3fcd4f
--- /dev/null
+++ b/doc/package-hello.scm
@@ -0,0 +1,18 @@
+(use-modules (guix)
+ (guix build-system gnu)
+ (guix licenses))
+
+(package
+ (name "hello")
+ (version "2.8")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/hello/hello-" version
+ ".tar.gz"))
+ (sha256
+ (base32 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))))
+ (build-system gnu-build-system)
+ (synopsis "Hello, GNU world: An example GNU package")
+ (description "Guess what GNU Hello prints!")
+ (home-page "http://www.gnu.org/software/hello/")
+ (license gpl3+))
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index b545ea2..23f1597 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -381,6 +381,10 @@ Install, remove, or upgrade packages in a single transaction.\n"))
-e, --install-from-expression=EXP
install the package EXP evaluates to"))
(display (_ "
+ -f, --install-from-file=FILE
+ install the package that the code within FILE
+ evaluates to"))
+ (display (_ "
-r, --remove PACKAGE ...
remove PACKAGEs"))
(display (_ "
@@ -454,6 +458,12 @@ Install, remove, or upgrade packages in a single transaction.\n"))
(values (alist-cons 'install (read/eval-package-expression arg)
result)
#f)))
+ (option '(#\f "install-from-file") #t #f
+ (lambda (opt name arg result arg-handler)
+ (values (alist-cons 'install
+ (load* arg (make-user-module '()))
+ result)
+ #f)))
(option '(#\r "remove") #f #t
(lambda (opt name arg result arg-handler)
(let arg-handler ((arg arg) (result result))
--
2.4.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 0:17 ` Thompson, David
@ 2015-08-19 22:38 ` Ludovic Courtès
2015-08-20 2:26 ` Thompson, David
0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2015-08-19 22:38 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel
"Thompson, David" <dthompson2@worcester.edu> skribis:
> On Tue, Aug 18, 2015 at 3:30 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>>> + (arguments `(#:configure-flags '("--enable-silent-rules")))
>>> + (inputs `(("gawk" ,gawk)))
>>
>> I think these two lines can be removed.
>
> Yeah. BTW, I copy/pasted this from the "Defining Packages" section,
> and that example appears to be broken because it doesn't import the
> (gnu packages gawk) module.
We need to fix it.
> From 471fff182b632fc3b6f99925ff6c7bd25850a841 Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sun, 9 Aug 2015 11:35:51 -0400
> Subject: [PATCH] scripts: package: Add --install-from-file option.
>
> * guix/scripts/package.scm (show-help): Add help text for --install-from-file
> option.
> (%options): Add --install-from-file option.
> * doc/guix.texi ("invoking guix package"): Document it.
> * doc/package-hello.scm: New file.
> * doc.am (EXTRA_DIST): Add it.
LGTM!
In total sloppiness I forgot to ask you for a test, but you’re welcome
to post it separately. :-)
I think a couple of lines in tests/guix-package.sh would do, where the
given file would just evaluate to ‘%bootstrap-guile’ for instance. How
does that sound?
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 22:38 ` Ludovic Courtès
@ 2015-08-20 2:26 ` Thompson, David
0 siblings, 0 replies; 13+ messages in thread
From: Thompson, David @ 2015-08-20 2:26 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
On Wed, Aug 19, 2015 at 6:38 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> "Thompson, David" <dthompson2@worcester.edu> skribis:
>
>> On Tue, Aug 18, 2015 at 3:30 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> From 471fff182b632fc3b6f99925ff6c7bd25850a841 Mon Sep 17 00:00:00 2001
>> From: David Thompson <dthompson2@worcester.edu>
>> Date: Sun, 9 Aug 2015 11:35:51 -0400
>> Subject: [PATCH] scripts: package: Add --install-from-file option.
>>
>> * guix/scripts/package.scm (show-help): Add help text for --install-from-file
>> option.
>> (%options): Add --install-from-file option.
>> * doc/guix.texi ("invoking guix package"): Document it.
>> * doc/package-hello.scm: New file.
>> * doc.am (EXTRA_DIST): Add it.
>
> LGTM!
>
> In total sloppiness I forgot to ask you for a test, but you’re welcome
> to post it separately. :-)
>
> I think a couple of lines in tests/guix-package.sh would do, where the
> given file would just evaluate to ‘%bootstrap-guile’ for instance. How
> does that sound?
Done and pushed. Thanks!
- Dave
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-09 15:59 [PATCH] scripts: package: Add --install-from-file option David Thompson
2015-08-10 14:22 ` Alex Kost
2015-08-18 19:30 ` Ludovic Courtès
@ 2015-08-19 8:27 ` Amirouche Boubekki
2015-08-19 8:56 ` Amirouche Boubekki
2015-08-19 13:04 ` Thompson, David
2 siblings, 2 replies; 13+ messages in thread
From: Amirouche Boubekki @ 2015-08-19 8:27 UTC (permalink / raw)
To: David Thompson; +Cc: guix-devel, guix-devel-bounces+amirouche=hypermove.net
Le 2015-08-09 17:59, David Thompson a écrit :
> In my personal projects, I keep a 'package.scm' file in the root of the
> source tree for use with 'guix environment -l'. However, it's also
> handy to install that package by using 'guix package -e':
>
> guix package -e '(primitive-load "package.scm")'
>
> This patch adds a shorthand for this:
>
> guix package -f package.scm
What about dispatch `guix package -i` depending on the argument. In
principle there will be no "*.scm$" packages so the above could be
guix package -i package.scm
The idea behind that is to keep the number of command to minimum. In
this case, IMO, it makes sens to merge both logic inside the same UI.
On a similar note, I like a lot the idea of Andy Wingo `guix install`
and `guix search`.
>
> The motivation for this is to ultimately encourage other people to keep
> a 'package.scm' file in their own repos for building reproducible
> development environments and easily testing development snapshots, like
> what we do with our 'guix-devel' package.
>
> I'd like to add the same option for 'guix build', if this is approved.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 8:27 ` Amirouche Boubekki
@ 2015-08-19 8:56 ` Amirouche Boubekki
2015-08-19 14:48 ` Claes Wallin (韋嘉誠)
2015-08-19 13:04 ` Thompson, David
1 sibling, 1 reply; 13+ messages in thread
From: Amirouche Boubekki @ 2015-08-19 8:56 UTC (permalink / raw)
To: David Thompson; +Cc: guix-devel, guix-devel-bounces+amirouche=hypermove.net
Le 2015-08-19 10:27, Amirouche Boubekki a écrit :
> Le 2015-08-09 17:59, David Thompson a écrit :
>> In my personal projects, I keep a 'package.scm' file in the root of
>> the
>> source tree for use with 'guix environment -l'. However, it's also
>> handy to install that package by using 'guix package -e':
>>
>> guix package -e '(primitive-load "package.scm")'
>>
>> This patch adds a shorthand for this:
>>
>> guix package -f package.scm
>
> What about dispatch `guix package -i` depending on the argument. In
> principle there will be no "*.scm$" packages so the above could be
>
> guix package -i package.scm
>
> The idea behind that is to keep the number of command to minimum. In
> this case, IMO, it makes sens to merge both logic inside the same UI.
>
> On a similar note, I like a lot the idea of Andy Wingo `guix install`
> and `guix search`.
To be precise I prefer, `guix package install` and `guix package search`
(which is not the subject of patch of Andy Wingo).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 8:27 ` Amirouche Boubekki
2015-08-19 8:56 ` Amirouche Boubekki
@ 2015-08-19 13:04 ` Thompson, David
2015-08-19 13:54 ` Taylan Ulrich Bayırlı/Kammer
2015-08-19 15:31 ` Amirouche Boubekki
1 sibling, 2 replies; 13+ messages in thread
From: Thompson, David @ 2015-08-19 13:04 UTC (permalink / raw)
To: Amirouche Boubekki; +Cc: guix-devel, guix-devel-bounces+amirouche=hypermove.net
On Wed, Aug 19, 2015 at 4:27 AM, Amirouche Boubekki
<amirouche@hypermove.net> wrote:
> Le 2015-08-09 17:59, David Thompson a écrit :
>>
>> In my personal projects, I keep a 'package.scm' file in the root of the
>> source tree for use with 'guix environment -l'. However, it's also
>> handy to install that package by using 'guix package -e':
>>
>> guix package -e '(primitive-load "package.scm")'
>>
>> This patch adds a shorthand for this:
>>
>> guix package -f package.scm
>
>
> What about dispatch `guix package -i` depending on the argument. In
> principle there will be no "*.scm$" packages so the above could be
>
> guix package -i package.scm
>
> The idea behind that is to keep the number of command to minimum. In this
> case, IMO, it makes sens to merge both logic inside the same UI.
That won't work because it creates ambiguities in the package spec
syntax. How can one tell if a package spec or a file name was passed
with 100% accuracy? You can't, and we'd have to use a heuristic that
would surely fail in some awful way for someone. It's best for this
to be a separate argument.
- Dave
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 13:04 ` Thompson, David
@ 2015-08-19 13:54 ` Taylan Ulrich Bayırlı/Kammer
2015-08-19 15:31 ` Amirouche Boubekki
1 sibling, 0 replies; 13+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-08-19 13:54 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel, guix-devel-bounces+amirouche=hypermove.net
"Thompson, David" <dthompson2@worcester.edu> writes:
> On Wed, Aug 19, 2015 at 4:27 AM, Amirouche Boubekki
> <amirouche@hypermove.net> wrote:
>
>> What about dispatch `guix package -i` depending on the argument. In
>> principle there will be no "*.scm$" packages so the above could be
>>
>> guix package -i package.scm
>>
>> The idea behind that is to keep the number of command to minimum. In this
>> case, IMO, it makes sens to merge both logic inside the same UI.
>
> That won't work because it creates ambiguities in the package spec
> syntax. How can one tell if a package spec or a file name was passed
> with 100% accuracy? You can't, and we'd have to use a heuristic that
> would surely fail in some awful way for someone. It's best for this
> to be a separate argument.
>
> - Dave
Sometimes a 99.9% solution is acceptable IMO. Packages named "foo.scm"
should be exceedingly rare in first place, and then if you also have a
file of that name in the current directory...
Another option might be to expect a slash in the string, i.e. forcing
"./" if the file's in the current directory:
guix package -i ./package.scm
Happening to have a package with a slash in its name, ending in .scm,
and coinciding with the relative or absolute path of a file existing on
your filesystem, ought to be implausible.
Just my two cents from glancing over the discussion though. No strong
opinions. Additional flag is fine too by me.
Taylan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 13:04 ` Thompson, David
2015-08-19 13:54 ` Taylan Ulrich Bayırlı/Kammer
@ 2015-08-19 15:31 ` Amirouche Boubekki
2015-08-19 19:15 ` Alex Kost
1 sibling, 1 reply; 13+ messages in thread
From: Amirouche Boubekki @ 2015-08-19 15:31 UTC (permalink / raw)
To: Thompson, David; +Cc: guix-devel, guix-devel-bounces+amirouche=hypermove.net
Le 2015-08-19 15:04, Thompson, David a écrit :
> On Wed, Aug 19, 2015 at 4:27 AM, Amirouche Boubekki
> <amirouche@hypermove.net> wrote:
>> Le 2015-08-09 17:59, David Thompson a écrit :
>>>
>>> In my personal projects, I keep a 'package.scm' file in the root of
>>> the
>>> source tree for use with 'guix environment -l'. However, it's also
>>> handy to install that package by using 'guix package -e':
>>>
>>> guix package -e '(primitive-load "package.scm")'
>>>
>>> This patch adds a shorthand for this:
>>>
>>> guix package -f package.scm
>>
>>
>> What about dispatch `guix package -i` depending on the argument. In
>> principle there will be no "*.scm$" packages so the above could be
>>
>> guix package -i package.scm
>>
>> The idea behind that is to keep the number of command to minimum. In
>> this
>> case, IMO, it makes sens to merge both logic inside the same UI.
>
> That won't work because it creates ambiguities in the package spec
> syntax.
Thanks.
> How can one tell if a package spec or a file name was passed
> with 100% accuracy?
Honestly I have the feeling that you are pushing your idea more than
trying to make things better.
- Adding the `-f` modifier won't help make guix package command easy to
the mind.
- Especially since the command it will replace is simple
- The command targets developpers and is only useful in the context of
building project from sources which are not released. It can go inside a
Makefile.
For this reason I don't like it being inside guix.
> You can't, and we'd have to use a heuristic that
> would surely fail in some awful way for someone. It's best for this
> to be a separate argument.
You know you are wrong. You can simply ban packages which ends with .scm
which is not too difficult to do and is already possible with current
packages.
My opinion, is that instead of adding options/modifiers to "guix
package", it should be split into "guix package install", "guix package
search", "guix package show" and "guix package generation". It might not
be obvious and is afaik not a cli layout that is widespread but it will
greatly help people get their hands on guix.
I get lost and don't remember all the apt-foo commands and what they are
supposed to do. Using this scheme will keep each subcommand --help (or
just help) more readable.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] scripts: package: Add --install-from-file option.
2015-08-19 15:31 ` Amirouche Boubekki
@ 2015-08-19 19:15 ` Alex Kost
0 siblings, 0 replies; 13+ messages in thread
From: Alex Kost @ 2015-08-19 19:15 UTC (permalink / raw)
To: Amirouche Boubekki; +Cc: guix-devel
Amirouche Boubekki (2015-08-19 18:31 +0300) wrote:
> Le 2015-08-19 15:04, Thompson, David a écrit :
>> On Wed, Aug 19, 2015 at 4:27 AM, Amirouche Boubekki
>> <amirouche@hypermove.net> wrote:
>>> Le 2015-08-09 17:59, David Thompson a écrit :
>>>>
>>>> In my personal projects, I keep a 'package.scm' file in the root of
>>>> the
>>>> source tree for use with 'guix environment -l'. However, it's also
>>>> handy to install that package by using 'guix package -e':
>>>>
>>>> guix package -e '(primitive-load "package.scm")'
>>>>
>>>> This patch adds a shorthand for this:
>>>>
>>>> guix package -f package.scm
>>>
>>>
>>> What about dispatch `guix package -i` depending on the argument. In
>>> principle there will be no "*.scm$" packages so the above could be
>>>
>>> guix package -i package.scm
>>>
>>> The idea behind that is to keep the number of command to minimum. In
>>> this
>>> case, IMO, it makes sens to merge both logic inside the same UI.
>>
>> That won't work because it creates ambiguities in the package spec
>> syntax.
I agree with David on another option instead of adding a special case to
"--install". I think you can't rely on ".scm" extension.
[...]
> My opinion, is that instead of adding options/modifiers to "guix
> package", it should be split into "guix package install", "guix package
> search", "guix package show" and "guix package generation". It might not
> be obvious and is afaik not a cli layout that is widespread but it will
> greatly help people get their hands on guix.
I would also like subcommands for "guix package" but what about
simultaneous installing+removing that can be currently done with "guix
package -i foo -r bar"?
--
Alex
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-08-20 2:26 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-09 15:59 [PATCH] scripts: package: Add --install-from-file option David Thompson
2015-08-10 14:22 ` Alex Kost
2015-08-18 19:30 ` Ludovic Courtès
2015-08-19 0:17 ` Thompson, David
2015-08-19 22:38 ` Ludovic Courtès
2015-08-20 2:26 ` Thompson, David
2015-08-19 8:27 ` Amirouche Boubekki
2015-08-19 8:56 ` Amirouche Boubekki
2015-08-19 14:48 ` Claes Wallin (韋嘉誠)
2015-08-19 13:04 ` Thompson, David
2015-08-19 13:54 ` Taylan Ulrich Bayırlı/Kammer
2015-08-19 15:31 ` Amirouche Boubekki
2015-08-19 19:15 ` Alex Kost
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).