summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2026-08-24 13:42:00 +0200
committerLudovic Courtès <ludo@gnu.org>2026-08-24 13:42:00 +0200
commit1764be570c2366a07da8b79cc903f9cbc994e216 (patch)
tree0816fd0aca9fb7847cdd60f834fb791ea2a90229
parentf7ecec459671333039b4164abab9960126f876bc (diff)
Revert "ui: Fix not finding compiled files when loading extensions"
This reverts commit bf1f18130f2b54a2bd1e8a57d6dae3a611573ee8, which broke extension loading entirely due to the mismatch between the module name and the file tree layout, as discussed at <https://codeberg.org/guix/guix/pulls/10705#issuecomment-21630365>.
-rw-r--r--guix/ui.scm34
1 files changed, 20 insertions, 14 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 78a58e353e1..dafc04b20f7 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2447,17 +2447,26 @@ found."
2447 2447
2448 (define module 2448 (define module
2449 ;; Check if there is a matching extension. 2449 ;; Check if there is a matching extension.
2450 (catch 'misc-error 2450 (match (search-path (extension-directories)
2451 (lambda () 2451 (format #f "~a.scm" command))
2452 (or (false-if-exception (resolve-interface `(guix scripts ,command))) 2452 (#f
2453 (resolve-interface `(guix extensions ,command)))) 2453 (catch 'misc-error
2454 (lambda _ 2454 (lambda ()
2455 (let ((hint (command-hint command (commands)))) 2455 (resolve-interface `(guix scripts ,command)))
2456 (format (current-error-port) 2456 (lambda _
2457 (G_ "guix: ~a: command not found~%") command) 2457 (let ((hint (command-hint command (commands))))
2458 (when hint 2458 (format (current-error-port)
2459 (display-hint (G_ "Did you mean @code{~a}?") hint)) 2459 (G_ "guix: ~a: command not found~%") command)
2460 (show-guix-usage))))) 2460 (when hint
2461 (display-hint (G_ "Did you mean @code{~a}?") hint))
2462 (show-guix-usage)))))
2463 (file
2464 (load file)
2465 (let ((maybe-extension-path
2466 (format #f "/guix/extensions/~a.scm" command)))
2467 (if (string-suffix? maybe-extension-path file)
2468 (resolve-interface `(guix extensions ,command))
2469 (resolve-interface `(guix scripts ,command)))))))
2461 2470
2462 (let ((command-main (module-ref module 2471 (let ((command-main (module-ref module
2463 (symbol-append 'guix- command)))) 2472 (symbol-append 'guix- command))))
@@ -2481,9 +2490,6 @@ and signal handling have already been set up."
2481 ;; number of 'stat' calls per entry in %LOAD-PATH. Shamelessly remove it. 2490 ;; number of 'stat' calls per entry in %LOAD-PATH. Shamelessly remove it.
2482 (set! %load-extensions '(".scm")) 2491 (set! %load-extensions '(".scm"))
2483 2492
2484 ;; Extensions take precedence over core commands.
2485 (set! %load-path (append (extension-directories) %load-path))
2486
2487 ;; Disable canonicalization so we don't don't stat unreasonably. 2493 ;; Disable canonicalization so we don't don't stat unreasonably.
2488 (with-fluids ((%file-port-name-canonicalization #f)) 2494 (with-fluids ((%file-port-name-canonicalization #f))
2489 (match args 2495 (match args