[PATCH] A hack to make checksums more flexible for github

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Wed Jan 30 17:42:59 EST 2013

---
 collects/planet2/lib.rkt |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/collects/planet2/lib.rkt b/collects/planet2/lib.rkt
index d5404f3..699170e 100644
--- a/collects/planet2/lib.rkt
+++ b/collects/planet2/lib.rkt
@@ -398,7 +398,9 @@
          #: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
+                           ;; This is hackish, but it demonstrates it works
+                           #:index-checksum [index-checksum #f])
     (define-values (inferred-pkg-name type) 
       (if (path? pkg)
           (package-source->name+type (path->string pkg)
@@ -428,6 +430,7 @@
         (update-install-info-orig-pkg
          (match type
            ['github
+            (set! checksum index-checksum)
             (unless checksum
               (pkg-error (~a "could not find checksum for github package source, which implies it doesn't exist\n"
                              "  source: ~a")
@@ -437,7 +440,7 @@
             (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 +647,8 @@
       (define checksum (hash-ref index-info 'checksum))
       (define info (install-package source
                                     #f
-                                    pkg-name))
+                                    pkg-name
+                                    #:index-checksum checksum))
       (when (and (install-info-checksum info)
                  check-sums?
                  (not (equal? (install-info-checksum info) checksum)))
-- 
1.7.10.4


--wac7ysb48OaltWcw--

Posted on the dev mailing list.