From 41227bf7a4f02ab69c16aab2b6b9126539fbb868 Mon Sep 17 00:00:00 2001 From: Ethan Date: Mon, 23 Feb 2026 18:34:32 -0500 Subject: [PATCH] ql-https.lisp ~ rewrite verify-download to be a CLOS `:after` method This hooks directly into `ql-dist:check-local-archive-file`, and will perform our checks of the file at exactly the right time (after ql-dist does its own internal checks of the archive file). As a result we don't have to check the file size ourself, nor lookup the release. --- ql-https.lisp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ql-https.lisp b/ql-https.lisp index d0e2cb5..7e594aa 100644 --- a/ql-https.lisp +++ b/ql-https.lisp @@ -38,8 +38,6 @@ :error-output :output)) (file (and file (probe-file file))) (release (url-to-release url))) - (when release - (verify-download file release)) (values output file)) (restart-case (handler-bind ((no-https-error (lambda (c) @@ -92,14 +90,15 @@ (with-open-file (f file) (file-length f))) -(defun verify-download (file name) +(defmethod ql-dist:check-local-archive-file :after ((release ql-dist:release)) "Checks that the md5 and size of FILE are as expected from the quicklisp dist." - (let ((release (ql-dist:find-release name))) - (unless (= (ql-dist:archive-size release) (file-size file)) - (error "file size mismatch for ~A" name)) + (let ((name (ql-dist:name release)) + (file (ql-dist:local-archive-file release))) + (unless (string-equal (ql-dist:archive-md5 release) (md5 file)) (error "md5 mismatch for ~A" name)) + (unless (member (ql-dist:archive-content-sha1 release) (list (content-hash file (lambda (c) (sort c #'string< :key #'first))) (content-hash file #'reverse))