#!/bin/sh #| -*- scheme -*- tmp="/tmp/path-compare-$$" if [ -x "$PLTHOME/bin/racket" ]; then "$PLTHOME/bin/racket" -r "$0" "$@" else "racket" -r "$0" "$@" fi > "$tmp" || exit 1 cd "`dirname \"$0\"`" if diff "paths-configure-snapshot" "$tmp"; then echo "PATHS OK"; rm "$tmp"; exit 0 else echo "*** PATHS DATA MISMATCH (see $tmp) ***"; exit 1 fi |# ;; Extract path information from the configure script, so it can be compared ;; to a snapshot and generate an error each time things change (define configure-path (simplify-path (build-path ;; (find-executable-path ;; (find-system-path 'exec-file) (find-system-path 'collects-dir) #t) (find-system-path 'exec-file) 'up 'up "src" "configure"))) (unless (file-exists? configure-path) (error "Cannot find `configure':" configure-path)) (define current-match (make-parameter #f)) (define (match? . bytess) (cond [(regexp-match (byte-regexp (apply bytes-append bytess)) (current-input-port)) => (lambda (m) (current-match (car m)) #t)] [else #f])) (define (show-match) (write-bytes (current-match))) (with-input-from-file configure-path (lambda () (if (match? #"\n# Installation directory options.\n" #"(?:#[^\n]*\n)+" #"(?:[a-z]+=[^\n]+\n)+" #"\n") (show-match) (error "Did not find first block")) (if (match? #"\n#+ Install targets #+\n\n" #"unixstyle=no\n" #"if (?:[^\n]+\n)+fi\n\n" #"MAKE_COPYTREE=no\n" #"if [^\n]+\n" #"(?: +[^\n]+\n)+" #"else\n" #"(?: +[^\n]+\n)+" #"fi\n\n") (show-match) (error "Did not find second block")) (if (match? #"\n +echo \">>> Installation targets:\"\n" #"(?: +echo [^\n]+\n)+") (show-match) (error "Did not find third block")))) (exit)