build-system/gnu: Add 'validate-documentation-location' phase.

* guix/build/gnu-build-system.scm (validate-documentation-location): New
  procedure.
  (%standard-phases): Add it.
This commit is contained in:
Ludovic Courtès 2014-12-01 14:09:36 +01:00
parent e9bab1df6d
commit d68fe74162
1 changed files with 23 additions and 1 deletions

View File

@ -372,6 +372,27 @@ makefiles."
strip-directories))) strip-directories)))
outputs)))) outputs))))
(define* (validate-documentation-location #:key outputs
#:allow-other-keys)
"Documentation should go to 'share/info' and 'share/man', not just 'info/'
and 'man/'. This phase moves directories to the right place if needed."
(define (validate-sub-directory output sub-directory)
(let ((directory (string-append output "/" sub-directory)))
(when (directory-exists? directory)
(let ((target (string-append output "/share/" sub-directory)))
(format #t "moving '~a' to '~a'~%" directory target)
(mkdir-p (dirname target))
(rename-file directory target)))))
(define (validate-output output)
(for-each (cut validate-sub-directory output <>)
'("man" "info")))
(match outputs
(((names . directories) ...)
(for-each validate-output directories)))
#t)
(define %standard-phases (define %standard-phases
;; Standard build phases, as a list of symbol/procedure pairs. ;; Standard build phases, as a list of symbol/procedure pairs.
(let-syntax ((phases (syntax-rules () (let-syntax ((phases (syntax-rules ()
@ -380,7 +401,8 @@ makefiles."
patch-usr-bin-file patch-usr-bin-file
patch-source-shebangs configure patch-generated-file-shebangs patch-source-shebangs configure patch-generated-file-shebangs
build check install build check install
patch-shebangs strip))) patch-shebangs strip
validate-documentation-location)))
(define* (gnu-build #:key (source #f) (outputs #f) (inputs #f) (define* (gnu-build #:key (source #f) (outputs #f) (inputs #f)