diff mbox series

[bug#41350,v3,2/3] system: vm: Do not register-closures when cross-building to the Hurd.

Message ID 20200523093017.12149-2-janneke@gnu.org
State New
Headers show
Series [bug#41350,v3,1/3] utils: Move 'reset-timestamps' out of database. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Jan Nieuwenhuizen May 23, 2020, 9:30 a.m. UTC
This supports cross-building building a vm-image for the Hurd, running a
native qemu.

* gnu/system/vm.scm (qemu-image)[register-closures?]: Default to #f when
cross-compiling to the Hurd.  Only create sql-schema when actually registering
closures.
---
 gnu/build/vm.scm  | 9 ++++++++-
 gnu/system/vm.scm | 9 ++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Ludovic Courtès May 27, 2020, 8:45 a.m. UTC | #1
"Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:

> This supports cross-building building a vm-image for the Hurd, running a
> native qemu.
>
> * gnu/system/vm.scm (qemu-image)[register-closures?]: Default to #f when
> cross-compiling to the Hurd.  Only create sql-schema when actually registering
> closures.

[...]

> -                     (register-closures? (has-guix-service-type? os))
> +                     (register-closures? (and (has-guix-service-type? os)
> +                                              (not (hurd-target?))))

What’s the problem here?  (Sorry if I missed earlier discussions!)

Intuitively, I think there shouldn’t be system-specific bits here:
registering closures has nothing to do with the OS we’re targeting.

Thanks,
Ludo’.
Jan Nieuwenhuizen May 27, 2020, 9:13 a.m. UTC | #2
Ludovic Courtès writes:

> "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> skribis:
>
>> This supports cross-building building a vm-image for the Hurd, running a
>> native qemu.
>>
>> * gnu/system/vm.scm (qemu-image)[register-closures?]: Default to #f when
>> cross-compiling to the Hurd.  Only create sql-schema when actually registering
>> closures.
>
> [...]
>
>> -                     (register-closures? (has-guix-service-type? os))
>> +                     (register-closures? (and (has-guix-service-type? os)
>> +                                              (not (hurd-target?))))
>
> What’s the problem here?  (Sorry if I missed earlier discussions!)

register-closures is being done inside the VM and needs sqlite, which we
don't have because it's for the wrong architecture.  So as long as we
avoid sqlite, we can cross-build a working VM.

> Intuitively, I think there shouldn’t be system-specific bits here:
> registering closures has nothing to do with the OS we’re targeting.

True...but currently Hurd is the only image that we are trying to build
in this weird way, i.e., using a native qemu!  Other cross-builds of
vm-images are done using qemu-TARGET, only for the Hurd that does
not work.

Greetings,
Janneke
diff mbox series

Patch

diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index c751e6b0e2..a1b193134a 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -27,7 +27,14 @@ 
   #:use-module (guix build store-copy)
   #:use-module (guix build syscalls)
   #:use-module ((guix utils) #:select (reset-timestamps))
-  #:use-module (guix store database)
+  #:autoload (guix store database) (sql-schema ;must list all exported symbols
+                                    %default-database-file
+                                    with-database
+                                    path-id
+                                    sqlite-register
+                                    register-path
+                                    register-items
+                                    %epoch)
   #:use-module (gnu build bootloader)
   #:use-module (gnu build linux-boot)
   #:use-module (gnu build install)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3e483fd86c..b343141c18 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -51,6 +51,7 @@ 
   #:use-module (gnu packages zile)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages hurd)
 
   #:use-module (gnu bootloader)
   #:use-module (gnu bootloader grub)
@@ -286,7 +287,8 @@  substitutable."
                      os
                      bootcfg-drv
                      bootloader
-                     (register-closures? (has-guix-service-type? os))
+                     (register-closures? (and (has-guix-service-type? os)
+                                              (not (hurd-target?))))
                      (inputs '())
                      copy-inputs?
                      (substitutable? #t))
@@ -333,12 +335,13 @@  system that is passed to 'populate-root-file-system'."
                         ((gnu build linux-boot)
                          #:select (make-essential-device-nodes
                                    make-hurd-device-nodes))
-                        (guix store database)
                         (guix build utils)
                         (srfi srfi-26)
                         (ice-9 binary-ports))
 
-           (sql-schema #$schema)
+           (when #$register-closures?
+             (use-modules (guix store database))
+             (sql-schema #$schema))
 
            ;; Allow non-ASCII file names--e.g., 'nss-certs'--to be decoded.
            (setenv "GUIX_LOCPATH"