From ad0c103b5eddd77a497955f75d9808bca0d8dedc Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Sun, 4 Oct 2009 01:45:18 -0400 Subject: [PATCH] Added md5sum-checking code to install-aur-package. --- aur.lisp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/aur.lisp b/aur.lisp index 4e12ab3..c0efaf7 100644 --- a/aur.lisp +++ b/aur.lisp @@ -91,9 +91,22 @@ (setf (current-directory) pkg-name) - ;; ask user whether he wishes to edit the PKGBUILD - (when (ask-y/n "Review/edit PKGBUILD" t) - (launch-editor "PKGBUILD")) + (flet ((review-pkgbuild () ;; ask user whether he wishes to edit the PKGBUILD + (when (ask-y/n "Review/edit PKGBUILD" t) + (launch-editor "PKGBUILD")))) + ;; check to see if the PKGBUILD has been seen before + ;; if not, add its md5sum to the checksum-db and ask the user to review it + ;; otherwise, compare its md5sum to that on record and prompt the user if necessary + (multiple-value-bind (value present) (gethash pkg-name *checksums*) + (let ((pkgbuild-md5 (sb-md5:md5sum-file "PKGBUILD"))) + (if (not present) + (progn + (review-pkgbuild) + (setf (gethash pkg-name *checksums*) pkgbuild-md5)) + (unless (equal value pkgbuild-md5) + (when (ask-y/n "The PKGBUILD checksum doesn't match our records. Review the PKGBUILD?") + (launch-editor "PKGBUILD"))))))) + (unless (ask-y/n (format nil "Continue building ~S" pkg-name) t) (return-from install-aur-package))