X-Loop: help-debbugs@HIDDEN Subject: [bug#76492] [PATCH] build/utils: Add delete-all-but Resent-From: Andrew Wong <wongandj@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: andreas@HIDDEN, janneke@HIDDEN, ludo@HIDDEN, z572@HIDDEN, guix-patches@HIDDEN Resent-Date: Sun, 23 Feb 2025 01:24:02 +0000 Resent-Message-ID: <handler.76492.B.174027381531132 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76492 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 76492 <at> debbugs.gnu.org Cc: Andrew Wong <wongandj@HIDDEN>, Andreas Enge <andreas@HIDDEN>, Janneke Nieuwenhuizen <janneke@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Zheng Junjie <z572@HIDDEN> X-Debbugs-Original-To: guix-patches@HIDDEN X-Debbugs-Original-Xcc: Andreas Enge <andreas@HIDDEN>, Janneke Nieuwenhuizen <janneke@HIDDEN>, Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Zheng Junjie <z572@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.174027381531132 (code B ref -1); Sun, 23 Feb 2025 01:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2025 01:23:35 +0000 Received: from localhost ([127.0.0.1]:58151 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tm0iU-000864-Ra for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 20:23:35 -0500 Received: from lists.gnu.org ([2001:470:142::17]:39304) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <wongandj@HIDDEN>) id 1tm0iR-00085p-Of for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 20:23:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <wongandj@HIDDEN>) id 1tm0iM-000876-9b for guix-patches@HIDDEN; Sat, 22 Feb 2025 20:23:26 -0500 Received: from qs51p00im-qukt01080301.me.com ([17.57.155.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <wongandj@HIDDEN>) id 1tm0iK-0000ad-9Q for guix-patches@HIDDEN; Sat, 22 Feb 2025 20:23:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=poAOmTqI56tzS8O0yn364Gvtq1XSZbraNKAohoqtspE=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=A1dkf8cQifqW/JXAhI/uB+x0c3r3+F22is0gyMW0TQRh01WrezhiSxrPLq6SXs8wF 50SbtLPKRlUimt8gmmuEjOKOuwSlsj+N5iQnOeVaArVze9SxzZBTv6Mi7cQHa2O8MJ E/c+trgPBhFN0wpIzjJthNaQpK6Mbp/9W6xTYxJE38XV9VZXlupgXtG+d+wH/IASH4 8EyXJJhSNDjSQmao0TIjB+D9uNUg/SwQL9HArtDg8JyMP7rjcr73kzk7Y5Dwo9J13W 4usTGS0YpBw1buU4jsRsASVbIMp3F//fv6aW72BcV8pM1OrTuYtfHnZKRazdufyEjM 3RpavqJtP3hRQ== Received: from wongworks.lan (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01080301.me.com (Postfix) with ESMTPSA id D86925F00173; Sun, 23 Feb 2025 01:23:18 +0000 (UTC) From: Andrew Wong <wongandj@HIDDEN> Date: Sat, 22 Feb 2025 20:18:58 -0500 Message-ID: <0b8d4eb4212609048cf81f2e3e6e3da83c1caf46.1740273538.git.wongandj@HIDDEN> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: hoxzyO-ZrR8HdaAzRcC-78DA2kzndnw4 X-Proofpoint-ORIG-GUID: hoxzyO-ZrR8HdaAzRcC-78DA2kzndnw4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-22_11,2025-02-20_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 clxscore=1015 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=671 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2502230008 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 Received-SPF: pass client-ip=17.57.155.20; envelope-from=wongandj@HIDDEN; helo=qs51p00im-qukt01080301.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) * guix/build/utils.scm (delete-all-but): New procedure. Change-Id: I82db4b63c45d88ef0529adb760182495c28dae9e --- delete-all-but is defined and used within package definitions a total of 11 times according to a simple grep; it makes sense to move it to a common location. However, changing (guix build utils) is a heavy change, so perhaps there is a better branch to merge this to than master. guix/build/utils.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 94714bf397..b74c1ad7d8 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@HIDDEN> ;;; Copyright © 2021 Brendan Tildesley <mail@HIDDEN> ;;; Copyright © 2023 Carlo Zancanaro <carlo@HIDDEN> +;;; Copyright © 2025 Andrew Wong <wongandj@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -77,6 +78,7 @@ (define-module (guix build utils) make-file-writable copy-recursively delete-file-recursively + delete-all-but file-name-predicate find-files false-if-file-not-found @@ -522,6 +524,29 @@ (define* (delete-file-recursively dir ;; Don't follow symlinks. lstat))) +(define (delete-all-but paths-kept) + "Delete all paths in DIR except for those listed in PATHS-KEPT, without +following symblinks. Report but don't ignore errors." + (let ((paths-kept (map (cut canonicalize-path <>) + paths-kept))) + (file-system-fold + (lambda (current-path current-stat result) ;enter? + (not (member (canonicalize-path current-path) paths-kept string=?))) + (lambda (file file-stat result) ;leaf + (if (not (any (cut string-prefix? (canonicalize-path file) <>) + paths-kept)) + (warn-on-error (delete-file file) file))) + (const #t) ;down + (lambda (dir dir-stat result) ;up + (if (not (any (cut string-prefix? (canonicalize-path dir) <>) + paths-kept)) + (warn-on-error (rmdir dir) dir))) + (const #t) ;skip + (lambda (file stat errno result) ;error + (format (current-error-port) + "warning: failed to delete ~a: ~a~%" file (strerror errno))) + #t (getcwd) lstat))) + (define (file-name-predicate regexp) "Return a predicate that returns true when passed a file name whose base name matches REGEXP." base-commit: cd20619cfcb32c2631fb602729512740bc510550 -- 2.48.1
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Andrew Wong <wongandj@HIDDEN> Subject: bug#76492: Acknowledgement ([PATCH] build/utils: Add delete-all-but) Message-ID: <handler.76492.B.174027381531132.ack <at> debbugs.gnu.org> References: <0b8d4eb4212609048cf81f2e3e6e3da83c1caf46.1740273538.git.wongandj@HIDDEN> X-Gnu-PR-Message: ack 76492 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 76492 <at> debbugs.gnu.org Date: Sun, 23 Feb 2025 01:24:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to Andreas Enge <andreas@HIDDEN>, Janneke Nieuwenhuizen <janneke@HIDDEN>, = Ludovic Court=C3=A8s <ludo@HIDDEN>, Zheng Junjie <z572@HIDDEN> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): guix-patches@HIDDEN If you wish to submit further information on this problem, please send it to 76492 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 76492: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76492 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 5 Jun 2025 08:10:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 05 04:10:22 2025 Received: from localhost ([127.0.0.1]:58448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uN5g6-0004Z1-Iy for submit <at> debbugs.gnu.org; Thu, 05 Jun 2025 04:10:22 -0400 Received: from p-east3-cluster7-host10-snip4-1.eps.apple.com ([57.103.84.222]:45786 helo=outbound.qs.icloud.com) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <wongandj@HIDDEN>) id 1uN5g3-0004YW-Fb for control <at> debbugs.gnu.org; Thu, 05 Jun 2025 04:10:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; bh=O2oJhrBVOexwbpD93KOl5/31phtyj3SkTdOkHFijJgs=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type:x-icloud-hme; b=fLgSOVdVV+lJSu47rC92kJbEBYg4dsfh9j+kp4fi6dBeRaI+CxZRByJhiDDgKMOBJ qG7kYxNPmsxcQ96PBTtB3XjfhMC11y3NzVR0tqJ5FxEDockgAytL33cley9k5fJ7qO I0KAs6nyI3r4IU5NptjGxThYQe7+ELdJu+nOISq5xayreykKGzjd3KuipopG6BRPCO xuHhRhil9gt5NmUpEWVmbjqSzjR20aOJdQddY+wnE0y1GYFMj2uq9vtkjRn6fHjMuu ukFc6arhdCGUi97PUZrFxkW3C0PYlRzLWPe+2usLWEjrVNnO04bKho9qXiM+rRfgiQ qi+oSpQMFAySA== Received: from outbound.qs.icloud.com (localhost [127.0.0.1]) by outbound.qs.icloud.com (Postfix) with ESMTPS id 1AE8118000B5 for <control <at> debbugs.gnu.org>; Thu, 5 Jun 2025 08:10:11 +0000 (UTC) Received: from [192.168.86.109] (qs-asmtp-me-k8s.p00.prod.me.com [17.57.155.37]) by outbound.qs.icloud.com (Postfix) with ESMTPSA id 47BC318001A2 for <control <at> debbugs.gnu.org>; Thu, 5 Jun 2025 08:10:11 +0000 (UTC) Message-ID: <bb3fd19b-f085-44e7-9faa-33054bc5556c@HIDDEN> Date: Thu, 5 Jun 2025 04:10:10 -0400 MIME-Version: 1.0 User-Agent: Icedove Daily Content-Language: en-US To: control <at> debbugs.gnu.org From: Andrew Wong <wongandj@HIDDEN> Subject: Close Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: Tp9gQXSYkzRt0cyfbuxkhQQU1l7_-orU X-Proofpoint-ORIG-GUID: Tp9gQXSYkzRt0cyfbuxkhQQU1l7_-orU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-05_02,2025-06-03_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=361 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.22.0-2503310001 definitions=main-2506050071 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 76492 close 76910 Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (wongandj[at]icloud.com) 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see <https://www.spamcop.net/bl.shtml?17.57.155.37>] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [57.103.84.222 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [57.103.84.222 listed in bl.score.senderscore.com] X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.2 (/) close 76492 close 76910
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.