From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WKCYHnqRAGQ7MwAAbAwnHQ (envelope-from ) for ; Thu, 02 Mar 2023 13:07:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 4EVXHnqRAGRoIAAA9RJhRA (envelope-from ) for ; Thu, 02 Mar 2023 13:07:22 +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 0728310AED for ; Thu, 2 Mar 2023 13:07:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXhiL-0001lp-Rz; Thu, 02 Mar 2023 07:07:13 -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 1pXhiC-0001gT-45 for guix-patches@gnu.org; Thu, 02 Mar 2023 07:07:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXhiA-0006hE-4T for guix-patches@gnu.org; Thu, 02 Mar 2023 07:07:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXhi9-0003YY-W5 for guix-patches@gnu.org; Thu, 02 Mar 2023 07:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61910] [PATCH v2] git-download: Apply CR/LF to Git repository from SWH. References: <20230302091233.28226-1-ludo@gnu.org> In-Reply-To: <20230302091233.28226-1-ludo@gnu.org> Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Mar 2023 12:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61910 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61910@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 61910-submit@debbugs.gnu.org id=B61910.167775877413614 (code B ref 61910); Thu, 02 Mar 2023 12:07:01 +0000 Received: (at 61910) by debbugs.gnu.org; 2 Mar 2023 12:06:14 +0000 Received: from localhost ([127.0.0.1]:56019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXhhN-0003XV-Rk for submit@debbugs.gnu.org; Thu, 02 Mar 2023 07:06:14 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]:38628) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXhhL-0003XI-CW for 61910@debbugs.gnu.org; Thu, 02 Mar 2023 07:06:12 -0500 Received: by mail-wr1-f49.google.com with SMTP id h11so4546324wrm.5 for <61910@debbugs.gnu.org>; Thu, 02 Mar 2023 04:06:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677758765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WcSl1iPwUPF9FT3EMTTN5WMId3/nxLPQ3gcvUAhUyy0=; b=Npp/0QYRyFGE4QU2M1MbD/Z2GPpuu2VYmQMHpgji5HgBgACGqscv+XrvE7RNLwZMg/ 0Sn2n2FDkZQtoxPOgfcCxFmzb/WQMTqYI97mQo4e63arLUcYlBLd4ZUGzTVbCd3thE9w JgMi6pUSFgeXAiUqZFonnauzZHoWmIGMrvMfT0Ba1IlVFGb9eOwEWPLaFmdx/fVBR7oX CQ5uwZM2SJ+i61CQqcBhscMoOFo33wFCcnJbP0B72lJExxXxzaR0k1cQVKFpPyxCmfNF 9tQZjFkA9PqOiPMeADUd629gpa4/PmERM5P9doqL4Gw7laAlNEn8TqeGvDuY0uJCAJ7h 8WiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677758765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WcSl1iPwUPF9FT3EMTTN5WMId3/nxLPQ3gcvUAhUyy0=; b=LBeWzRdeF0g+6b7WXkxowUTCGcYiLdcs+QwHAqjGxOEk2z/WUesMDa3HPeayntejuD Pexn5QIxh5a9TwVYEQnnyDQkHW+xBV8y5o+2SHurlAFm98et16HhsAmNrQ9gL87EnTKL qUxYjDT1BzTByVQw2ONShVs5JlpGDXlZys3j+pK5ISdsjFXZ/quvnIdm/EiWA5nlOvSQ c2NU5N+AC4xDOxPyPj2ERknI1Csz9fGzGt7sehNJx+haIAB35p/EDgjWKNw4jbHqUBWx HF44Oo8WAWuwmBCyzJgxRZl+lFm8ty9h0fmGjPKSaQoJ4Ie5DBerrP8TAm39Ww/F3kOD 2jUA== X-Gm-Message-State: AO0yUKV80bmHTY09iuvcduaC39Y0ojTPDX2eyaY7yRrtG17ev2Uhin5l f7gMHpn+fAEGDkK4MPmqXWZcS9E4XYQ= X-Google-Smtp-Source: AK7set8ZiQp9PvSQTJBGHtxGRlToajKx90Z5V3tCI1btE7L8cgNBfZiyy848w5zwBNrCORbHCrD9FA== X-Received: by 2002:adf:dbc6:0:b0:2c7:1755:30ad with SMTP id e6-20020adfdbc6000000b002c7175530admr6360480wrj.2.1677758765146; Thu, 02 Mar 2023 04:06:05 -0800 (PST) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id m1-20020a05600c4f4100b003e01493b136sm3005006wmq.43.2023.03.02.04.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 04:06:04 -0800 (PST) From: Simon Tournier Date: Thu, 2 Mar 2023 13:05:46 +0100 Message-Id: <20230302120546.1074630-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677758842; a=rsa-sha256; cv=none; b=YfqOuYVKcAj3SAi/AoIM10KEMQ3/B6GD1zrpe+jo1sWb6ioHj8gTxspz8HDr85otDH/5AM ZwL6uW3zIuh3jwoTDDawm1X9OirkJhlZ1ZdJ66Qj6lOnMSlxVnZHLdbIjD+oDTN8FFuzai 3jLPTXhU7R+q/bxBokmKHPNdu3scgR1EloT3w6/rfYtIrlbf0cXucwe1V283NGfb38HpgN /GTKCt66NW5qp2MLy8II56IWHXGJxT+Iy3bOT70IzIrK2hIamzEW+4faYB4YBASoXlyZ6t eu9EqU7p5vb4jv2YeiUDYbLo2xH+hCFeVWn7Gsu3sYELmR/u6oiya88ZQfK+FA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="Npp/0QYR"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677758842; 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=WcSl1iPwUPF9FT3EMTTN5WMId3/nxLPQ3gcvUAhUyy0=; b=nQ1vspLFMisstEryPQgiBb5tzi9jl9740ZkJidziKL0xbkzVKi69JWKvxxwWURnJFF5332 uV06cfUz0i7HSxEw9ovw2oM+1U98gKGrm0SPAD+GwhVtg6WgULHdkBkCEvUcPMLt85RIMG ts1JxrOWY8kXHYEL/muU7Hyj6TD4lhgzTM6hDaZ5fKfbm7ULQyPEH06ne2vMUuC2GyaCm3 bk5KwzD5YGaw8IxOyIfL57zqozCu8NsgjuisSCT57EO1h8t8HoOnRC7yV39xjdk3RozksJ +sZKb+k/XVW9mWtl1KdRB9vLtuSjjtlTPj4+t+RQlS2REwZUxRk/UrbE/CWEIg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -2.09 X-Spam-Score: -2.09 X-Migadu-Queue-Id: 0728310AED Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="Npp/0QYR"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) X-TUID: u5pJm1oRRguR From: Ludovic Courtès Fixes a bug whereby CR/LF convention would not be applied on Git repositories retrieved from SWH: https://sympa.inria.fr/sympa/arc/swh-devel/2023-03/msg00000.html Reported by Simon Tournier . Suggested by Valentin Lorentz . Co-authored by Simon Tournier . * guix/git-download.scm (git-fetch)[build]: Add Git operations conditioned by .gitattributes on the result from SWH. --- guix/git-download.scm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) Hi, This uses 'flat' as previously but applies some Git commands for fixing CR/LF when .gitattributes is present or not. It works on the example hidapi. I have not tried for other examples. WDYT? Cheers, simon diff --git a/guix/git-download.scm b/guix/git-download.scm index a1566bed4d..be0b13615c 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -1,8 +1,9 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2014-2021, 2023 Ludovic Courtès ;;; Copyright © 2017 Mathieu Lirzin ;;; Copyright © 2017 Christopher Baines ;;; Copyright © 2020 Jakub Kądziołka +;;; Copyright © 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -162,8 +163,27 @@ (define recursive? (parameterize ((%verify-swh-certificate? #f)) (format (current-error-port) "Trying to download from Software Heritage...~%") + (swh-download (getenv "git url") (getenv "git commit") - #$output)))))))) + #$output) + ;; Perform CR/LF conversion if specificied by .gitattributes + (when (find-files "." ".gitattributes") + (invoke #+(file-append git "/bin/git") "-C" #$output + "init") + (invoke #+(file-append git "/bin/git") "-C" #$output + "config" "--local" "user.email" "you@example.org") + (invoke #+(file-append git "/bin/git") "-C" #$output + "config" "--local" "user.name" "Your Name") + (invoke #+(file-append git "/bin/git") "-C" #$output + "add" ".") + (invoke #+(file-append git "/bin/git") "-C" #$output + "commit" "-am" "'init'") + (invoke #+(file-append git "/bin/git") "-C" #$output + "read-tree" "--empty") + (invoke #+(file-append git "/bin/git") "-C" #$output + "reset" "--hard") + (delete-file-recursively + (string-append #$output "/.git")))))))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "git-checkout") build base-commit: af95f2d8f98eb2c8c64954bb2fd0b70838899174 -- 2.38.1