From patchwork Sat Jan 14 04:19:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46109 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 262F527BBEB; Sat, 14 Jan 2023 04:45:14 +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 1ABBD27BBE9 for ; Sat, 14 Jan 2023 04:45:13 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGY1V-0002tk-FK; Fri, 13 Jan 2023 23:20:05 -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 1pGY1T-0002sk-Cl for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20: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 1pGY1S-0000Nz-S5 for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGY1S-0000RC-Cx for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v2 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 04:20:02 +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 , Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Ricardo Wurmus Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.16736699621618 (code B ref 60802); Sat, 14 Jan 2023 04:20:02 +0000 Received: (at 60802) by debbugs.gnu.org; 14 Jan 2023 04:19:22 +0000 Received: from localhost ([127.0.0.1]:52940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGY0n-0000Q2-Fj for submit@debbugs.gnu.org; Fri, 13 Jan 2023 23:19:21 -0500 Received: from mail-qv1-f54.google.com ([209.85.219.54]:36383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGY0l-0000Po-C3 for 60802@debbugs.gnu.org; Fri, 13 Jan 2023 23:19:19 -0500 Received: by mail-qv1-f54.google.com with SMTP id t7so16136408qvv.3 for <60802@debbugs.gnu.org>; Fri, 13 Jan 2023 20:19:19 -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=d2yFsFQcb/8mWoUj6ZKYdIAUV55ddX33kj8Oo6ZN1Gw=; b=H3bEUfl/EIP8s9lfR0jjM7AkeSFt/Pht5aoM5Htn+YpqyiSYZQdv1UB9cTuqt0+kM4 bhM5T4Nkzqfb0H8oXexb0qKRzVdgvVn3pKA7RjgOk7MQTs7K4VjZrvD9874rDlOzlhA3 s0ySPN+cfwzgQnEGPOLc12lG12HnRN60jkTJmd2eeGTVBCF/YZl3eN98Z/SfS8p/NA3M NTE+lBty222C7OeXYp2hX3sY+YAT/TvSm7OjA7wFtOUMTxAcEj6SFPUTgIlK+Z6qHJJ1 t/qWxoaF4O/VKBRDNhSBPfVPOqh5uhfXH3TLfJH2roObakZkS7R4IFYARK+mdQ8BqD35 BafQ== 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=d2yFsFQcb/8mWoUj6ZKYdIAUV55ddX33kj8Oo6ZN1Gw=; b=6zYo4pxUpFJlNTJgBmn885GgKNyYoAHUFDmKv2vMoOEgwQYPi7cfs09nVqegQaJrfl RcoEvwqFxdWMOhwANzoKKRiwnXiunMhtehcrkLtB+oXBg3+aOlNQ0UBCSLpx+kvPXrfz n+avL5Tp6hK8tjBb7HStlzNQ9OPbs05itKA9ek2k+6rLDXXzzjTKQyr6PFc/r28jJW42 A3kqbshPAAV4nI1i6X+QsdfG8L5rYHdTois3Nd1LU+UIK6iDZLyh4Drlz0PWUwY7zKwq XuvluOCPaGmHv55qPw6DySMRyNWMrgTbIEfGMFHcJ2GzrAxH9BWilUl4fgQ5igcm64M9 ysOg== X-Gm-Message-State: AFqh2kpUbLGpyyRY1PFNEvfmq/TNKewmQJlaq5NIOLoGO1cCx1Iz75zw MXPjvSy8yiIZ9gxk6Sq6JfEnOXA5/x81e/kq X-Google-Smtp-Source: AMrXdXtz19nmTaFd6KPSLYMd5mTgzD7JGUZKZYf4N4XnNTKQ0CH4iQmBOR6l8LEkQBYkPpAq2pP0WQ== X-Received: by 2002:a0c:ee2b:0:b0:4e3:6abf:ddb4 with SMTP id l11-20020a0cee2b000000b004e36abfddb4mr94918094qvs.23.1673669953405; Fri, 13 Jan 2023 20:19:13 -0800 (PST) Received: from localhost.localdomain (dsl-10-149-10.b2b2c.ca. [72.10.149.10]) by smtp.gmail.com with ESMTPSA id br31-20020a05620a461f00b006fa2cc1b0fbsm13770007qkb.11.2023.01.13.20.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 20:19:12 -0800 (PST) From: Maxim Cournoyer Date: Fri, 13 Jan 2023 23:19:02 -0500 Message-Id: <20230114041903.7121-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. --- Changes in v2: - Add false-if-platform-not-found syntax - Use it while evaluating lookup-platform-by-target-or-system gnu/packages/bootstrap.scm | 2 +- guix/platform.scm | 51 ++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index d2914fb5a7..772be7e5e4 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm @@ -315,7 +315,7 @@ (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-exception (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..2e61c6827a 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,11 @@ (define-module (guix platform) platform-linux-architecture platform-glibc-dynamic-linker + &platform-not-found-error + make-platform-not-found-error + platform-not-found-error? + false-if-platform-not-found + platform-modules platforms lookup-platform-by-system @@ -70,6 +76,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 +113,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 04:19:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46108 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 30D2127BBEB; Sat, 14 Jan 2023 04:43:59 +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=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 E4D5F27BBE9 for ; Sat, 14 Jan 2023 04:43:58 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGY1V-0002te-4V; Fri, 13 Jan 2023 23:20:05 -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 1pGY1T-0002sm-Dw for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20: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 1pGY1S-0000Pt-Vf for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGY1S-0000RK-RL for guix-patches@gnu.org; Fri, 13 Jan 2023 23:20:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v2 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 04:20:02 +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: Maxim Cournoyer Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.16736699651634 (code B ref 60802); Sat, 14 Jan 2023 04:20:02 +0000 Received: (at 60802) by debbugs.gnu.org; 14 Jan 2023 04:19:25 +0000 Received: from localhost ([127.0.0.1]:52943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGY0r-0000QI-16 for submit@debbugs.gnu.org; Fri, 13 Jan 2023 23:19:25 -0500 Received: from mail-qv1-f50.google.com ([209.85.219.50]:41908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGY0n-0000Pr-MX for 60802@debbugs.gnu.org; Fri, 13 Jan 2023 23:19:22 -0500 Received: by mail-qv1-f50.google.com with SMTP id d13so16094925qvj.8 for <60802@debbugs.gnu.org>; Fri, 13 Jan 2023 20:19:21 -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=XDQwqoq3u6PhiVdtcMXqJ4nKV1i9V8Qog5sy9boRPkEd0Jc2S4SD6RODm74rLfo0U2 b0sj7rwBtwsNrXlTv2KUopoOzIBX1dOiPusUpnm5cnisIV57o0C81lKDwdY175S/MlzF LBYPWQVS72XMVazOUxUtKMuzMJx4N8ZTHaha0mJDksGjX/pqZNJD6iFG+rAycbpKGnA8 Nvp/jjVK2ACHiPxSW0w75UR9Bab/2PGlCT9iIu+/PfkZlByT0omrVxduE7HS7tpfxQ9H dQqhn7WVlS4b3WyHLvTG4ZXUhQsCAgjp9IO4aBWDwz8FQsP0z1mVFAdE7KApW4Ni4+Sj uT8A== 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=aS+reCkpysDM42/G1VgN4ECuCBhaNAvG9OPygcKDNwyuYYX2z/fBE9YfwGUVDfOTvA CkH7f0MyXysQanzULJG+3+P7Dtz+X7hpfZ6EOSNRzdffDR+MHqC/3VdtE97Eb0ed6+bb glF9mkXe4BMXwzSGBbKW2H3uglvUrLRys/ObSNqNYlkjiNPxEmleFKZt3ljCzF9oDLkd HOJRBX8hz2BCpNk5vaooEdiAyjHNP/31L2bO4O+CX7otqZLaBk2hzzVt/pM16kFN1IID FWIkbuM/1HdeCI+GKr4NiBfGEuwLsHQsuFipPeBBBXL4VRzDg5fxLm94Y6xLgaXHh2+V WTtA== X-Gm-Message-State: AFqh2kpw2IYRsqaecC5JGvwA/9XXfXiSu5+f50VXl5fJ85SKFekMYUtD w+rcnH0PsTH6ObzllFo8E6BCWTcObsqnuJpu X-Google-Smtp-Source: AMrXdXs59mUWGui/ZjNehbDjlCT5z5p1b5VraptphOPBIHmZK4USt63M9SMhTyCbpv1w4BaWv8yqEQ== X-Received: by 2002:a05:6214:5bc2:b0:530:b17f:48c7 with SMTP id lr2-20020a0562145bc200b00530b17f48c7mr116083815qvb.45.1673669956095; Fri, 13 Jan 2023 20:19:16 -0800 (PST) Received: from localhost.localdomain (dsl-10-149-10.b2b2c.ca. [72.10.149.10]) by smtp.gmail.com with ESMTPSA id br31-20020a05620a461f00b006fa2cc1b0fbsm13770007qkb.11.2023.01.13.20.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 20:19:15 -0800 (PST) From: Maxim Cournoyer Date: Fri, 13 Jan 2023 23:19:03 -0500 Message-Id: <20230114041903.7121-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230114041903.7121-2-maxim.cournoyer@gmail.com> References: <20230114041903.7121-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"