~ chicken-core (chicken-5) c7f73c9510fd6f0201293ec372cb22c1462e70b3


commit c7f73c9510fd6f0201293ec372cb22c1462e70b3
Author:     Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Sat Feb 11 15:49:42 2023 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Wed Feb 15 11:43:18 2023 +0100

    chicken-install: Add -location command line option
    
    The -location (short: -l) command line option is equivalent to the
    `location' form in setup.defaults.
    
    The command line option takes precedence over the form in
    setup.defaults.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/NEWS b/NEWS
index a314faf3..ec7b4cb5 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,9 @@
     collisions with source files on case-insensitive file systems
     like on MacOS (#1753, reported by Kon Lovett).
   - chicken-install now caches eggs installed from local locations.
+  - chicken-install now accepts the -location command line option
+    (short: -l) to specify local directories where to get egg sources
+    from.
 
 - Compiler
   - When emitting types files, the output list is now sorted, to ensure
diff --git a/chicken-install.scm b/chicken-install.scm
index 506f9771..4a6eb9b1 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -1081,6 +1081,9 @@ usage: chicken-install [OPTION ...] [NAME[:VERSION] ...]
        -force                   don't ask, install even if versions don't match
   -k   -keep                    keep temporary files
   -s   -sudo                    use external command to elevate privileges for filesystem operations
+  -l   -location DIRECTORY      get egg sources from DIRECTORY.  May be provided multiple times.
+                                Locations specified on the command line have precedence over the
+                                ones specified in setup.defaults.
   -r   -retrieve                only retrieve egg into cache directory, don't install (giving `-r'
                                 more than once implies `-recursive')
        -recursive               if `-retrieve' is given, retrieve also dependencies
@@ -1177,6 +1180,13 @@ EOF
                   ((member arg '("-s" "-sudo"))
                    (set! sudo-install #t)
                    (loop (cdr args)))
+                  ((member arg '("-l" "-location"))
+                   (when (null? (cdr args))
+                     (fprintf (current-error-port) "-l|-location: missing argument.~%")
+                     (exit 1))
+                   (set! default-locations
+                     (append (list (cadr args)) default-locations))
+                   (loop (cddr args)))
                   ((member arg '("-n" "-no-install"))
                    (set! no-install #t)
                    (loop (cdr args)))
Trap