From patchwork Thu Dec 20 14:44:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: pkill9 X-Patchwork-Id: 503 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 9BC3C169A7; Thu, 20 Dec 2018 14:45:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) by mira.cbaines.net (Postfix) with ESMTP id 25F43169A5 for ; Thu, 20 Dec 2018 14:45:23 +0000 (GMT) Received: from localhost ([::1]:37878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZzZi-0002gL-L3 for patchwork@mira.cbaines.net; Thu, 20 Dec 2018 09:45:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZzZS-0002Yt-IT for guix-patches@gnu.org; Thu, 20 Dec 2018 09:45:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZzZP-0004gr-Ch for guix-patches@gnu.org; Thu, 20 Dec 2018 09:45:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:51367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZzZP-0004gW-7Y for guix-patches@gnu.org; Thu, 20 Dec 2018 09:45:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gZzZO-0003ZR-UV for guix-patches@gnu.org; Thu, 20 Dec 2018 09:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33806] [PATCH] system: 'kernel->boot-label' now accepts inferior packages. References: Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Dec 2018 14:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33806 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "Ludovic =?utf-8?q?Court=C3=A8s?= " Received: via spool by 33806-submit@debbugs.gnu.org id=B33806.154531704913603 (code B ref 33806); Thu, 20 Dec 2018 14:45:02 +0000 Received: (at 33806) by debbugs.gnu.org; 20 Dec 2018 14:44:09 +0000 Received: from localhost ([127.0.0.1]:55625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZzYW-0003XK-VO for submit@debbugs.gnu.org; Thu, 20 Dec 2018 09:44:09 -0500 Received: from aibo.runbox.com ([91.220.196.211]:46898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gZzYU-0003XB-R7 for 33806@debbugs.gnu.org; Thu, 20 Dec 2018 09:44:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Message-Id:Content-Type:In-Reply-To:Date:Subject:CC:To:From :MIME-Version; bh=Q9VN6CIRX7Kxys727jZG+yE1PV35Gh2QLXh9kaBeSWg=; b=YBc4euNt2TJ JnZK+p7sZ35Xj+8go2kB3Z6tsQAc+1iWykktmiT2TxhudRhjt2wrhNVN8TkbiBd9J96etab4sdyVd 8oO0BmbOAfQh3mM+TX3Ai0l0+jTlOy2bTODoJES4wPJ4Gos2BAJKBYCyqij4PL/KC3dZUXBkfsr7t OoqbDz/yk283w//JcyGzeBES/BnTtXufxJAHA0AOb1KDAlxePTZknJNRzu4H8RAhvC99qqv8nhS0E eI6RKjvwn0bL2deFYD4BsgPp+6n88lhPYsHJtPb2gxRHNm7lq+saylc9Ui9gsrv0cY6Bh0TWNtEWz awojYxhKAu5Z2pDRQE4vNGQ==; Received: from [10.9.9.129] (helo=rmmprod07.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1gZzYT-0000A2-Aq; Thu, 20 Dec 2018 15:44:05 +0100 Received: from mail by rmmprod07.runbox with local (Exim 4.86_2) (envelope-from ) id 1gZzYT-0001d0-AD; Thu, 20 Dec 2018 15:44:05 +0100 MIME-Version: 1.0 Received: from [Authenticated user (850733)] by runbox.com with http (RMM6); Thu, 20 Dec 2018 14:44:05 GMT From: Date: Thu, 20 Dec 2018 14:44:05 +0000 (GMT) X-Mailer: RMM6 In-Reply-To: <87zht1rxjb.fsf@gnu.org> Message-Id: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 33806 <33806@debbugs.gnu.org> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Ok, I've updated the patch, thanks. On Wed, 19 Dec 2018 22:56:08 +0100, Ludovic Courtès wrote: > Hello, > > skribis: > > > From 6c0bbaa0a73f4c6043211df6af100877dc9a4094 Mon Sep 17 00:00:00 2001 > > From: Pkill -9 > > Date: Wed, 19 Dec 2018 20:22:20 +0000 > > Subject: [PATCH] system: 'kernel->boot-label' now accepts inferior packages. > > > > * gnu/system.scm (kernel->boot-label): Get package name and version > > using the functions for inferior packages if the kernel is not a > > regular package. > > [...] > > > (define (kernel->boot-label kernel) > > "Return a label for the bootloader menu entry that boots KERNEL." > > - (string-append "GNU with " > > - (string-titlecase (package-name kernel)) " " > > - (package-version kernel) > > - " (beta)")) > > + (if (package? kernel) > > + (string-append "GNU with " > > + (string-titlecase (package-name kernel)) " " > > + (package-version kernel) > > + " (beta)") > > + (string-append "GNU with " > > + (string-titlecase (inferior-package-name kernel)) > > + (inferior-package-version kernel) > > + " (beta)"))) > > I’d suggest writing it as: > > (cond ((package? kernel) …) > ((inferior-package? kernel) …) > (else "GNU")) > > Could you send an updated patch? > > Of course this is also where we start wondering whether and > should simply inherit from a common class of which > ‘package-name’ would be a method… > > In this case I think it’s OK to do things this way, especially because > the kernel could also be a non-package file-like object. > > Thanks, > Ludo’. From 0e86c0708f3aa0eb35a9fc3c9ef89dcb210bac3f Mon Sep 17 00:00:00 2001 From: Pkill -9 Date: Wed, 19 Dec 2018 20:22:20 +0000 Subject: [PATCH] system: 'kernel->boot-label' now accepts inferior packages. * gnu/system.scm (kernel->boot-label): Get package name and version using the functions for inferior packages if the kernel is an inferior package. Return "GNU" if the kernel is not a package. --- gnu/system.scm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index a5a8f40d6..0c296bc9a 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -21,6 +21,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu system) + #:use-module (guix inferior) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix gexp) @@ -905,10 +906,17 @@ listed in OS. The C library expects to find it under (define (kernel->boot-label kernel) "Return a label for the bootloader menu entry that boots KERNEL." - (string-append "GNU with " - (string-titlecase (package-name kernel)) " " - (package-version kernel) - " (beta)")) + (cond ((package? kernel) + (string-append "GNU with " + (string-titlecase (package-name kernel)) " " + (package-version kernel) + " (beta)")) + ((inferior-package? kernel) + (string-append "GNU with " + (string-titlecase (inferior-package-name kernel)) + (inferior-package-version kernel) + " (beta)")) + (else "GNU"))) (define (store-file-system file-systems) "Return the file system object among FILE-SYSTEMS that contains the store." -- 2.19.2