From patchwork Sat Jan 14 15:14:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46114 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 68B0D27BBEB; Sat, 14 Jan 2023 15:16:37 +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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,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 BFC7627BBE9 for ; Sat, 14 Jan 2023 15:16:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGiGN-0005th-Qm; Sat, 14 Jan 2023 10:16:08 -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 1pGiGI-0005sl-Eg for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:02 -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 1pGiGI-0004mF-44 for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGiGH-0000bk-Vp for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v3 1/2] platforms: Raise an exception when no suitable platform is found. References: <20230114030542.23524-1-maxim.cournoyer@gmail.com> In-Reply-To: <20230114030542.23524-1-maxim.cournoyer@gmail.com> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 Jan 2023 15:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60802@debbugs.gnu.org Cc: Josselin Poiret , Tobias Geerinckx-Rice , Maxim Cournoyer , Simon Tournier , Mathieu Othacehe , ludo@gnu.org, Christopher Baines , Ricardo Wurmus Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.16737093362295 (code B ref 60802); Sat, 14 Jan 2023 15:16:01 +0000 Received: (at 60802) by debbugs.gnu.org; 14 Jan 2023 15:15:36 +0000 Received: from localhost ([127.0.0.1]:55346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGiFr-0000aw-LQ for submit@debbugs.gnu.org; Sat, 14 Jan 2023 10:15:36 -0500 Received: from mail-qt1-f180.google.com ([209.85.160.180]:39565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGiFc-0000aE-IS for 60802@debbugs.gnu.org; Sat, 14 Jan 2023 10:15:33 -0500 Received: by mail-qt1-f180.google.com with SMTP id s5so16940708qtx.6 for <60802@debbugs.gnu.org>; Sat, 14 Jan 2023 07:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=icMlSN0IUHOmbGVkoAf/IZ56XfX3F3DxsYMx7wiATiQ=; b=OmoQU2I+UPBh4Ee8UhvOucc5X/Jv33HmdbKt2mFy0WqjhyxLobEz0n8xklmCo/pHvU T1bvm55JtKZORv0NPiQKNOkfDN1otghLN2Avsij3Jc/ugL+MEehhAVyfdk92GMC7PV3p ty5nku8EvsJikunqFcucGJUJ4McuvRNLyAXm7y2+hoCk9blrKNiMVCAf82olcmuNt+93 tpr4yBRceO2xulxNVlHJPyA9c4pJ6KU1t07Ws8GIwVE3ITirvP6Els5Z1j1EpjVwOz7G mnVJTlkR7SBepi88ZZVbese7pyLG69R8q/34gVborGSn1HtVt+MfxLB4ECo5wRW8i9ul 9vSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=icMlSN0IUHOmbGVkoAf/IZ56XfX3F3DxsYMx7wiATiQ=; b=PyJtXGAj9d09zEkGK58wtKWPZjeyiBnQJWXP9M2QpkRTqjFWjOgS2P85tUqS0gVNOo aLa4OMTaWX675liDbjgwJah6pV3Q0b6MFYPbE6Kxf5WF+wkVrCu8AB2VWdKum8qdJ0k9 vmxtTGIqiVd8aobCdEJpdbLjSWY0dqRi8dI4tyW4l0bDlGG//cIgt+UINwsaGhgs/GNT IkKmTDR1/cD/iUgNdh/jaqF6Q8rNiiUQKtcar0MWVuJedfUX7ks8+98UrG0csetzXwzb uamqJm/B7cdjCp0hqSMRI/0eocgcpwreC3VqsR0/FcpOs5pA2NDNUxVKmGc2jBI20gTj LaVg== X-Gm-Message-State: AFqh2koShF7F52jflf0N7wi8nV7uSEjCY2juN23zw281uF2/YhfZzmGQ yqEzXNqq0vmLZ7399U1+aT0j4icM91FDDrLa X-Google-Smtp-Source: AMrXdXsUvoeIaqjyrRNm4pbaJnboMtriQmGOo5txNKy7C2YwHky/HQmjCWZTJxhsovx9GX0pDLiqVw== X-Received: by 2002:ac8:690d:0:b0:3a7:e805:a010 with SMTP id bt13-20020ac8690d000000b003a7e805a010mr121171395qtb.21.1673709310908; Sat, 14 Jan 2023 07:15:10 -0800 (PST) Received: from localhost.localdomain (dsl-10-149-10.b2b2c.ca. [72.10.149.10]) by smtp.gmail.com with ESMTPSA id ge9-20020a05622a5c8900b003a7e38055c9sm12125213qtb.63.2023.01.14.07.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jan 2023 07:15:10 -0800 (PST) From: Maxim Cournoyer Date: Sat, 14 Jan 2023 10:14:56 -0500 Message-Id: <20230114151457.1903-2-maxim.cournoyer@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 This was motivated by #60786, which produced a cryptic, hard to understand backtrace. * guix/platform.scm (&platform-not-found-error): New exception type. (make-platform-not-found-error): New exception constructor. (platform-not-found-error?): New predicate. (false-if-platform-not-found): New syntax. (lookup-platform-by-system): Raise an exception when no platform is found. Update documentation. (lookup-platform-by-target): Likewise. (lookup-platform-by-target-or-system): Likewise, and guard lookup calls with false-if-platform-not-found. * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Handle lookup-platform-by-system call to preserve existing behavior. --- Changes in v3: - Use false-if-platform-not-found instead of false-if-exception in (gnu packages bootstrap) - Do not export make-platform-not-found-error constructor Changes in v2: - Add false-if-platform-not-found syntax - Use it while evaluating lookup-platform-by-target-or-system gnu/packages/bootstrap.scm | 3 ++- guix/platform.scm | 50 ++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index d2914fb5a7..9ea1a3e4d1 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -315,7 +315,8 @@ (define* (glibc-dynamic-linker (%current-system)))) "Return the name of Glibc's dynamic linker for SYSTEM." ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc. - (let ((platform (lookup-platform-by-system system))) + (let ((platform (false-if-platform-not-found + (lookup-platform-by-system system)))) (cond ((platform? platform) (platform-glibc-dynamic-linker platform)) diff --git a/guix/platform.scm b/guix/platform.scm index f873913fe0..4f4da002f7 100644 --- a/guix/platform.scm +++ b/guix/platform.scm @@ -21,6 +21,7 @@ (define-module (guix platform) #:use-module (guix memoization) #:use-module (guix records) #:use-module (guix ui) + #:use-module (ice-9 exceptions) #:use-module (srfi srfi-1) #:export (platform platform? @@ -29,6 +30,10 @@ (define-module (guix platform) platform-linux-architecture platform-glibc-dynamic-linker + &platform-not-found-error + platform-not-found-error? + false-if-platform-not-found + platform-modules platforms lookup-platform-by-system @@ -70,6 +75,19 @@ (define-record-type* platform make-platform (default #false)) (glibc-dynamic-linker platform-glibc-dynamic-linker)) + +;;; +;;; Exceptions. +;;; +(define-exception-type &platform-not-found-error &error + make-platform-not-found-error platform-not-found-error?) + +(define-syntax-rule (false-if-platform-not-found exp) + "Evaluate EXP but return #f if it raises a platform-not-found-error? +exception." + (guard (ex ((platform-not-found-error? ex) #f)) + exp)) + ;;; ;;; Platforms. @@ -94,23 +112,29 @@ (define platforms (platform-modules))))) (define (lookup-platform-by-system system) - "Return the platform corresponding to the given SYSTEM." - (find (lambda (platform) - (let ((s (platform-system platform))) - (and (string? s) (string=? s system)))) - (platforms))) + "Return the platform corresponding to the given SYSTEM. Raise +&PLATFORM-NOT-FOUND-ERROR when no platform could be found." + (or (find (lambda (platform) + (let ((s (platform-system platform))) + (and (string? s) (string=? s system)))) + (platforms)) + (raise-exception (make-platform-not-found-error)))) (define (lookup-platform-by-target target) - "Return the platform corresponding to the given TARGET." - (find (lambda (platform) - (let ((t (platform-target platform))) - (and (string? t) (string=? t target)))) - (platforms))) + "Return the platform corresponding to the given TARGET. Raise +&PLATFORM-NOT-FOUND-ERROR when no platform could be found." + (or (find (lambda (platform) + (let ((t (platform-target platform))) + (and (string? t) (string=? t target)))) + (platforms)) + (raise-exception (make-platform-not-found-error)))) (define (lookup-platform-by-target-or-system target-or-system) - "Return the platform corresponding to the given TARGET or SYSTEM." - (or (lookup-platform-by-target target-or-system) - (lookup-platform-by-system target-or-system))) + "Return the platform corresponding to the given TARGET or SYSTEM. Raise +&PLATFORM-NOT-FOUND-ERROR when no platform could be found." + (or (false-if-platform-not-found (lookup-platform-by-target target-or-system)) + (false-if-platform-not-found (lookup-platform-by-system target-or-system)) + (raise-exception (make-platform-not-found-error)))) (define (platform-system->target system) "Return the target matching the given SYSTEM if it exists or false From patchwork Sat Jan 14 15:14:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46113 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 3E9F827BBED; Sat, 14 Jan 2023 15:16:13 +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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,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 2D56927BBE9 for ; Sat, 14 Jan 2023 15:16:12 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGiGJ-0005tM-UZ; Sat, 14 Jan 2023 10:16:03 -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 1pGiGI-0005sj-4g for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:02 -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 1pGiGH-0004m9-T4 for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGiGH-0000bd-K7 for guix-patches@gnu.org; Sat, 14 Jan 2023 10:16:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v3 2/2] gnu: Remove u-boot-malta. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 14 Jan 2023 15:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60802 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60802@debbugs.gnu.org Cc: ludo@gnu.org, Maxim Cournoyer Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.16737093252272 (code B ref 60802); Sat, 14 Jan 2023 15:16:01 +0000 Received: (at 60802) by debbugs.gnu.org; 14 Jan 2023 15:15:25 +0000 Received: from localhost ([127.0.0.1]:55344 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGiFh-0000aa-D0 for submit@debbugs.gnu.org; Sat, 14 Jan 2023 10:15:25 -0500 Received: from mail-qt1-f181.google.com ([209.85.160.181]:39568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGiFf-0000aI-0I for 60802@debbugs.gnu.org; Sat, 14 Jan 2023 10:15:23 -0500 Received: by mail-qt1-f181.google.com with SMTP id s5so16940768qtx.6 for <60802@debbugs.gnu.org>; Sat, 14 Jan 2023 07:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=mKq2tMih/lKaYYMIyOI+nnrBe1CKg2z+uqB0zLqnEP8=; b=D2u25ruQiges/LFcyGUzCimYoddLoEJfQdu1XGU/RMpTGIxFN73sUZf9+/HnLrqJbA uFlrCjT9RrV6Z75FRe9EN7Lhr4bh8GBFT3ZYDBvKcb6xJXe+8ginwoEd7jkCkC9NGjiM B4Gnb2Afzeym3RWAj34QGldbBzhvkdyPnsCKl0x6w8JfTruVg89JjMsRvGb16Dswy9Av J7w5G7h4qMZqFIiZykRD6IunODkPHfPRd4eUk6bqngXwQ1KESyOfRi56DLPORzWJwFLf +vNFhzRy8CJgq+Xhc9eG9jhof9QCREa5qfsgZnVp5Mt41FltVlNycXWTPGRVCF9EE2KQ cnhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=mKq2tMih/lKaYYMIyOI+nnrBe1CKg2z+uqB0zLqnEP8=; b=H+g7vuZ3PXDjQVoOZsqW2y+lU+xiFKEeOWuIhfQaZ5X4rog0lFITL/KJtDhzW52Uyy qedYgLwgRxZFocY6kO+7cshnZt9oH60/ZPMbefkTgdBSRlxUtERb/tD5O/tEAjS56DO1 CVda/UoVD8mgfJZfgese3jo+NLbHEhFBNLtWqwXS7QuQCGRw7vWcQYiDxLd5hM4YfhjD AqExh8rk5uNqYsGH8zTQXFFNSZSP209siNoiNg/IPINPoUB/irae/t+3CwX+DtgynFJ5 uZ0kk8WYzLoa9d1iZtqmH6xlMVOp3WeQ7RrGSnUvzg2wG+Sg1aNxDRtWt+wpjG7zA7D8 Feqw== X-Gm-Message-State: AFqh2kpw7StLeVgPgUxPnfKFKJLbKnmJGBmRXGzGl6aniv7uUYZsGcm/ e9x7UTqyPyLjeDmgRe3uoSNkwhLpwT0dl3Bs X-Google-Smtp-Source: AMrXdXvWIJixSom2nY+3C4LXdQJxG9QS2Rj7Q261UC0XMwkWwe6jN7o2LRkJcPsG/1+gOlzv9tS+lQ== X-Received: by 2002:a05:622a:4c89:b0:3a5:1ea1:bae2 with SMTP id ez9-20020a05622a4c8900b003a51ea1bae2mr31191887qtb.34.1673709314028; Sat, 14 Jan 2023 07:15:14 -0800 (PST) Received: from localhost.localdomain (dsl-10-149-10.b2b2c.ca. [72.10.149.10]) by smtp.gmail.com with ESMTPSA id ge9-20020a05622a5c8900b003a7e38055c9sm12125213qtb.63.2023.01.14.07.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Jan 2023 07:15:13 -0800 (PST) From: Maxim Cournoyer Date: Sat, 14 Jan 2023 10:14:57 -0500 Message-Id: <20230114151457.1903-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230114151457.1903-2-maxim.cournoyer@gmail.com> References: <20230114151457.1903-2-maxim.cournoyer@gmail.com> 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 Relates to . The mips64el architecture is not currently supported, causing (guix platform) to raise an exception when attempting to cross-build the package. * gnu/packages/bootloaders.scm (u-boot-malta): Delete variable. --- (no changes since v1) gnu/packages/bootloaders.scm | 3 --- 1 file changed, 3 deletions(-) diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 6e6bdb4c08..8dc6ff698d 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -965,9 +965,6 @@ (define*-public (make-u-boot-package board triplet uboot-files) #t))))))))) -(define-public u-boot-malta - (make-u-boot-package "malta" "mips64el-linux-gnuabi64")) - (define-public u-boot-am335x-boneblack (let ((base (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"