From unknown Mon Aug 18 11:07:24 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30708 <30708@debbugs.gnu.org> To: bug#30708 <30708@debbugs.gnu.org> Subject: Status: [PATCH] utils: Add helper method to list subdirectories. Reply-To: bug#30708 <30708@debbugs.gnu.org> Date: Mon, 18 Aug 2025 18:07:24 +0000 retitle 30708 [PATCH] utils: Add helper method to list subdirectories. reassign 30708 guix-patches submitter 30708 Maxim Cournoyer severity 30708 normal tag 30708 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 04 23:15:23 2018 Received: (at submit) by debbugs.gnu.org; 5 Mar 2018 04:15:23 +0000 Received: from localhost ([127.0.0.1]:44968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eshWx-0000XY-Fu for submit@debbugs.gnu.org; Sun, 04 Mar 2018 23:15:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eshWv-0000XK-P5 for submit@debbugs.gnu.org; Sun, 04 Mar 2018 23:15:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eshWp-000832-C5 for submit@debbugs.gnu.org; Sun, 04 Mar 2018 23:15:12 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eshWp-00082o-70 for submit@debbugs.gnu.org; Sun, 04 Mar 2018 23:15:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eshWn-0002Pv-LQ for guix-patches@gnu.org; Sun, 04 Mar 2018 23:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eshWk-00080b-EX for guix-patches@gnu.org; Sun, 04 Mar 2018 23:15:09 -0500 Received: from mail-it0-x233.google.com ([2607:f8b0:4001:c0b::233]:52563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eshWk-00080R-7K for guix-patches@gnu.org; Sun, 04 Mar 2018 23:15:06 -0500 Received: by mail-it0-x233.google.com with SMTP id k135so7840773ite.2 for ; Sun, 04 Mar 2018 20:15:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=9WngT4a5/snq04MM3O+eCzZ5JA1rbsswK8QbvoMxK6k=; b=PzeZw2WM+pKZ1P0UGTCSUQX8/UHHReTr9NEdcAa1ZJRLbsTFpm+oHM3s8pIKLcr7Js uNlXguSj/E0eE002IcLeUfea23vrEosCe8nFiVEdMTOayao8rQ1z+duhejRSZw4ErLgj ZaFXo1jCWiPbBNXTG9cE/UBKe+cEtazt8FEecpCDecrq/O/00j+6/j8lKz/mq0aeu2Sb pt0Ge136naRv7T0BZvPmY+fLJJ8hixv2Nnu0PjH+6m9eP81rUU7qWngN67BeO/MqsAZH 3uxAne1INoAa6icblRELU0K1zYtxMELRS3KE+NIlq9t0YGMwHttWmLFRfSSZV/b+6lks B7Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=9WngT4a5/snq04MM3O+eCzZ5JA1rbsswK8QbvoMxK6k=; b=AU6vgxBWx5EI7FoVGnS7htqLQPptfzSkqBqdNs7NXKomCl2mMqSZZc0yqSblhBZTYL ZN/Fr6dFegOSEQR5mY4lL/s+0tUceFyU4swHKkD9jTMqLEM7nxjBPy+pCelG6afRxN2u NpJn3ze0FvqSzHdVb/JiNtzbusONYFx8MjM/aivGrSjDOJ/10Qy9lCoXJF5VfVk6S4lG cNi92VNjrb184e43RSoaJf0rpnVWCR95IfccA+9Asa+BWzJuZ5I+r4/TJLH2L0wko0b5 qsy7gjA9+YYidIbF9ReRtuIao4Dzk7+4aDBZz5cZr2WfQt4+3i6597NC1+1U0MGKQsyB D2tA== X-Gm-Message-State: AElRT7HrCPgwY/+b71OprJOm+vJNs6gF/KSaJsBlJSgt8oglkJ1S8KdC H3H4BUe4ACEAywziU5ERe6Y9Dg== X-Google-Smtp-Source: AG47ELs+lbsQnaCdAM+hqrYCS/hge02S8J74W6hLaD1tMkQwCrbG317RHtxwsQveSPpLDNeMmNZLtg== X-Received: by 10.36.36.144 with SMTP id f138mr11579986ita.131.1520223305297; Sun, 04 Mar 2018 20:15:05 -0800 (PST) Received: from apteryx ([45.72.232.234]) by smtp.gmail.com with ESMTPSA id y4sm7204392ioi.45.2018.03.04.20.15.04 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Mar 2018 20:15:04 -0800 (PST) From: Maxim Cournoyer To: guix-patches Subject: [PATCH] utils: Add helper method to list subdirectories. Date: Sun, 04 Mar 2018 23:15:03 -0500 Message-ID: <87a7vnma48.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain Hello Guix! This adds a method useful to list subdirectories, which I am using to list bundled copies of libraries (and delete them), for example. Thank you, Maxim --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-utils-Add-helper-method-to-list-subdirectories.patch Content-Transfer-Encoding: quoted-printable >From b4b607800d770c4cf77f92c247276c368357e94f Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 25 Feb 2018 17:49:06 -0500 Subject: [PATCH] utils: Add helper method to list subdirectories. * guix/build/utils.scm (find-subdirectories): New procedure. * tests/build-utils.scm: Rename module so that it can be used with Geiser. (%test-dir-hierarchy): New variable. (make-test-dir-hierarchy): New test procedure. ("find-subdirectories"): New test. --- guix/build/utils.scm | 16 ++++++++++++++++ tests/build-utils.scm | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 7391307c8..9a321bf3e 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2013 Andreas Enge ;;; Copyright =C2=A9 2013 Nikita Karetnikov ;;; Copyright =C2=A9 2015 Mark H Weaver +;;; Copyright =C2=A9 2018 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -60,6 +61,7 @@ delete-file-recursively file-name-predicate find-files + find-subdirectories =20 search-path-as-list set-path-environment-variable @@ -395,6 +397,20 @@ also be included. If FAIL-ON-ERROR? is true, raise an= exception upon error." stat) string 1 (string-length dir)) + (eq? (string-take-right dir 1) #\/)) + (string-drop-right dir 1) + dir))) + (define (pred filename stat) + (and (eq? (stat:type stat) 'directory) + (string-match (string-append dir "/[^/]*$") filename))) + (find-files dir pred + #:directories? #t + #:fail-on-error? fail-on-error?))) + ;;; ;;; Search paths. diff --git a/tests/build-utils.scm b/tests/build-utils.scm index 7d49446f6..6a3d43784 100644 --- a/tests/build-utils.scm +++ b/tests/build-utils.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2012, 2015, 2016 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2018 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,7 +18,7 @@ ;;; along with GNU Guix. If not, see . =20 =20 -(define-module (test-build-utils) +(define-module (tests build-utils) #:use-module (guix tests) #:use-module (guix build utils) #:use-module ((guix utils) @@ -27,7 +28,8 @@ #:use-module (srfi srfi-34) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) - #:use-module (ice-9 popen)) + #:use-module (ice-9 popen) + #:use-module (ice-9 match)) =20 (test-begin "build-utils") @@ -122,4 +124,35 @@ (and (zero? (close-pipe pipe)) str)))))) =20 +(define %test-dir-hierarchy + ;; The first element of a list is a file if the only element, otherwise + ;; a directory. + '("top" + ("subdir1" + ("subsubdir1" + "a-file.txt" + "another-file.c")) + ("subdir2" + "yet-another-one.h") + ("file.txt"))) + +(define* (make-test-dir-hierarchy hierarchy #:optional (top (getcwd))) + (mkdir-p top) + (match hierarchy + ((dir . rest) + (for-each + (lambda (item) + (make-test-dir-hierarchy item (string-append top "/" dir))) + rest)) + (file + (system (string-append "echo \"\" > " "\"" top "/" file "\""))))) + +(test-equal "find-subdirectories" + '("top/subdir1" "top/subdir2") + (call-with-temporary-directory + (lambda (directory) + (make-test-dir-hierarchy %test-dir-hierarchy directory) + (chdir directory) + (find-subdirectories "top")))) + (test-end) --=20 2.16.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 05 12:12:43 2018 Received: (at 30708) by debbugs.gnu.org; 5 Mar 2018 17:12:43 +0000 Received: from localhost ([127.0.0.1]:46145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1estfH-0004RK-8T for submit@debbugs.gnu.org; Mon, 05 Mar 2018 12:12:43 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:39616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1estfG-0004RD-F4 for 30708@debbugs.gnu.org; Mon, 05 Mar 2018 12:12:42 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0670C12059; Mon, 5 Mar 2018 18:12:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nj_B-Hgwubp8; Mon, 5 Mar 2018 18:12:41 +0100 (CET) Received: from ribbon (unknown [193.50.110.134]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 43E0B10D8B; Mon, 5 Mar 2018 18:12:41 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Maxim Cournoyer Subject: Re: [bug#30708] [PATCH] utils: Add helper method to list subdirectories. References: <87a7vnma48.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 =?utf-8?Q?Vent=C3=B4se?= an 226 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 05 Mar 2018 18:12:40 +0100 In-Reply-To: <87a7vnma48.fsf@gmail.com> (Maxim Cournoyer's message of "Sun, 04 Mar 2018 23:15:03 -0500") Message-ID: <87lgf68n07.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30708 Cc: 30708@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi Maxim, Maxim Cournoyer skribis: > From b4b607800d770c4cf77f92c247276c368357e94f Mon Sep 17 00:00:00 2001 > From: Maxim Cournoyer > Date: Sun, 25 Feb 2018 17:49:06 -0500 > Subject: [PATCH] utils: Add helper method to list subdirectories. > > * guix/build/utils.scm (find-subdirectories): New procedure. > * tests/build-utils.scm: Rename module so that it can be used with Geiser. > (%test-dir-hierarchy): New variable. > (make-test-dir-hierarchy): New test procedure. > ("find-subdirectories"): New test. [...] > +(define* (find-subdirectories dir #:key fail-on-error?) > + "Return the list of the immediate subdirectories of DIR." > + ;; Strip the trailing '/' DIR is '/'. > + (let ((dir (if (and (> 1 (string-length dir)) > + (eq? (string-take-right dir 1) #\/)) > + (string-drop-right dir 1) > + dir))) > + (define (pred filename stat) > + (and (eq? (stat:type stat) 'directory) > + (string-match (string-append dir "/[^/]*$") filename))) > + (find-files dir pred > + #:directories? #t > + #:fail-on-error? fail-on-error?))) =E2=80=98find-files=E2=80=99 recurses in subdirectories, so the above imple= mentation is not as efficient as it could be. I would instead suggest using =E2=80=98scandir=E2=80=99 (or =E2=80=98file-s= ystem-fold=E2=80=99) from Guile=E2=80=99s (ice-9 ftw) module. That said=E2=80=A6 is this a common enough operation? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 05 21:18:23 2018 Received: (at 30708) by debbugs.gnu.org; 6 Mar 2018 02:18:23 +0000 Received: from localhost ([127.0.0.1]:46533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1et2BK-0005n5-Ey for submit@debbugs.gnu.org; Mon, 05 Mar 2018 21:18:22 -0500 Received: from mail-io0-f179.google.com ([209.85.223.179]:41690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1et2BI-0005mr-9S for 30708@debbugs.gnu.org; Mon, 05 Mar 2018 21:18:20 -0500 Received: by mail-io0-f179.google.com with SMTP id q24so20269620ioh.8 for <30708@debbugs.gnu.org>; Mon, 05 Mar 2018 18:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=LkJ1T6ZnrOL6gJvBg4cpSk+rznh/l9BKRe9OUn4YRyk=; b=eTy+ru8AIomXem6C5VUNyi4F2m88L4uxsJBxIlLXEc4Up4lsRcG32OgsZhSFAHPsRr O4TiUEMS8Y2HghdSj3mvatRmpHGic35Fge4WqXjonxs+cTiiCmEymC2KUAmqS6R0QXsT CqaQiMYW6Erc3s1KQKZwHYBdCTAGUxVWQj0Pu8LeLnwvkjqhKrCcwEd/b5A0DFMu3gGn V5kKI3RYSMR5XwIhr8U6h2lCshaotROJnEWM2qdQpsJ24P6oW6+RC6+ptNEeFu5oVZD+ nInrAMYsNPYTQFOEbemU3O7cmYE9tanXc925lGHPaHYTpkHDdeTVrW46azz+nyLqoTw7 tDqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=LkJ1T6ZnrOL6gJvBg4cpSk+rznh/l9BKRe9OUn4YRyk=; b=WuWsQXtuMZahLvjf9UMjyUzlpmZGdcu+cwTsmCDFtP9oEO2/PY9lIJ441B2Vw/vsXo 3pRFsoPuWaH3kuCX59f/i3GA5kQCB0ORwnXzqBzASTJ0jDioGRvOt+X+PTvcveoAuUQg BtrNHURo476mPGDyo1cjrnE00LYkSYOBZHwl8WJ2zHSvGMKKdsm1XNPgQJewBDVD3mS+ Lf9Yd6lQrFPnEDfapWjj8w2Iqrlz49Q1lhz9TwmqS+E4lliOCQJh2ldeGKDEifQpoPh2 P1wgRSq+ciPy/1L+xELvMUhlWlpZoUV/KnUaACvx+CQWswHF+h6dK3aJCMjWJckIiUSw 7GkQ== X-Gm-Message-State: AElRT7GxOMqj/tmdtMG+xCNxbGh1fvK1ObhvtC9zjalPlPZkxiLb8L4a +bhCCkLDUP4lfc1mCN+0vLQAyA== X-Google-Smtp-Source: AG47ELtWuXcnuljyi0NBaaC8AdHmhSHmH0Le2znGeph5BuGKG6S9Xo7wgavr3/7vxTbBlBEaCw2tow== X-Received: by 10.107.147.2 with SMTP id v2mr12185393iod.198.1520302694322; Mon, 05 Mar 2018 18:18:14 -0800 (PST) Received: from apteryx ([45.72.232.234]) by smtp.gmail.com with ESMTPSA id k6sm8680080ioc.75.2018.03.05.18.18.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Mar 2018 18:18:13 -0800 (PST) From: Maxim Cournoyer To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [bug#30708] [PATCH] utils: Add helper method to list subdirectories. References: <87a7vnma48.fsf@gmail.com> <87lgf68n07.fsf@gnu.org> Date: Mon, 05 Mar 2018 21:18:12 -0500 In-Reply-To: <87lgf68n07.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 05 Mar 2018 18:12:40 +0100") Message-ID: <87y3j6kkuz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30708 Cc: 30708@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi Ludovic, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Hi Maxim, > > Maxim Cournoyer skribis: > >> From b4b607800d770c4cf77f92c247276c368357e94f Mon Sep 17 00:00:00 2001 >> From: Maxim Cournoyer >> Date: Sun, 25 Feb 2018 17:49:06 -0500 >> Subject: [PATCH] utils: Add helper method to list subdirectories. >> >> * guix/build/utils.scm (find-subdirectories): New procedure. >> * tests/build-utils.scm: Rename module so that it can be used with Geise= r. >> (%test-dir-hierarchy): New variable. >> (make-test-dir-hierarchy): New test procedure. >> ("find-subdirectories"): New test. > > [...] > >> +(define* (find-subdirectories dir #:key fail-on-error?) >> + "Return the list of the immediate subdirectories of DIR." >> + ;; Strip the trailing '/' DIR is '/'. >> + (let ((dir (if (and (> 1 (string-length dir)) >> + (eq? (string-take-right dir 1) #\/)) >> + (string-drop-right dir 1) >> + dir))) >> + (define (pred filename stat) >> + (and (eq? (stat:type stat) 'directory) >> + (string-match (string-append dir "/[^/]*$") filename))) >> + (find-files dir pred >> + #:directories? #t >> + #:fail-on-error? fail-on-error?))) > > =E2=80=98find-files=E2=80=99 recurses in subdirectories, so the above imp= lementation is > not as efficient as it could be. > > I would instead suggest using =E2=80=98scandir=E2=80=99 (or =E2=80=98file= -system-fold=E2=80=99) from > Guile=E2=80=99s (ice-9 ftw) module. Thanks! See the new patched attached. The test still passes. > That said=E2=80=A6 is this a common enough operation? I'm using it in a forthcoming new Guix package (SuperCollider) where it allows me to explicitly list the bundled dependencies that are to be *kept* rather than the ones to be removed, as is more commonly done. Withou= t a list of the subdirectories the contrib/vendor/whatever bundled libraries directory I would not be able to do the following: --8<---------------cut here---------------start------------->8--- + ;; The build system doesn't allow us to unbundle the + ;; following libraries. + (let* ((all-dirs (find-subdirectories "./external_libraries")) + (keep-dirs '("nova-simd" "nova-tt" "hidapi" "TLSF-2.4.= 6" + "oscpack_1_1_0")) + (remove-dirs + (remove (lambda (x) + (member (basename x) keep-dirs)) + all-dirs))) + (format #t "Removing bundled libraries: ~s\n" remove-dirs) + (for-each delete-file-recursively remove-dirs))))))) --8<---------------cut here---------------end--------------->8--- Although now that you've made me see the light (scandir), I could rewrite the whole thing using: --8<---------------cut here---------------start------------->8--- (lambda _ ;; The build system doesn't allow us to unbundle the following ;; libraries. (let ((keep-dirs '("nova-simd" "nova-tt" "hidapi" "TLSF-2.4.6" "oscpack_1_1_0" "." ".."))) (with-directory-excursion "./external_libraries" (for-each delete-file-recursively (scandir "." (lambda (x) (and (eq? (stat:type (stat x)) 'directory) (not (member (basename x) keep-dirs))))))= )) --8<---------------cut here---------------end--------------->8--- So, this patch can go to the recycle bin. Thanks! :) Maxim From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 06 05:33:47 2018 Received: (at 30708-done) by debbugs.gnu.org; 6 Mar 2018 10:33:47 +0000 Received: from localhost ([127.0.0.1]:46861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1et9ul-0000i2-9e for submit@debbugs.gnu.org; Tue, 06 Mar 2018 05:33:47 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:37068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1et9uk-0000hu-1D for 30708-done@debbugs.gnu.org; Tue, 06 Mar 2018 05:33:46 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8B82011A95; Tue, 6 Mar 2018 11:33:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XMQ-xhEOlwX8; Tue, 6 Mar 2018 11:33:44 +0100 (CET) Received: from ribbon (vpn-0-27.aquilenet.fr [IPv6:2a0c:e300:4:27::]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B8BF910437; Tue, 6 Mar 2018 11:33:44 +0100 (CET) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Maxim Cournoyer Subject: Re: [bug#30708] [PATCH] utils: Add helper method to list subdirectories. References: <87a7vnma48.fsf@gmail.com> <87lgf68n07.fsf@gnu.org> <87y3j6kkuz.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 16 =?utf-8?Q?Vent=C3=B4se?= an 226 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 06 Mar 2018 11:33:44 +0100 In-Reply-To: <87y3j6kkuz.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 05 Mar 2018 21:18:12 -0500") Message-ID: <87lgf5xzlj.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 30708-done Cc: 30708-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) Hi Maxim, Maxim Cournoyer skribis: > Although now that you've made me see the light (scandir), I could > rewrite the whole thing using: > > (lambda _ > ;; The build system doesn't allow us to unbundle the followi= ng > ;; libraries. > (let ((keep-dirs '("nova-simd" "nova-tt" "hidapi" "TLSF-2.4.= 6" > "oscpack_1_1_0" "." ".."))) > (with-directory-excursion "./external_libraries" > (for-each > delete-file-recursively > (scandir "." > (lambda (x) > (and (eq? (stat:type (stat x)) 'directory) > (not (member (basename x) keep-dirs))))= )))) > > So, this patch can go to the recycle bin. Thanks! :) Well, I=E2=80=99m glad that it works for you. :-) Thanks, Ludo=E2=80=99. From unknown Mon Aug 18 11:07:24 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 03 Apr 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator