planet2: include the Racket version number in a PNR request

The version number is included as the query part of the constructed
URL, so it is easily ignored by a server. The intent is that the
PLT PNRs will eventually support version-specific results.
This commit is contained in:
Matthew Flatt 2012-12-20 12:05:40 -07:00
parent 0e140a8173
commit 5259f159af
2 changed files with 13 additions and 5 deletions

View File

@ -211,8 +211,13 @@
(define (package-index-lookup pkg)
(or
(for/or ([i (in-list (read-pkg-cfg/def "indexes"))])
(define addr (combine-url/relative (string->url i)
(format "pkg/~a" pkg)))
(define addr/no-query (combine-url/relative (string->url i)
(format "pkg/~a" pkg)))
(define addr (struct-copy url addr/no-query
[query (append
(url-query addr/no-query)
(list
(cons 'version (version))))]))
(log-planet2-debug "resolving via ~a" (url->string addr))
(call/input-url+200
addr

View File

@ -154,11 +154,14 @@ means that it has only the characters @|package-name-chars|.}
A @deftech{package name resolver} (@deftech{PNR}) is a server that
converts package names to other package sources. A PNR is identified
by a string representing a URL, such that appending
@exec{pkg/}@nonterm{package} forms a URL that refers to a
by a string representing a URL. This URL is combined with
@exec{pkg/}@nonterm{package} path segments (where @nonterm{package} is a package name) plus a
@exec{version=}@nonterm{version} query (where @nonterm{version} is the
Racket version number) to form a URL that should refer to a
@racket[read]-able hash table with the keys: @racket['source] mapped to
the @tech{package source} string and @racket['checksum] mapped to the
@tech{checksum} value. Typically, the source will be a remote URL.
@tech{checksum} value. Typically, the @tech{package source} value for
@racket['source] will be a remote URL.
PLT supports two @tech{package name resolvers} that are enabled by
default: @url{https://plt-etc.byu.edu:9004} for new