Skip to content

Commit b78460d

Browse files
Merge pull request rudolfochrist#20 from digikar99/ultralisp
Support ultralisp
2 parents 5a501e0 + 26b9434 commit b78460d

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

content-hash.lisp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ starting storage block in STREAM, and the total file size."
127127
until (= byte (char-code #\Newline))
128128
do (write-char (code-char byte) string))))
129129

130-
(defun content-hash (tarfile)
130+
(defun content-hash (tarfile &optional content-info-processor)
131131
"Return a hash string of TARFILE. The hash is computed by creating
132132
the digest of the files in TARFILE in order of their name."
133133
(uiop:with-temporary-file (:pathname temp)
@@ -150,7 +150,10 @@ the digest of the files in TARFILE in order of their name."
150150
(read-sequence buffer stream)
151151
(write-sequence buffer digest-stream :end partial))))
152152
(let ((contents (content-info stream)))
153-
(setf contents (sort contents #'string< :key #'first))
153+
(setf contents
154+
(if content-info-processor
155+
(funcall content-info-processor contents)
156+
contents))
154157
(dolist (info contents)
155158
(destructuring-bind (position size)
156159
(rest info)

ql-https.lisp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,15 @@
5959
(apply #'fetcher url file args)))))
6060

6161
(defun url-to-release (url)
62-
"extracts name of release from URL"
63-
(when (search "/archive/" url)
64-
(let* ((start (+ (search "/archive/" url) (length "/archive/")))
65-
(end (position #\/ url :start start)))
66-
(subseq url start end))))
62+
"obtains name of release from URL"
63+
(let* ((http-url (if (string-equal "https" (subseq url 0 5))
64+
(uiop:strcat "http" (subseq url 5))
65+
url))
66+
(all-releases (ql-dist:provided-releases t))
67+
(release (find http-url all-releases
68+
:test #'string=
69+
:key #'ql-dist:archive-url)))
70+
(ql-dist:project-name release)))
6771

6872
#+sbcl
6973
(defun md5 (file)
@@ -91,12 +95,15 @@
9195
"Checks that the md5 and size of FILE are as expected from the quicklisp
9296
dist."
9397
(let ((release (ql-dist:find-release name)))
98+
(unless (= (ql-dist:archive-size release) (file-size file))
99+
(error "file size mismatch for ~A" name))
94100
(unless (string-equal (ql-dist:archive-md5 release) (md5 file))
95101
(error "md5 mismatch for ~A" name))
96-
(unless (string-equal (ql-dist:archive-content-sha1 release) (content-hash file))
97-
(error "sha1 mismatch for ~A" name))
98-
(unless (= (ql-dist:archive-size release) (file-size file))
99-
(error "file size mismatch for ~A" name))))
102+
(unless (member (ql-dist:archive-content-sha1 release)
103+
(list (content-hash file (lambda (c) (sort c #'string< :key #'first)))
104+
(content-hash file #'reverse))
105+
:test #'string-equal)
106+
(error "sha1 mismatch for ~A" name))))
100107

101108
(defun register-fetch-scheme-functions ()
102109
(setf ql-http:*fetch-scheme-functions*

0 commit comments

Comments
 (0)