build: minify-build-system: Fail to install empty files.

* guix/build/minify-build-system.scm (install): Produce an error if the
minified file is zero bytes.
This commit is contained in:
Efraim Flashner 2020-05-06 11:27:48 +03:00
parent 843e772051
commit 5b77e9ca14
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -54,8 +55,12 @@
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(js (string-append out "/share/javascript/"))) (js (string-append out "/share/javascript/")))
(mkdir-p js) (mkdir-p js)
(for-each (cut install-file <> js) (for-each
(find-files "guix/build" "\\.min\\.js$"))) (lambda (file)
(if (not (zero? (stat:size (stat file))))
(install-file file js)
(error "File is empty: " file)))
(find-files "guix/build" "\\.min\\.js$")))
#t) #t)
(define %standard-phases (define %standard-phases