Added check that libraries' NEWS version equals their pkg-def version.

This commit is contained in:
Anthony Carrico 2005-07-08 01:20:14 +00:00
parent 135f15e295
commit 073be64796
2 changed files with 65 additions and 2 deletions

View File

@ -22,10 +22,14 @@ scsh-blurbs := $(shell find scsh \
-maxdepth 2 -mindepth 2 \
-name BLURB)
targets := DETAILS COPYING pkg-def.scm
.PHONY: version-check
version-check :
build/version-check.scm
targets := DETAILS COPYING pkg-def.scm version-check
.PHONY: all
all : $(targets)
all : $(targets) check-versions
DETAILS : $(s48-authors) $(s48-blurbs) $(scsh-authors) $(scsh-blurbs) \
build/details.scm build/dirs.scm build/header.scm

59
build/version-check.scm Executable file
View File

@ -0,0 +1,59 @@
#! /bin/sh
exec scsh -o filenames -s "$0" "$@"
!#
;;; This file is part of the Scheme Untergrund Library. For copyright
;;; information, see the file COPYING which comes with the
;;; distribution.
(load "build/common.scm")
(load "build/dirs.scm")
(define version-re
(rx "version"
(+ " ")
(submatch (+ numeric))
(* "." (submatch (+ numeric)))))
(define string->version
(lambda (v)
(let* ((match (regexp-search version-re v))
(major (string->number (match:substring match 1)))
(minor (match:substring match 2)))
(if minor
(list major (string->number minor))
(list major)))))
(define ok '#t)
(define check
(lambda (dir)
(call-with-input-file
(string-append dir "/pkg-def.scm")
(lambda (port)
(let try-again ()
(let ((form (read port)))
(cond ((eof-object? form)
(error "can't find package version"))
((and (pair? form)
(eq? (car form) 'define-package))
(let ((name (cadr form))
(version-pkg-def (caddr form))
(version-news
(call-with-input-file
(string-append dir "/NEWS")
(lambda (news-port)
(string->version (read-line news-port))))))
(if (not (equal? version-pkg-def version-news))
(let ()
(display "version mismatch in: ")
(display name)
(newline)
(set! ok '#f)))))
(else
(try-again)))))))))
(for-each check scsh-dirs)
(for-each check s48-dirs)
(exit (if ok 0 1))