(defun system-checksum (system &optional (digest 'ironclad:sha256)) "Return a checksum of files in a system." (let (streams) (flet ((open-thing (c) (let ((s (open (if (pathnamep c) c (asdf/component:component-pathname c)) :direction :input :element-type '(unsigned-byte 8)))) (push s streams) s))) (unwind-protect (ironclad:digest-stream digest (apply #'make-concatenated-stream (mapcar #'open-thing (append (asdf/component:component-children (asdf/system:find-system system)) (list (asdf:system-source-file (asdf:find-system system))))))) (map nil (lambda (s) (close s)) streams)))))