From 11aca05fb5891d9188323bba83db5e39cb6dbac6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 29 May 2014 11:15:56 +0100 Subject: [PATCH] pkg/lib: fix `pkg-catalog-update-local` version selection Also fixes problems with using a relative target path with `raco pkg catalog-archive`. --- racket/collects/pkg/db.rkt | 5 +++-- racket/collects/pkg/lib.rkt | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/racket/collects/pkg/db.rkt b/racket/collects/pkg/db.rkt index 7e420ef157..2246d0ce63 100644 --- a/racket/collects/pkg/db.rkt +++ b/racket/collects/pkg/db.rkt @@ -130,8 +130,9 @@ (lambda () (define file (current-pkg-catalog-file)) (define dir (path-only file)) - (unless (directory-exists? dir) - (make-directory* dir)) + (when dir + (unless (directory-exists? dir) + (make-directory* dir))) (set! db (sqlite3-connect #:database file #:mode 'create #:busy-retry-limit +inf.0))) diff --git a/racket/collects/pkg/lib.rkt b/racket/collects/pkg/lib.rkt index cf79b90360..b0c4d86043 100644 --- a/racket/collects/pkg/lib.rkt +++ b/racket/collects/pkg/lib.rkt @@ -460,7 +460,7 @@ (let-values ([(base name dir?) (split-path path)]) base) path)) - (path->string (simplify-path (path->complete-path s dir)))] + (path->string (simplify-path (path->complete-path s (path->complete-path dir))))] [else (url->string (combine-url/relative i s))])) (hash-set ht 'source full-path)] @@ -2579,7 +2579,8 @@ (newline))))] [else (define pkg (format "~a.~a" pkg-name create:format)) - (define actual-dest-dir (or dest-dir + (define actual-dest-dir (if dest-dir + (path->complete-path dest-dir) (let-values ([(base name dir?) (split-path dir)]) (cond [(path? base) (path->complete-path base)] @@ -3147,7 +3148,8 @@ (unless quiet? (printf/flush "Updating from ~a\n" catalog)) (parameterize ([current-pkg-catalogs (list (string->url catalog))]) - (define details (get-all-pkg-details-from-catalogs)) + (define details (for/hash ([(name ht) (get-all-pkg-details-from-catalogs)]) + (values name (select-info-version ht)))) ;; set packages: (db:set-pkgs! catalog (for/list ([(name ht) (in-hash details)]) (db:pkg name