From patchwork Thu Mar 2 09:12:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 47529 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 0DBDF16CF1; Thu, 2 Mar 2023 09:13:50 +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_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 A175916BFB for ; Thu, 2 Mar 2023 09:13:48 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXezo-0004Og-M9; Thu, 02 Mar 2023 04:13:04 -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 1pXezn-0004O8-PN for guix-patches@gnu.org; Thu, 02 Mar 2023 04:13:03 -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 1pXezn-0006gH-GZ for guix-patches@gnu.org; Thu, 02 Mar 2023 04:13:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXezl-0007GJ-RJ; Thu, 02 Mar 2023 04:13:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61910] [PATCH] git-download: Download a bare Git repository from SWH. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: simon.tournier@inserm.fr, valentin.lorentz@inria.fr, guix-patches@gnu.org Resent-Date: Thu, 02 Mar 2023 09:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 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?= , Simon Tournier , Valentin Lorentz X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Simon Tournier , Valentin Lorentz Received: via spool by submit@debbugs.gnu.org id=B.167774837427896 (code B ref -1); Thu, 02 Mar 2023 09:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Mar 2023 09:12:54 +0000 Received: from localhost ([127.0.0.1]:55742 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXezd-0007Fr-P7 for submit@debbugs.gnu.org; Thu, 02 Mar 2023 04:12:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:47690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXezZ-0007Fh-6U for submit@debbugs.gnu.org; Thu, 02 Mar 2023 04:12:52 -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 1pXezX-0003zK-SU for guix-patches@gnu.org; Thu, 02 Mar 2023 04:12:48 -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 1pXezX-0005qV-JF; Thu, 02 Mar 2023 04:12:47 -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:Subject:To:From:in-reply-to: references; bh=nPqoIDN3JTSuAZRRBGKSieBvCFxWrYofm7kTqFhTJ/Y=; b=M6ykyJsYmR1fvq qPQOem7HISfN9oNkFcwxbZ+bBqlo00I1elwf55DKeb1pz4UtKrW6UbJE92vpaJ1tjIvDa6BG+WoHe FJpSRN1ficYwEHgwxCtFxaiZEnbDOJX/I0WJm1R6p9Jv7L6ozOl6ftbzULtGmeiS7ZG0WgKMiotjG /V4o79Ii3FCjSK9cN2kO1yS5CWw8+Coib1UyfP+2CN1CbfoeCgUk8FplOnc76rRDusLUf3ikDvoeQ U6wmpWUlipXBnns0o3zJGsMC9vJ7G/LuBu+Ennb78naXSJjvUL4gMQpTDEHL4ebVrjHj5MXI0/NW0 WmzKOiGPg3f0BQ9I1VBg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXezX-0005RO-69; Thu, 02 Mar 2023 04:12:47 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 2 Mar 2023 10:12:33 +0100 Message-Id: <20230302091233.28226-1-ludo@gnu.org> X-Mailer: git-send-email 2.39.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 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 . * guix/git-download.scm (git-fetch)[build]: Pass #:archive-type to 'swh-download' and invoke "git clone" on the result. --- guix/git-download.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) Hi there! I just saw the discussion between Simon and Valentin (Cc’d) and realized this could easily be fixed on our side because (guix swh) is already equipped to fetch bare Git repositories. To test it, comment out the ‘git-fetch’ and ‘download-nar’ calls in (guix git-download) and run, say: ./pre-inst-env guix build -S guile-bash --check I don’t know of a repository that has this CRLF problem though, so we should check that it actually works as advertised on such a repo. Thanks, Ludo’. base-commit: ff5fbcc19bce6e94ead0cc79b27ae8ed0307463d diff --git a/guix/git-download.scm b/guix/git-download.scm index a1566bed4d..9f57b4170d 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -1,5 +1,5 @@ ;;; 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 @@ -162,8 +162,17 @@ (define recursive? (parameterize ((%verify-swh-certificate? #f)) (format (current-error-port) "Trying to download from Software Heritage...~%") + + ;; Fetch the source as a bare Git repository (rather + ;; than 'flat') so Git can post-process it in the usual + ;; way, for instance to perform CR/LF conversion. (swh-download (getenv "git url") (getenv "git commit") - #$output)))))))) + "git-repo" + #:archive-type 'git-bare) + (invoke #+(file-append git "/bin/git") + "clone" "git-repo" #$output) + (delete-file-recursively + (string-append #$output "/.git"))))))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "git-checkout") build