mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
describe: Save the original value of (program-arguments).
Fixes <https://bugs.gnu.org/42688>. Reported by pkill9 <pkill9@runbox.com>. This ensures that 'guix repl -s SCRIPT' give SCRIPT the right value of (current-profile), which in turn ensures that (%package-module-path) is initialized with the right set of channels. * guix/describe.scm (initial-program-arguments): New variable. (current-profile): Use it. * guix/scripts/repl.scm (guix-repl): Call 'current-profile' before 'set-program-arguments'.
This commit is contained in:
parent
0996fcc657
commit
1b179d7876
2 changed files with 16 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -43,11 +43,17 @@ (define-module (guix describe)
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(define initial-program-arguments
|
||||||
|
;; Save the initial program arguments. This allows us to see the "real"
|
||||||
|
;; 'guix' program, even if 'guix repl -s' calls 'set-program-arguments'
|
||||||
|
;; later on.
|
||||||
|
(program-arguments))
|
||||||
|
|
||||||
(define current-profile
|
(define current-profile
|
||||||
(mlambda ()
|
(mlambda ()
|
||||||
"Return the profile (created by 'guix pull') the calling process lives in,
|
"Return the profile (created by 'guix pull') the calling process lives in,
|
||||||
or #f if this is not applicable."
|
or #f if this is not applicable."
|
||||||
(match (command-line)
|
(match initial-program-arguments
|
||||||
((program . _)
|
((program . _)
|
||||||
(and (string-suffix? "/bin/guix" program)
|
(and (string-suffix? "/bin/guix" program)
|
||||||
;; Note: We want to do _lexical dot-dot resolution_. Using ".."
|
;; Note: We want to do _lexical dot-dot resolution_. Using ".."
|
||||||
|
|
|
@ -27,6 +27,7 @@ (define-module (guix scripts repl)
|
||||||
#:use-module (srfi srfi-37)
|
#:use-module (srfi srfi-37)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (rnrs bytevectors)
|
#:use-module (rnrs bytevectors)
|
||||||
|
#:autoload (guix describe) (current-profile)
|
||||||
#:autoload (system repl repl) (start-repl)
|
#:autoload (system repl repl) (start-repl)
|
||||||
#:autoload (system repl server)
|
#:autoload (system repl server)
|
||||||
(make-tcp-server-socket make-unix-domain-server-socket)
|
(make-tcp-server-socket make-unix-domain-server-socket)
|
||||||
|
@ -176,6 +177,13 @@ (define script
|
||||||
;; Run script
|
;; Run script
|
||||||
(save-module-excursion
|
(save-module-excursion
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
;; Invoke 'current-profile' so that it memoizes the correct value
|
||||||
|
;; based on (program-arguments), before we call
|
||||||
|
;; 'set-program-arguments'. This in turn ensures that
|
||||||
|
;; (%package-module-path) will contain entries for the channels
|
||||||
|
;; available in the current profile.
|
||||||
|
(current-profile)
|
||||||
|
|
||||||
(set-program-arguments script)
|
(set-program-arguments script)
|
||||||
(set-user-module)
|
(set-user-module)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue