From patchwork Thu May 25 15:41:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 50317 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 EC1B427BBE9; Thu, 25 May 2023 16:42:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS 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 C418F27BBE2 for ; Thu, 25 May 2023 16:42:12 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2D6L-0001Wc-UN; Thu, 25 May 2023 11:42:06 -0400 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 1q2D6I-0001UG-Jk for guix-patches@gnu.org; Thu, 25 May 2023 11:42:04 -0400 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 1q2D6I-0002Wk-B8 for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2D6I-00018T-7F for guix-patches@gnu.org; Thu, 25 May 2023 11:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63647] [PATCH v2 2/3] guix: import: go: Catch Git error. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 May 2023 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63647 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63647@debbugs.gnu.org Cc: Felix Lechner , Simon Tournier Received: via spool by 63647-submit@debbugs.gnu.org id=B63647.16850292894274 (code B ref 63647); Thu, 25 May 2023 15:42:02 +0000 Received: (at 63647) by debbugs.gnu.org; 25 May 2023 15:41:29 +0000 Received: from localhost ([127.0.0.1]:47883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5k-00016r-LO for submit@debbugs.gnu.org; Thu, 25 May 2023 11:41:29 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:38309) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2D5i-00016N-9q for 63647@debbugs.gnu.org; Thu, 25 May 2023 11:41:27 -0400 Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-30aa563abdaso272377f8f.1 for <63647@debbugs.gnu.org>; Thu, 25 May 2023 08:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CSnHPMzezOPOSZyv6KXp9jZFfx9VEwTPOCtQsJi6uGA=; b=jm4FKkxm6Cvf2ftb0Ba2nnjDJiFFYN2dvunLEbZg8ybsQnU2bb7OLBgiWYTL1+wlg2 MiNFgOrhFMz9mBIi+PTBhUlzclTrHUAnpfzSGX9dC2Xzh2zWtBVxzf6eZpdEVUqGBPzJ gIaa3/HpdkoZzrdSSlwQsC4oCu4rJaD0Kd8sC1/Gvam4lyNnSBquw3uBpdes4yikJbdm 1tczV0Lwt52ic/aKy28bAGVZs6wVw7h56U0cUdeg6z1eV4fUYXati3ntDO+a20v8gbrt Ze7H48cjOzJjeo7dzFCR1jKPd2rYsgpvYWiJZ2R8zUZBPzNBmixzFwsvgLazL5pk9wMI 7mHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685029280; x=1687621280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CSnHPMzezOPOSZyv6KXp9jZFfx9VEwTPOCtQsJi6uGA=; b=BizvC9k2ggC3iCzXskwsToWVrG8BkAqlqVhtggqOGoUYGTE4htknfWBJR2FoyGV5Bo oD+JOWf+r+6v315u2nsiuJQ8qQ3GLxog+WBfqkYPsTOsTqWVXcMqToyK1b7FC+kS/3Cx wvDBE7b6me1B2tzOfmLl7Ey391HGs9XW3A9KiKeDB5sryESXA/rovBEYdm5O7RryT4R8 uPw35U0axmAaAZ+vuy303OByR8BVPFB1aa+DpMdynvkMD4pB9cWzctCWWeL9bGQ9EYWC F57J0mKLVuc3AgyK7BhaN6dKUINun1JEO2riq6HX88Pf9MdjNaJO3uE7Ku6zRbyl+6hb CrPA== X-Gm-Message-State: AC+VfDwRFVThLmJ46Wp77GTeffQqMUb8TUZAVMCldsxyD2AE3PW3VIzk UbngsNaZ83G8jt7L5RRM0xSKXoS/iG8= X-Google-Smtp-Source: ACHHUZ5ImuWUKoVD1rRjMDKY8Sz+OywiIkchiMpTa0IAPAcDUpAHC7Ya1DnqkfCYAKVf0n4cxuRuqQ== X-Received: by 2002:a5d:6785:0:b0:309:22bb:e00 with SMTP id v5-20020a5d6785000000b0030922bb0e00mr4045628wru.5.1685029280407; Thu, 25 May 2023 08:41:20 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id q2-20020adff502000000b003062c0ef959sm2172258wro.69.2023.05.25.08.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 08:41:20 -0700 (PDT) From: Simon Tournier Date: Thu, 25 May 2023 17:41:11 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: 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 * guix/import/go.scm (git-checkout-hash): Catch Git error. Reported-by: Felix Lechner . --- guix/import/go.scm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index 1943869162..c6258296f6 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2021-2022 Ludovic Courtès ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Sarah Morgensen -;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2021, 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,9 +36,11 @@ (define-module (guix import go) #:use-module (guix memoization) #:use-module (guix utils) #:autoload (htmlprag) (html->sxml) ;from Guile-Lib - #:autoload (guix base32) (bytevector->nix-base32-string) + #:autoload (guix base32) (bytevector->nix-base32-string nix-base32-string->bytevector) #:autoload (guix build utils) (mkdir-p) + #:autoload (guix ui) (warning) #:autoload (gcrypt hash) (hash-algorithm sha256) + #:autoload (git structs) (git-error-message) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (ice-9 peg) @@ -507,12 +509,18 @@ (define* (git-checkout-hash url reference algorithm) ;; subsequent "guix import" invocations. (mkdir-p cache) (chmod cache #o700) - (let-values (((checkout commit _) - (parameterize ((%repository-cache-directory cache)) - (update-cached-checkout url - #:ref - `(tag-or-commit . ,reference))))) - (file-hash* checkout #:algorithm algorithm #:recursive? #true))) + (catch 'git-error + (lambda _ + (let-values (((checkout commit _) + (parameterize ((%repository-cache-directory cache)) + (update-cached-checkout url + #:ref + `(tag-or-commit . ,reference))))) + (file-hash* checkout #:algorithm algorithm #:recursive? #true))) + (lambda (key error . rest) + (warning (G_ "Git error: ~a in ~a~%") (git-error-message error) url) + (nix-base32-string->bytevector + "0000000000000000000000000000000000000000000000000000")))) (define (vcs->origin vcs-type vcs-repo-url version) "Generate the `origin' block of a package depending on what type of source