From patchwork Tue Mar 22 22:24:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 38012 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 9691627BBEA; Tue, 22 Mar 2022 22:25:18 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,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 0749227BBE9 for ; Tue, 22 Mar 2022 22:25:18 +0000 (GMT) Received: from localhost ([::1]:56972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWmwH-0002no-3o for patchwork@mira.cbaines.net; Tue, 22 Mar 2022 18:25:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nWmw3-0002nY-7S for guix-patches@gnu.org; Tue, 22 Mar 2022 18:25:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48139) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nWmw2-0002IR-DO for guix-patches@gnu.org; Tue, 22 Mar 2022 18:25:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nWmw2-0004mb-6r for guix-patches@gnu.org; Tue, 22 Mar 2022 18:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50238] [PATCH v2] build-self: Try printing nicer error messages References: In-Reply-To: Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 22 Mar 2022 22:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50238 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50238@debbugs.gnu.org Received: via spool by 50238-submit@debbugs.gnu.org id=B50238.164798785118321 (code B ref 50238); Tue, 22 Mar 2022 22:25:02 +0000 Received: (at 50238) by debbugs.gnu.org; 22 Mar 2022 22:24:11 +0000 Received: from localhost ([127.0.0.1]:42036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWmvD-0004lQ-32 for submit@debbugs.gnu.org; Tue, 22 Mar 2022 18:24:11 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:36408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nWmvB-0004lH-8S for 50238@debbugs.gnu.org; Tue, 22 Mar 2022 18:24:10 -0400 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by xavier.telenet-ops.be with bizsmtp id 9aQ7270034UW6Th01aQ7qG; Tue, 22 Mar 2022 23:24:07 +0100 Message-ID: From: Maxime Devos Date: Tue, 22 Mar 2022 23:24:02 +0100 User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1647987847; bh=PbzwnRBly8QPsbp3Vwe6mQW6TVwcDHR3r7uFTNqxOoc=; h=Subject:From:To:Date; b=MLI7zynRsG9BhiVPIYc+GdgIshbswz0mpA9EM9s6+64A4t0liBi4+CYiXFEw6RT3j 4Zf76QbFBwxZYUoYDpp/yokJVNwNYFggZwxlHR1V0AshDe2obLxQ7SmnRF2z2DGlAT ++vhvQvWkWU+XWbv+Y9v6IUwWeuPUccFB2sBlVga66r49KGTP1DEPRWUFHFZrcHFoD Wme5A4i+h6un06rtcNjVnMgUwfhlb74t+6FBqomnj07FOZCNtqWiA84d26rNA/WQhH Af0w1xaROMg+8pvClAQY/lWPJqwCc0NwIShvfNMXia73BK8DbEjbc58WtnT2id2I60 VuIqvLmfMJehw== 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" X-getmail-retrieved-from-mailbox: Patches The revised patch allows time travelling from v1.1.0 to (master + patch), by not always setting #:unwind?. Next step: test some older versions (v1.0.0, v0.2?, ...?)? Greetings, Maxime. From 78d8f1c69f39103f23e72f438f23a708d5388a77 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Sat, 28 Aug 2021 14:42:32 +0200 Subject: [PATCH] build-self: Try printing nicer error messages. This prevents daunting backtraces like in by only printing the relevant information: that 'subversion' fails to build. * build-aux/self.scm (build-program): Wrap the 'run-with-store' in a 'with-error-handling'. * guix/ui.scm (guard*): Don't explode on old Guiles. --- build-aux/build-self.scm | 23 +++++++++++++++-------- guix/ui.scm | 16 +++++++++++----- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm index 02822a2ee8..25a7b1e618 100644 --- a/build-aux/build-self.scm +++ b/build-aux/build-self.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -280,6 +281,7 @@ interface (FFI) of Guile.") ,@(source-module-closure `((guix store) (guix self) + (guix ui) (guix derivations) (gnu packages bootstrap)) (list source) @@ -316,6 +318,7 @@ interface (FFI) of Guile.") (read-disable 'positions)) (use-modules (guix store) + (guix ui) (guix self) (guix derivations) (srfi srfi-1)) @@ -347,14 +350,18 @@ interface (FFI) of Guile.") (parameterize ((current-warning-port (%make-void-port "w")) (current-build-output-port sock)) - (run-with-store store - (guix-derivation source version - #$guile-version - #:channel-metadata - '#$channel-metadata - #:pull-version - #$pull-version) - #:system system)) + ;; Use 'with-error-handling' to prevent scary + ;; backtraced like + ;; . + (with-error-handling + (run-with-store store + (guix-derivation source version + #$guile-version + #:channel-metadata + '#$channel-metadata + #:pull-version + #$pull-version) + #:system system))) derivation-file-name)))))) #:module-path (list source)))) diff --git a/guix/ui.scm b/guix/ui.scm index 238952723e..0afe75bbad 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2020 Arun Isaac ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2018 Steve Sprang +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -677,11 +678,16 @@ or remove one of them from the profile.") (define-syntax-rule (guard* (var clauses ...) exp ...) "This variant of SRFI-34 'guard' does not unwind the stack before evaluating the tests and bodies of CLAUSES." - (with-exception-handler - (lambda (var) - (cond clauses ... (else (raise var)))) - (lambda () exp ...) - #:unwind? #f)) + (apply with-exception-handler + (lambda (var) + (cond clauses ... (else (raise var)))) + (lambda () exp ...) + ;; Some old Guiles used by old versions of Guix don't support + ;; #:unwind. Avoid breaking "guix pull" from an old Guix to + ;; a new Guix, see . + (if (>= (string->number (major-version)) 3) + '(#:unwind? #f) + '()))) (define (call-with-error-handling thunk) "Call THUNK within a user-friendly error handler." base-commit: 29091731a0c6cb649cdfd72297575fe2bb2a9591 prerequisite-patch-id: e2faf5cdf72f293aca0aff5c89cc1f0dd874d29c -- 2.30.2