trying version-file relative to the library file first

This commit is contained in:
Alex Shinn 2015-05-10 22:19:41 +09:00
parent 8cd5fd2848
commit 9f00ad0695

View file

@ -397,16 +397,23 @@
(define (package-license cfg) (define (package-license cfg)
(conf-get cfg '(command package license))) (conf-get cfg '(command package license)))
(define (package-output-version cfg) (define (read-version-file cfg file lib-files)
(let ((file (or (find file-exists?
(map (lambda (f) (make-path (path-directory f) file))
lib-files))
file)))
(call-with-input-file file read-line)))
(define (package-output-version cfg lib-files)
(cond ((conf-get cfg '(command package version))) (cond ((conf-get cfg '(command package version)))
((conf-get cfg '(command upload version))) ((conf-get cfg '(command upload version)))
((conf-get cfg '(command package version-file)) ((conf-get cfg '(command package version-file))
=> (lambda (file) (call-with-input-file file read-line))) => (lambda (file) (read-version-file cfg file lib-files)))
((conf-get cfg '(command upload version-file)) ((conf-get cfg '(command upload version-file))
=> (lambda (file) (call-with-input-file file read-line))) => (lambda (file) (read-version-file cfg file lib-files)))
(else #f))) (else #f)))
(define (package-output-path cfg package-spec) (define (package-output-path cfg package-spec libs)
(or (conf-get cfg '(command package output)) (or (conf-get cfg '(command package output))
(make-path (make-path
(conf-get cfg '(command package output-dir) ".") (conf-get cfg '(command package output-dir) ".")
@ -415,7 +422,7 @@
package-spec package-spec
(filter (lambda (x) (and (pair? x) (memq (car x) '(library program)))) (filter (lambda (x) (and (pair? x) (memq (car x) '(library program))))
package-spec) package-spec)
(package-output-version cfg))))) (package-output-version cfg libs)))))
(define (replace-library-pattern pat base-lib) (define (replace-library-pattern pat base-lib)
(case (and (pair? pat) (car pat)) (case (and (pair? pat) (car pat))
@ -482,7 +489,7 @@
(name (conf-get cfg '(command package name))) (name (conf-get cfg '(command package name)))
(authors (conf-get-list cfg '(command package authors))) (authors (conf-get-list cfg '(command package authors)))
(test (package-test cfg)) (test (package-test cfg))
(version (package-output-version cfg)) (version (package-output-version cfg libs))
(maintainers (conf-get-list cfg '(command package maintainers))) (maintainers (conf-get-list cfg '(command package maintainers)))
(license (package-license cfg))) (license (package-license cfg)))
(let lp ((ls (map (lambda (x) (list x #f)) libs)) (let lp ((ls (map (lambda (x) (list x #f)) libs))
@ -616,7 +623,7 @@
(define (command/package cfg spec . libs) (define (command/package cfg spec . libs)
(let* ((spec+files (package-spec+files cfg spec libs)) (let* ((spec+files (package-spec+files cfg spec libs))
(output (package-output-path cfg (car spec+files))) (output (package-output-path cfg (car spec+files) libs))
(tarball (create-package (car spec+files) (cdr spec+files) output))) (tarball (create-package (car spec+files) (cdr spec+files) output)))
(check-overwrite cfg output package-file? "package") (check-overwrite cfg output package-file? "package")
(let ((out (open-binary-output-file output))) (let ((out (open-binary-output-file output)))
@ -912,7 +919,7 @@
(if (any package-file? (cdr o)) (if (any package-file? (cdr o))
(non-homogeneous)) (non-homogeneous))
(let* ((spec+files (package-spec+files cfg spec o)) (let* ((spec+files (package-spec+files cfg spec o))
(package-file (package-output-path cfg (car spec+files))) (package-file (package-output-path cfg (car spec+files) o))
(package (create-package (car spec+files) (package (create-package (car spec+files)
(cdr spec+files) (cdr spec+files)
package-file))) package-file)))