|
Last change
on this file was
15267,
checked in by Mark Evenson, 6 years ago
|
|
abcl-build: ignore errors on ANT/CALL
Both ignore and report as a string any errors returned by an ANT/CALL.
Add machinery to report SHA256 hashes for contents of a directory.
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | (in-package :abcl/build) |
|---|
| 2 | |
|---|
| 3 | ;;; FIXME: will not work if DIRECTORY contains subdirectories |
|---|
| 4 | (defun directory-hashes (directory) |
|---|
| 5 | "Return the size and sha256 hash of every direct entry of DIRECTORY." |
|---|
| 6 | (let ((d (if (typep directory 'pathname) |
|---|
| 7 | directory |
|---|
| 8 | (pathname (concatenate 'string directory "/"))))) |
|---|
| 9 | (let ((result |
|---|
| 10 | (loop :for file |
|---|
| 11 | :in (directory (merge-pathnames "*.*" d)) |
|---|
| 12 | :collecting (list |
|---|
| 13 | file |
|---|
| 14 | (with-open-file (s file :direction :input) |
|---|
| 15 | (when s |
|---|
| 16 | (file-length s))) |
|---|
| 17 | (sys:sha256 file))))) |
|---|
| 18 | (values |
|---|
| 19 | result |
|---|
| 20 | (hashes-report result))))) |
|---|
| 21 | |
|---|
| 22 | (defun hashes-report (report) |
|---|
| 23 | (format nil "~{~a~}~%" |
|---|
| 24 | (loop :for (file size hash) :in report |
|---|
| 25 | :collecting (format nil "~%<file:~a>~%~t:size ~a ;~%~t:sha256 ~a ." |
|---|
| 26 | file size hash)))) |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.