summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-11-28 05:02:05 +0100
committerMarius Bakke <marius@gnu.org>2022-12-02 00:21:25 +0100
commit84c577d7a7046c2d675d674c301ae1f4684a80bd (patch)
treeac9120cea11d3eb35e41498d65ba48c2100a84e2 /gnu/packages
parent9252f147223969a524e7a07f8da4524b2e10d7e5 (diff)
downloadguix-84c577d7a7046c2d675d674c301ae1f4684a80bd.tar.gz
gnu: QtWebEngine: Simplify code to remove third-party files.
* gnu/packages/qt.scm (remove-third-party-files): Simplify some procedures.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/qt.scm20
1 files changed, 7 insertions, 13 deletions
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 31acacff80..0f5e1c3530 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -2284,8 +2284,7 @@ using the Enchant spell-checking library.")
   #~(begin
       (define preserved-club
         ;; Prefix exceptions with ./ for comparison with ftw.
-        (map (lambda (member)
-               (string-append "./" member))
+        (map (cut string-append "./" <>)
              preserved-third-party-files))
       (define protected (make-regexp "\\.(gn|gyp)i?$"))
       (define (empty? dir)
@@ -2298,17 +2297,12 @@ using the Enchant spell-checking library.")
       (define (parents child)
         ;; Return all parent directories of CHILD up to and including
         ;; the closest "third_party".
-        (let* ((dirs (match (string-split child #\/)
-                       ((dirs ... last) dirs)))
-               (closest (list-index (lambda (dir)
-                                      (string=? "third_party" dir))
-                                    (reverse dirs)))
-               (delim (- (length dirs) closest)))
-          (fold (lambda (dir prev)
-                  (cons (string-append (car prev) "/" dir)
-                        prev))
-                (list (string-join (list-head dirs delim) "/"))
-                (list-tail dirs delim))))
+        (let loop ((parent (dirname child))
+                   (parents '()))
+          (if (string=? "third_party" (basename parent))
+              (cons parent parents)
+              (loop (dirname parent)
+                    (cons parent parents)))))
       (define (remove-loudly file)
         (format #t "deleting ~a...~%" file)
         (force-output)