From patchwork Thu Mar 2 12:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 47531 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 298BD16CF7; Thu, 2 Mar 2023 12:07:26 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5776B16CF1 for ; Thu, 2 Mar 2023 12:07:22 +0000 (GMT) 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 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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 base-commit: af95f2d8f98eb2c8c64954bb2fd0b70838899174 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