[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/07: build-system/gnu: Make 'first-subdirectory' deterministic.
From: |
guix-commits |
Subject: |
07/07: build-system/gnu: Make 'first-subdirectory' deterministic. |
Date: |
Fri, 14 Jun 2019 17:35:37 -0400 (EDT) |
civodul pushed a commit to branch core-updates
in repository guix.
commit cfd4e4d06e3cda0f3eed8d6b9277ce53e55404b8
Author: Ludovic Courtès <address@hidden>
Date: Fri Jun 14 23:02:28 2019 +0200
build-system/gnu: Make 'first-subdirectory' deterministic.
Fixes <https://bugs.gnu.org/35387>.
Reported by Christopher Baines <address@hidden>.
* guix/build/gnu-build-system.scm (first-subdirectory): Rewrite using
'scandir' so that the result is deterministic.
---
guix/build/gnu-build-system.scm | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index afa1886..4df0bb4 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -25,6 +25,7 @@
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 format)
+ #:use-module (ice-9 ftw)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-34)
@@ -58,19 +59,14 @@ See
https://reproducible-builds.org/specs/source-date-epoch/."
(setenv "SOURCE_DATE_EPOCH" "1")
#t)
-(define (first-subdirectory dir)
- "Return the path of the first sub-directory of DIR."
- (file-system-fold (lambda (path stat result)
- (string=? path dir))
- (lambda (path stat result) result) ; leaf
- (lambda (path stat result) result) ; down
- (lambda (path stat result) result) ; up
- (lambda (path stat result) ; skip
- (or result path))
- (lambda (path stat errno result) ; error
- (error "first-subdirectory" (strerror errno)))
- #f
- dir))
+(define (first-subdirectory directory)
+ "Return the file name of the first sub-directory of DIRECTORY."
+ (match (scandir directory
+ (lambda (file)
+ (and (not (member file '("." "..")))
+ (file-is-directory? (string-append directory "/"
+ file)))))
+ ((first . _) first)))
(define* (set-paths #:key target inputs native-inputs
(search-paths '()) (native-search-paths '())
- branch core-updates updated (44f07d1 -> cfd4e4d), guix-commits, 2019/06/14
- 03/07: tests: Remove expensive and pointless test., guix-commits, 2019/06/14
- 01/07: download: Add 'url-fetch/executable'., guix-commits, 2019/06/14
- 07/07: build-system/gnu: Make 'first-subdirectory' deterministic.,
guix-commits <=
- 04/07: tests: Make builds less expensive., guix-commits, 2019/06/14
- 02/07: gnu: bootstrap: Download the bootstrap bash, mkdir, tar, and xz binaries., guix-commits, 2019/06/14
- 05/07: packages: Remove 'search-bootstrap-binary'., guix-commits, 2019/06/14
- 06/07: build: Remove 'gnu/packages/bootstrap' and its binaries., guix-commits, 2019/06/14