raco pkg: repairs for SQLite-based catalogs

This commit is contained in:
Matthew Flatt 2013-11-06 15:52:43 -07:00
parent 2872f83a17
commit ab1e54ff4a
2 changed files with 9 additions and 6 deletions

View File

@ -145,7 +145,7 @@ constructed in any way as long as it contains the following tables:
@verbatim[#:indent 2]{(id SMALLINT, @verbatim[#:indent 2]{(id SMALLINT,
url TEXT, url TEXT,
pos SMALLINT)}. pos SMALLINT)}
Normally, the only row in this table is @tt{(0, "local", 0)}, Normally, the only row in this table is @tt{(0, "local", 0)},
but a database that records the content of a set of other but a database that records the content of a set of other

View File

@ -461,7 +461,7 @@
'modules mods 'modules mods
'dependencies deps)) 'dependencies deps))
(hash 'source (db:pkg-source pkg) (hash 'source (db:pkg-source pkg)
'checksum (db:pkg-source pkg)))) 'checksum (db:pkg-checksum pkg))))
(define (remote-package-checksum pkg download-printf pkg-name) (define (remote-package-checksum pkg download-printf pkg-name)
(match pkg (match pkg
@ -2551,25 +2551,28 @@
(cond (cond
[(db-path? dest-path) [(db-path? dest-path)
(define vers-details
(for/hash ([(k v) (in-hash details)])
(values k (select-info-version v))))
(parameterize ([db:current-pkg-catalog-file dest-path]) (parameterize ([db:current-pkg-catalog-file dest-path])
(db:set-catalogs! '("local")) (db:set-catalogs! '("local"))
(db:set-pkgs! "local" (db:set-pkgs! "local"
(for/list ([(k v) (in-hash details)]) (for/list ([(k v) (in-hash vers-details)])
(db:pkg k "local" (db:pkg k "local"
(hash-ref v 'author "") (hash-ref v 'author "")
(hash-ref v 'source "") (hash-ref v 'source "")
(hash-ref v 'checksum "") (hash-ref v 'checksum "")
(hash-ref v 'description "")))) (hash-ref v 'description ""))))
(for ([(k v) (in-hash details)]) (for ([(k v) (in-hash vers-details)])
(define t (hash-ref v 'tags '())) (define t (hash-ref v 'tags '()))
(unless (null? t) (unless (null? t)
(db:set-pkg-tags! k "local" t))) (db:set-pkg-tags! k "local" t)))
(for ([(k v) (in-hash details)]) (for ([(k v) (in-hash vers-details)])
(define mods (hash-ref v 'modules '())) (define mods (hash-ref v 'modules '()))
(unless (null? mods) (unless (null? mods)
(define cs (hash-ref v 'checksum "")) (define cs (hash-ref v 'checksum ""))
(db:set-pkg-modules! k "local" cs mods))) (db:set-pkg-modules! k "local" cs mods)))
(for ([(k v) (in-hash details)]) (for ([(k v) (in-hash vers-details)])
(define deps (hash-ref v 'dependencies '())) (define deps (hash-ref v 'dependencies '()))
(unless (null? deps) (unless (null? deps)
(define cs (hash-ref v 'checksum "")) (define cs (hash-ref v 'checksum ""))