From patchwork Tue Jan 17 15:34:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46227 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 5BB2027BBEB; Tue, 17 Jan 2023 15:35:27 +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 9738A27BBE9 for ; Tue, 17 Jan 2023 15:35:24 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHnzU-00032l-N4; Tue, 17 Jan 2023 10:35:12 -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 1pHnzK-00031J-CI for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35: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 1pHnzK-0005d3-3q for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHnzK-0005YA-07 for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v4 1/2] platforms: Raise an exception when no suitable platform is found. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 17 Jan 2023 15:35: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.167396969421298 (code B ref 60802); Tue, 17 Jan 2023 15:35:01 +0000 Received: (at 60802) by debbugs.gnu.org; 17 Jan 2023 15:34:54 +0000 Received: from localhost ([127.0.0.1]:37984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnzB-0005XM-Cx for submit@debbugs.gnu.org; Tue, 17 Jan 2023 10:34:54 -0500 Received: from mail-yw1-f175.google.com ([209.85.128.175]:37813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnz9-0005X1-Vg for 60802@debbugs.gnu.org; Tue, 17 Jan 2023 10:34:52 -0500 Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-4e4a6af2d99so107989117b3.4 for <60802@debbugs.gnu.org>; Tue, 17 Jan 2023 07:34:51 -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=Y4XPlDddqK4NoaX+kNEJ+cMlu2cUdms/s7uZN7IfHe8=; b=nWBY+bthSoRebd3qEoSFWv5iInX/MoycLiHDBo8ODXMNYM7eZIfYnNh1n9UusgU47q bisHzohWNKmRUaS+DmTFq0TFZRpeZdAmyCK8GKAwaSIjwJGaySBBpNbrnOYafBnPVDMx jIlIn7JSn9O0v7ioxVjy7y7zMyM8gC1HYFWshMBDX0/MXaFyKarZ41uAOPO/z3Qw/G4k lEcSRHGpipW6z+v/W3+xI1fPXFl7waI8Ov6v9YIs05IlGjjf0BF8eTpd7cyowItfR8mL eOhJI5Dh/yR8mvYajbSb2qm6k08Y5E5M0yO8AF8d1g2mA/9WFVSRR2pa58hA0J4kuuCQ o3Mw== 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=Y4XPlDddqK4NoaX+kNEJ+cMlu2cUdms/s7uZN7IfHe8=; b=JIdnHTBsNOWpfNK8/HWW8P5MmMzzWnNksBw2OHSbqM62JTwNI9seGPxn+thyihywHu upQkRXSyBorBW3Yzx24Njpdrd1cPuwnUv8tz0+AKitFp37CzCysxtYmsHfSEUZwJzMiP XBAxelQyLHyfKfiJgUGujfzZsgRiuvOvihp+lAkMhmYw689PU+UMaDp+SOliD7P8cBiy sNx9r3W1HvoJ+VbUgTa80DY/+VeEKqChAfa+ssAWZ7OU3gq842XTvSp3awW2Tyi0Sd2Q Vlx9xSDTbYce5ulRWR6thWlb2wmVLDuDlrAHyb3UHx2w3tUjdeyVcv+BHGUtNChH7nd7 0UTQ== X-Gm-Message-State: AFqh2kq0vAzL9e47LaEIZMlId9CgP6XRiyW1vuQTwuHaPCQTcDUgwS6U Reg+g8Foak1iaGnfQwZgWDvYPDRKzmsCA0VK X-Google-Smtp-Source: AMrXdXvRuaqbM4Re9svmHzrXaGRUjL33iozW41hQAHamXFhO+8jxKwCkj60fdbbvq6ZmP65uBUf44Q== X-Received: by 2002:a05:7508:1315:b0:49:d9d4:d7dd with SMTP id cr21-20020a057508131500b00049d9d4d7ddmr117100gbb.12.1673969686141; Tue, 17 Jan 2023 07:34:46 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-125-107.b2b2c.ca. [205.233.125.107]) by smtp.gmail.com with ESMTPSA id dt41-20020a05620a47a900b00705e7daf6f0sm5206505qkb.129.2023.01.17.07.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 07:34:45 -0800 (PST) From: Maxim Cournoyer Date: Tue, 17 Jan 2023 10:34:30 -0500 Message-Id: <20230117153432.23719-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117153432.23719-1-maxim.cournoyer@gmail.com> References: <20230117153432.23719-1-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 This was motivated by #60786, which produced a cryptic, hard to understand backtrace. Given the following reproducer: (use-modules (guix packages) (gnu packages cross-base)) (define linux-libre-headers-cross-mips64el-linux-gnuabi64 (cross-kernel-headers "mips64el-linux-gnuabi64")) (package-arguments linux-libre-headers-cross-mips64el-linux-gnuabi64) Before this change: ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): #f After this change: ice-9/boot-9.scm:1685:16: In procedure raise-exception: ERROR: 1. &platform-not-found-error: "mips64el-linux-gnuabi64" * guix/platform.scm (&platform-not-found-error): New condition. (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 v4: - Use (srfi srfi-35) condition instead of (ice-9 exceptions) - Add a target-or-system field to the condition type for extra information 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 | 55 +++++++++++++++++++++++++++++--------- 2 files changed, 44 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..a2d95ab507 100644 --- a/guix/platform.scm +++ b/guix/platform.scm @@ -22,6 +22,8 @@ (define-module (guix platform) #:use-module (guix records) #:use-module (guix ui) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:export (platform platform? platform-target @@ -29,6 +31,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 +76,20 @@ (define-record-type* platform make-platform (default #false)) (glibc-dynamic-linker platform-glibc-dynamic-linker)) + +;;; +;;; Exceptions. +;;; +(define-condition-type &platform-not-found-error &error + platform-not-found-error? + (target-or-system platform-not-found-error-target-or-system)) + +(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 +114,32 @@ (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 (condition (&platform-not-found-error + (target-or-system system)))))) (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 (condition (&platform-not-found-error + (target-or-system target)))))) (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 (condition (&platform-not-found-error + (target-or-system target-or-system)))))) (define (platform-system->target system) "Return the target matching the given SYSTEM if it exists or false From patchwork Tue Jan 17 15:34:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 46228 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 0346D27BBEB; Tue, 17 Jan 2023 15:35:42 +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 00B8227BBE9 for ; Tue, 17 Jan 2023 15:35:41 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHnzQ-000324-Gn; Tue, 17 Jan 2023 10:35: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 1pHnzK-00031K-Q2 for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35: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 1pHnzK-0005dA-HZ for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHnzK-0005YI-Cy for guix-patches@gnu.org; Tue, 17 Jan 2023 10:35:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60802] [PATCH v4 2/2] gnu: Remove u-boot-malta. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 17 Jan 2023 15:35: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: ludo@gnu.org, Maxim Cournoyer Received: via spool by 60802-submit@debbugs.gnu.org id=B60802.167396969821314 (code B ref 60802); Tue, 17 Jan 2023 15:35:02 +0000 Received: (at 60802) by debbugs.gnu.org; 17 Jan 2023 15:34:58 +0000 Received: from localhost ([127.0.0.1]:37987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnzG-0005Xi-1k for submit@debbugs.gnu.org; Tue, 17 Jan 2023 10:34:58 -0500 Received: from mail-qv1-f53.google.com ([209.85.219.53]:39584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnzB-0005X3-Cp for 60802@debbugs.gnu.org; Tue, 17 Jan 2023 10:34:54 -0500 Received: by mail-qv1-f53.google.com with SMTP id g10so16312442qvo.6 for <60802@debbugs.gnu.org>; Tue, 17 Jan 2023 07:34:53 -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=E6OkwiHpxDItIROTTHIO52pnq2ZQ5ZY22lYpjcd3hIfKCupSlTM8dER+2FaxgK8Dck Kl804gtYanUPaquJ6h0vXa+Uj2nxUVNlmI0mzkg+PnIr3haoOP2cUvt6aNlW0ZGPXSt9 kaMue6OIwd1VQi3jDAMMCX4QqxEIGnbF2GeJmYd3XZEMWegTyAhTWMHvP3HT4K9s1tMa ogjRmxP9wQ+WuXFOBW5vaWNB+w5RLsKeKirpIV6jiPD6XFNM6C8armU9kXGqQPtH/A0M Yd8bYDIPQuv3pesReiotGSzakY7E0jsrw8V/0wHdmdYJEA993o068b1u8jU8TiyBxCw3 BxCA== 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=RxBYIWeW1y8HmxxreSx+tFuVmcM5U4FxkK26+GM26UhGbyvNw2xi+X41/O1lg3Mrsw 1jeFV34SEpypjgZsdCCPnDtSnAnmGerr+42KTdJg9MH4Gyynk+tHjzkxevdIuEK3SqWP UaVE/5WaYqFdFIQmttJVsm6iHD84PSfdt2VUT931S84dBYuBodFColC4Oyl19Y23ORa2 AElVJadznl9vzNL5o64H181Y4SsIeMHLNn1V8y4wAuSEwhwUqBKa53vKHw/egFfVxPm9 P2LgNJW1BSjPPJqi2o44cL78U3vpr+HOjI1lurmDXWPyPf5J0pygGnRJO8Nu+BQdt2di aWFw== X-Gm-Message-State: AFqh2kpeTnO+vTzULHDQr4nICXRb+QV+8DwM0tavzc4DiRHLmZRnATmi SYn93D/fUPzRN/1wSJlQyXa2pGjOymtjhCVZ X-Google-Smtp-Source: AMrXdXuua3ixJD6auCcherdOapJuf0Njin5ke7IiPC19O7dQ5tQxk/KkVY2nhe9YF8LHbOpv0qKBBw== X-Received: by 2002:a05:6214:5d11:b0:531:bfaf:cf8d with SMTP id me17-20020a0562145d1100b00531bfafcf8dmr5307943qvb.3.1673969687599; Tue, 17 Jan 2023 07:34:47 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-125-107.b2b2c.ca. [205.233.125.107]) by smtp.gmail.com with ESMTPSA id dt41-20020a05620a47a900b00705e7daf6f0sm5206505qkb.129.2023.01.17.07.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 07:34:47 -0800 (PST) From: Maxim Cournoyer Date: Tue, 17 Jan 2023 10:34:31 -0500 Message-Id: <20230117153432.23719-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117153432.23719-1-maxim.cournoyer@gmail.com> References: <20230117153432.23719-1-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"