[PATCH] system: 'kernel->boot-label' now accepts inferior packages.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • pkill9
Owner
unassigned
Submitted by
pkill9
Severity
normal

Debbugs page

pkill9 wrote 6 years ago
(name . guix-patches)(address . guix-patches@gnu.org)
E1gZig9-0005Q1-Me@rmmprod05.runbox
I modified the 'kernel->boot-label' function in gnu/system.scm to check if the kernel passed to it is a regular package, and if it isn't then it will try to get the package name and version using 'inferior-package-name' and 'inferior-package-version'.

Note: I wasn't sure if the hack at the beginning of this patch was neccessary and I didn't add it: http://git.savannah.gnu.org/cgit/guix.git/commit/?id=811b21fb15d36b06fde994ca7ef5916a9a19f250
```
(define inferiors-loaded?
;; This hack allows us to provide seamless integration for inferior
;; packages while not having a hard dependency on (guix inferior).
(resolve-module '(guix inferior) #f #f #:ensure #f))

(define (inferior->entry)
(module-ref (resolve-interface '(guix inferior))
'inferior-package->manifest-entry))
```

This is the only issue preventing using an inferior package as a kernel, which is very useful as it means you can avoid recompiling a custom kernel when you reconfigure the system with a newer guix revision that changes the kernel package dependencies.
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.
---
gnu/system.scm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index a5a8f40d6..afe39278d 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,15 @@ 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)"))
+ (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)")))
(define (store-file-system file-systems)
"Return the file system object among FILE-SYSTEMS that contains the store."
--
2.19.2
Ludovic Courtès wrote 6 years ago
(address . pkill9@runbox.com)(address . 33806@debbugs.gnu.org)
87zht1rxjb.fsf@gnu.org
Hello,

<pkill9@runbox.com> skribis:

Toggle quote (9 lines)
> 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.

[...]

Toggle quote (16 lines)
> (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’.
pkill9 wrote 6 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(name . 33806)(address . 33806@debbugs.gnu.org)
E1gZzYT-0001d0-AD@rmmprod07.runbox
Ok, I've updated the patch, thanks.


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

Toggle quote (48 lines)
> 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’.
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(-)

Toggle diff (36 lines)
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
Ludovic Courtès wrote 6 years ago
(address . pkill9@runbox.com)(name . 33806)(address . 33806-done@debbugs.gnu.org)
8736qqq53p.fsf@gnu.org
Hi,

<pkill9@runbox.com> skribis:

Toggle quote (9 lines)
> 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.

I adjusted the indentation and applied. Thank you!

Ludo’.
Closed
pkill9 wrote 6 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(name . 33806)(address . 33806-done@debbugs.gnu.org)
E1gbWST-0005LO-0u@rmmprod07.runbox
I forgot to add a space between the inferior's package name and package version, I've attached a patch that fixes this.

On Fri, 21 Dec 2018 16:20:10 +0100, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (16 lines)
> Hi,
>
> <pkill9@runbox.com> skribis:
>
> > 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.
>
> I adjusted the indentation and applied. Thank you!
>
> Ludo’.
From c1525fa51129f00133f108c020cc27af34f08d0e Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Mon, 24 Dec 2018 19:52:59 +0000
Subject: [PATCH] system: Fix missing space in boot labels for kernels that are
inferior packages

* gnu/system.scm (kernel->boot-label): Add a missing space between
the kernel's package name and package version for inferior packages.
---
gnu/system.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index 146af7cf0..ee48f4826 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -913,7 +913,7 @@ listed in OS. The C library expects to find it under
" (beta)"))
((inferior-package? kernel)
(string-append "GNU with "
- (string-titlecase (inferior-package-name kernel))
+ (string-titlecase (inferior-package-name kernel)) " "
(inferior-package-version kernel)
" (beta)"))
(else "GNU")))
--
2.20.1
Closed
Ludovic Courtès wrote 6 years ago
(address . pkill9@runbox.com)(name . 33806)(address . 33806-done@debbugs.gnu.org)
87tvj0cl72.fsf@gnu.org
<pkill9@runbox.com> skribis:

Toggle quote (9 lines)
> From c1525fa51129f00133f108c020cc27af34f08d0e Mon Sep 17 00:00:00 2001
> From: Pkill -9 <pkill9@runbox.com>
> Date: Mon, 24 Dec 2018 19:52:59 +0000
> Subject: [PATCH] system: Fix missing space in boot labels for kernels that are
> inferior packages
>
> * gnu/system.scm (kernel->boot-label): Add a missing space between
> the kernel's package name and package version for inferior packages.

Applied, thanks!
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 33806@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 33806
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help