From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SNfzKAx6U2WEnwAAauVa8A:P1 (envelope-from ) for ; Tue, 14 Nov 2023 14:45:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id SNfzKAx6U2WEnwAAauVa8A (envelope-from ) for ; Tue, 14 Nov 2023 14:45:48 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 83D3526459 for ; Tue, 14 Nov 2023 14:45:48 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HLCrmym3; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699969548; a=rsa-sha256; cv=none; b=GFIDdYcfi9ifWprgVj1eJUNxuQtY6tMd0A+wNAiOXDln6IxV5MQSwjIa0eafswo/jCKI5r Uqlm/owSfsrCaTUxRDomlLAozKbd814ZV+pcqF2dpbpDMFM8XYD3PuXcKBW9f953bamLwo H3XagyKBCNfRZ/ahERZ93buMvUOXVJx1DEsoXpMnShENcTuEpixSAFkB4MrBEXR9K2D1pm YJflh6bj66kmuKwbcSI1qxerkORwleGeopFDUJhtYz+yD9cn2se3zEZmx1uO782KJW+3xD +s6h6ekePBw7H2Bv8RhgAVVCsNi2O4y4AB+4e32wuV2ivSubBY03acY8we+jWw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HLCrmym3; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699969548; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dgBzfZ8WLH55iw/qQuQ70zMagMfEOzJERWCTJSoMau0=; b=SkmBN074zYiJIVChhNqogNfLWz43RxHxEOKny5IFDpZcsU4iSZeXNCloOj+izvY4suz+d/ QEdgp1xFoscWn9DaoR0pem9X9fS8lUf/ghq6zyMeDbKBdJnZXYC7CWKdtasVF8WMy1pKmK iJqcy+FjG6hOL8uDuz3PYjPaB49TsLiE6nV0cJcSJeB3XPIKo8in5iPhR1pxnyAclCuaYn 4Tl7bs1CFaDUUlbKmVmlnwtKRWmTBBn6lrR27ytisn/RvJapf6ZT2PvT3SA/Nmid5cuDqH UQo6Ez/GZHNGPnI5WV9ljphmY3M5vwhlSK6SpBulHwdM6fV5hpmGvbH9XdTsJw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2tjI-0004DX-IA; Tue, 14 Nov 2023 08:45:24 -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 ) id 1r2tjF-0004Cz-BH for guix-patches@gnu.org; Tue, 14 Nov 2023 08:45:21 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2tjE-00052d-DM for guix-patches@gnu.org; Tue, 14 Nov 2023 08:45:20 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2tju-0004tQ-HM for guix-patches@gnu.org; Tue, 14 Nov 2023 08:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#66961] [PATCH] scripts: hash: Handle repository with different VCS folders. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 Nov 2023 13:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66961 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: Josselin Poiret , Mathieu Othacehe , Tobias Geerinckx-Rice , 66961@debbugs.gnu.org, Ricardo Wurmus , Christopher Baines Received: via spool by 66961-submit@debbugs.gnu.org id=B66961.169996954818784 (code B ref 66961); Tue, 14 Nov 2023 13:46:02 +0000 Received: (at 66961) by debbugs.gnu.org; 14 Nov 2023 13:45:48 +0000 Received: from localhost ([127.0.0.1]:60529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tjf-0004su-Iq for submit@debbugs.gnu.org; Tue, 14 Nov 2023 08:45:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tjd-0004sd-RA for 66961@debbugs.gnu.org; Tue, 14 Nov 2023 08:45:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2tip-0004pJ-FZ; Tue, 14 Nov 2023 08:44:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=dgBzfZ8WLH55iw/qQuQ70zMagMfEOzJERWCTJSoMau0=; b=HLCrmym3IBXfPPs3xALK xMHFm+IsnVzKxKrH+w71nf7e8EFaAsfV5MrVDwWhbZn6a1Z2En+RT82PWVSK5LG75lVhqILGwrtgL DITG+Fz+1QKG9RBU7ACl4XVbm+qAXTLICP1sly3jFxgU6LlND89XciYCQHNOtyknKqkBkmaXjHQcS cJ9HQkd0fVYOVA3ckwel3cJObv/A7vbUiM9YjXjz59h/2jSDCQOoZkERbSFRIrqLRnvf/KAnvJym4 ey1A2puZkw6RjswqZTfDBuvshFTei81fNJdXLFgxWsG8D7wJTM6tnsuYS+zjaU98eDMV+M6+a8qeY 4NwjyXzUloV10Q==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <4be63ddf12bd6143b43e87951e164dc93c585bb8.1699225200.git.zimon.toutoune@gmail.com> (Simon Tournier's message of "Mon, 6 Nov 2023 00:00:55 +0100") References: <4be63ddf12bd6143b43e87951e164dc93c585bb8.1699225200.git.zimon.toutoune@gmail.com> Date: Tue, 14 Nov 2023 14:44:52 +0100 Message-ID: <87zfzg8n57.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 83D3526459 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.29 X-Spam-Score: -5.29 X-TUID: oY9XLIRHN83R Hi! Simon Tournier skribis: > Fixes . > Reported by Simon Tournier > > * guix/hash.scm (vcs-file?): Add optional argument for passing VCS kind o= f the > file/repository. > (file-hash*): Adjust accordingly. > * guix/scripts/hash.scm (guix-hash)[file-hash]: Detect VCS kind of the > file/repository and passes it. > > Change-Id: I8e286c3426ddefd664dc3a471d5a09e309824faa [...] > +(define* (vcs-file? file stat > + #:optional > + (vcses (list ".bzr" ".git" ".hg" ".svn" "CVS"))) > + "Returns true if FILE matches a version control system from the list V= CSES." How about =E2=80=98vcs-directories=E2=80=99 rather than =E2=80=98vcses=E2= =80=99? Also, you can add: (define %known-vcs-directories '(".bzr" =E2=80=A6)) and use it to avoid repeating it. > + (let* ((vcses (fold (lambda (vcs result) > + (if (file-exists? (string-append file = "/" vcs)) > + (cons vcs result) > + result)) > + '() > + (list ".bzr" ".git" ".hg" ".svn" "CVS"))) > + (select? (if (assq-ref opts 'exclude-vcs?) > + (negate (lambda (file stat) > + (vcs-file? file stat > + vcses))) > + (const #t)))) Maybe you can have: (define (vcs-predicate directory) (define directories (filter (lambda (metadata-directory) (file-exists? (in-vicinity directory metadata-directory))) %known-vcs-directories)) (lambda (file stat) (vcs-file? file stat directories))) and then use that above? (That way we don=E2=80=99t stat these things when =E2=80=98exclude-vcs?=E2=80=99 is #false.) Thanks, Ludo=E2=80=99.