Make zo-path checking available as a library.

This commit is contained in:
Sam Tobin-Hochstadt 2015-12-11 10:14:12 -05:00
parent 6593594ebf
commit acbcff1bf4

View File

@ -1,6 +1,8 @@
#lang racket
(require setup/dirs)
(provide check-one)
;; Paths from the build location shouldn't show up in bytecode files
;; or documentation. Check ".zo", ".dep", and ".html" files in the
;; build on the assumption that the first three elements of the
@ -14,23 +16,23 @@
(take (explode-path (find-collects-dir))
3))))))
(define (check-content rx:name)
(lambda (name kind v)
(when (regexp-match? rx:name name)
(call-with-input-file* name
(lambda (in)
(when (regexp-match? rx:dir in)
(eprintf "Found ~s in ~s\n" rx:dir name)))))))
(define (check-one file)
(call-with-input-file*
file
(lambda (in)
(when (regexp-match? rx:dir in)
(eprintf "Found ~s in ~s\n" rx:dir file)))))
(fold-files (check-content #rx"[.](?:zo|dep)$")
(void)
(find-collects-dir))
(define ((check-content rx:name) name kind v)
(when (regexp-match? rx:name name)
(check-one name)))
(fold-files (check-content #rx"[.](?:zo|dep)$")
(void)
(find-pkgs-dir))
(module+ main
(fold-files (check-content #rx"[.](?:zo|dep)$")
(void)
(find-pkgs-dir))
;; Check rendered docs, too:
(fold-files (check-content #rx"[.](?:html)$")
(void)
(find-doc-dir))
;; Check rendered docs, too:
(fold-files (check-content #rx"[.](?:html)$")
(void)
(find-doc-dir)))