jpkg: show default registry in dir list; sync before search
ober
fd77bce8deca9b11665ff8788bdcc0aae81d9ad1
--- a/lib/std/pkg/commands.ss +++ b/lib/std/pkg/commands.ss @@ -447,7 +447,10 @@ (let* ([listed (dir-list)] [src (car listed)] [entries (cdr listed)]) (say "package directories (~a):" - (if (eq? src 'env) "from JERBOA_PKG_REGISTRIES" "from config file")) + (case src + [(env) "from JERBOA_PKG_REGISTRIES"] + [(default) "from built-in default (sync from public @lisp mirror)"] + [else "from config file"])) (if (null? entries) (say " (none configured)") (for-each (lambda (e) (say " ~a -> ~a" (car e) (cdr e))) entries)) --- a/lib/std/pkg/search.ss +++ b/lib/std/pkg/search.ss @@ -31,7 +31,8 @@ (only (std pkg semver) semver-try-parse semver-compare semver-prerelease) (only (std pkg registry) registry-config registry-versions-for registry-release-for - release-info-yanked? release-info-dependencies) + release-info-yanked? release-info-dependencies + ensure-default-registry-synced!) (only (std pkg tuf) tuf-registry?)) (defstruct search-row @@ -79,6 +80,7 @@ (def (search-index) ;; one row per package across all configured registries + (ensure-default-registry-synced!) ;; sync built-in default from mirror on first use (let ([rows '()]) (for-each (lambda (cfg) @@ -176,11 +178,16 @@ (display ")\n" out)))))) (def (dir-list) - ;; env override shadows the file (read-only) — report both honestly - (let ([env (getenv "JERBOA_PKG_REGISTRIES")]) - (if (and env (> (string-length env) 0)) - (cons 'env (registry-config)) - (cons 'file (read-config))))) + ;; env override shadows the file (read-only) — report both honestly. + ;; When neither env nor file configures anything, registry-config falls + ;; back to the built-in default @lisp registry; report that as "default". + (let ([env (getenv "JERBOA_PKG_REGISTRIES")] + [no-default (getenv "JPKG_NO_DEFAULT_REGISTRY")]) + (cond + [(and env (> (string-length env) 0)) (cons 'env (registry-config))] + [(and no-default (> (string-length no-default) 0)) (cons 'file (read-config))] + [(null? (read-config)) (cons 'default (registry-config))] + [else (cons 'file (read-config))]))) (def (env-registries-set?) (let ([e (getenv "JERBOA_PKG_REGISTRIES")])