make versionpatch deal with two-part versions too

This commit is contained in:
Eli Barzilay 2010-06-05 17:06:05 -04:00
parent 347e0da798
commit 1dc36d24fc

View File

@ -8,7 +8,7 @@ exec racket -um "$0" "$@"
(define (patches) (define (patches)
;; no grouping parens in regexps ;; no grouping parens in regexps
(let* ([3parts? (regexp-match? #rx"^[0-9]+\\.[0-9]+\\.[0-9]+$" the-version)] (let* ([parts# (length (regexp-split #rx"[.]" the-version))]
[concat [concat
(lambda xs (lambda xs
(apply bytes-append (apply bytes-append
@ -24,14 +24,15 @@ exec racket -um "$0" "$@"
"(?:\\\\0)?\""))]) "(?:\\\\0)?\""))])
`([#t ; only verify that it has the right contents `([#t ; only verify that it has the right contents
"src/racket/src/schvers.h" "src/racket/src/schvers.h"
,(concat "\n#define MZSCHEME_VERSION \"<1>.<2>.<3>" ,(concat "\n#define MZSCHEME_VERSION \"<1>.<2>"
(if 3parts? "" ".<4>") "\"\n") (if (parts# . >= . 3) ".<3>" "")
,@(map (lambda (x+n) (if (parts# . >= . 4) ".<4>" "")
(format "\n#define MZSCHEME_VERSION_~a ~a\n" "\"\n")
(car x+n) ,@(for/list ([x+n (in-list '([X 1] [Y 2] [Z 3] [W 4]))])
(if (and 3parts? (eq? 4 (cadr x+n))) (format "\n#define MZSCHEME_VERSION_~a ~a\n"
"0" (format "<~a>" (cadr x+n))))) (car x+n)
'([X 1] [Y 2] [Z 3] [W 4]))] (if ((cadr x+n) . > . parts#)
"0" (format "<~a>" (cadr x+n)))))]
["src/worksp/racket/racket.rc" ,@rc-patch] ["src/worksp/racket/racket.rc" ,@rc-patch]
["src/worksp/gracket/gracket.rc" ,@rc-patch] ["src/worksp/gracket/gracket.rc" ,@rc-patch]
["src/worksp/starters/start.rc" ,@rc-patch] ["src/worksp/starters/start.rc" ,@rc-patch]