Allowing PNR to decide which github checksum is used

This commit is contained in:
Jay McCarthy 2013-02-05 07:24:25 -07:00
parent fa4548f401
commit fb915825e9
2 changed files with 30 additions and 7 deletions

View File

@ -398,7 +398,10 @@
#:force? [force? #f]
descs)
(define check-sums? (not ignore-checksums?))
(define (install-package pkg given-type given-pkg-name)
(define (install-package pkg
given-type
given-pkg-name
#:given-checksum [given-checksum #f])
(define-values (inferred-pkg-name type)
(if (path? pkg)
(package-source->name+type (path->string pkg)
@ -428,16 +431,19 @@
(update-install-info-orig-pkg
(match type
['github
(when given-checksum
(set! checksum given-checksum))
(unless checksum
(pkg-error (~a "could not find checksum for github package source, which implies it doesn't exist\n"
" source: ~a")
pkg))
(pkg-error
(~a "could not find checksum for github package source, which implies it doesn't exist\n"
" source: ~a")
pkg))
(match-define (list* user repo branch path)
(map path/param-path (url-path/no-slash pkg-url)))
(define new-url
(url "https" #f "github.com" #f #t
(map (λ (x) (path/param x empty))
(list user repo "tarball" branch))
(list user repo "tarball" checksum))
empty
#f))
(define tmp.tgz
@ -644,7 +650,8 @@
(define checksum (hash-ref index-info 'checksum))
(define info (install-package source
#f
pkg-name))
pkg-name
#:given-checksum checksum))
(when (and (install-info-checksum info)
check-sums?
(not (equal? (install-info-checksum info) checksum)))

View File

@ -20,4 +20,20 @@
(shelly-install "remote/github with slash"
"github://github.com/jeapostrophe/galaxy/master/tests/planet2/test-pkgs/planet2-test1/")
(shelly-install "remote/github with auto prefix"
"--type github jeapostrophe/galaxy/master/tests/planet2/test-pkgs/planet2-test1/")))
"--type github jeapostrophe/galaxy/master/tests/planet2/test-pkgs/planet2-test1/")
(hash-set! *index-ht-1* "planet2-test1-github-different-checksum"
(hasheq 'checksum
"23eeaee731e72a39bddbacdf1ed6cce3bcf423a5"
'source
"github://github.com/jeapostrophe/galaxy/master/tests/planet2/test-pkgs/planet2-test1/"))
(with-fake-root
(shelly-case
"remote/name package"
$ "raco pkg config --set indexes http://localhost:9990"
$ "racket -e '(require planet2-test1)'" =exit> 1
$ "raco pkg install planet2-test1-github-different-checksum"
$ "racket -e '(require planet2-test1)'"
$ "raco pkg remove planet2-test1-github-different-checksum"
$ "racket -e '(require planet2-test1)'" =exit> 1))))