about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-12-31 12:54:53 +0530
committerArun Isaac2021-12-31 12:54:53 +0530
commit24ffb3930ed0e75ee0f72d55a7e53253f3a58e8e (patch)
tree4ca7611fa45655963f79eafa68c419c844ca7522
parent0eae38289f47dd2fe777e9688d5f770cefc7f404 (diff)
downloadnsmc-24ffb3930ed0e75ee0f72d55a7e53253f3a58e8e.tar.gz
nsmc-24ffb3930ed0e75ee0f72d55a7e53253f3a58e8e.tar.lz
nsmc-24ffb3930ed0e75ee0f72d55a7e53253f3a58e8e.zip
Use git-predicate in guix.scm.
* guix.scm: Do not import (ice-9 match), (ice-9 popen), (ice-9
rdelim), (srfi srfi-1), (srfi srfi-26) and (guix build utils).
(git-file?): Delete function.
(nsmc): Use git-predicate instead of git-file?
-rw-r--r--guix.scm27
1 files changed, 2 insertions, 25 deletions
diff --git a/guix.scm b/guix.scm
index f077e26..9869e71 100644
--- a/guix.scm
+++ b/guix.scm
@@ -3,13 +3,7 @@
 ;;;
 ;;;  $ guix environment -l guix.scm
 
-(use-modules (ice-9 match)
-             (ice-9 popen)
-             (ice-9 rdelim)
-             (srfi srfi-1)
-             (srfi srfi-26)
-             (guix build utils)
-             (guix build-system cmake)
+(use-modules (guix build-system cmake)
              (guix build-system guile)
              (guix gexp)
              (guix git-download)
@@ -25,23 +19,6 @@
 
 (define %source-dir (dirname (current-filename)))
 
-(define git-file?
-  (let* ((pipe (with-directory-excursion %source-dir
-                 (open-pipe* OPEN_READ "git" "ls-files")))
-         (files (let loop ((lines '()))
-                  (match (read-line pipe)
-                    ((? eof-object?)
-                     (reverse lines))
-                    (line
-                     (loop (cons line lines))))))
-         (status (close-pipe pipe)))
-    (lambda (file stat)
-      (match (stat:type stat)
-        ('directory #t)
-        ((or 'regular 'symlink)
-         (any (cut string-suffix? <> file) files))
-        (_ #f)))))
-
 ;; TODO: Contribute upstream to Guix and delete.
 (define sph-lib
   (package
@@ -135,7 +112,7 @@
   (home-page "https://git.systemreboot.net/nsmc")
   (source (local-file %source-dir
                       #:recursive? #t
-                      #:select? git-file?))
+                      #:select? (git-predicate %source-dir)))
   (build-system cmake-build-system)
   (arguments
    '(#:tests? #f ; no tests