unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: <pkill9@runbox.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 33806 <33806@debbugs.gnu.org>
Subject: [bug#33806] [PATCH] system: 'kernel->boot-label' now accepts inferior packages.
Date: Thu, 20 Dec 2018 14:44:05 +0000 (GMT)	[thread overview]
Message-ID: <E1gZzYT-0001d0-AD@rmmprod07.runbox> (raw)
In-Reply-To: <87zht1rxjb.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1895 bytes --]

Ok, I've updated the patch, thanks.


On Wed, 19 Dec 2018 22:56:08 +0100, Ludovic Courtès <ludo@gnu.org> wrote:

> Hello,
> 
> <pkill9@runbox.com> skribis:
> 
> > From 6c0bbaa0a73f4c6043211df6af100877dc9a4094 Mon Sep 17 00:00:00 2001
> > From: Pkill -9 <pkill9@runbox.com>
> > 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 <package> and
> <inferior-package> 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’.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-kernel-boot-label-now-accepts-inferior-packag.patch --]
[-- Type: text/x-patch; name="0001-system-kernel-boot-label-now-accepts-inferior-packag.patch", Size: 1860 bytes --]

From 0e86c0708f3aa0eb35a9fc3c9ef89dcb210bac3f Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
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 <http://www.gnu.org/licenses/>.
 
 (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


  reply	other threads:[~2018-12-20 14:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19 20:42 [bug#33806] [PATCH] system: 'kernel->boot-label' now accepts inferior packages pkill9
2018-12-19 21:56 ` Ludovic Courtès
2018-12-20 14:44   ` pkill9 [this message]
2018-12-21 15:20     ` bug#33806: " Ludovic Courtès
2018-12-24 20:04       ` [bug#33806] " pkill9
2018-12-26 16:22         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1gZzYT-0001d0-AD@rmmprod07.runbox \
    --to=pkill9@runbox.com \
    --cc=33806@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).