GNU bug report logs - #45021
[PATCH 1/2] image: Add system field.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <othacehe <at> gnu.org>

Date: Thu, 3 Dec 2020 10:55:03 UTC

Severity: normal

Tags: patch

Merged with 45020, 45022

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45021 in the body.
You can then email your comments to 45021 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#45021; Package guix-patches. (Thu, 03 Dec 2020 10:55:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <othacehe <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 03 Dec 2020 10:55:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: dannym <at> scratchpost.org, Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH 1/2] image: Add system field.
Date: Thu,  3 Dec 2020 11:53:52 +0100
* gnu/image.scm (<system>): New field.
* gnu/system/image.scm (arm32-disk-image, arm64-disk-image): Set the system
field.
(system-image): Do not try to cross-compile if we are running on the
appropriate system.
* gnu/system/images/hurd.scm (hurd-disk-image): Set the system field.
---
 gnu/image.scm              |  3 +++
 gnu/system/image.scm       | 12 +++++++++++-
 gnu/system/images/hurd.scm |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/image.scm b/gnu/image.scm
index a60d83b175..a56710d540 100644
--- a/gnu/image.scm
+++ b/gnu/image.scm
@@ -33,6 +33,7 @@
             image
             image-name
             image-format
+            image-system
             image-target
             image-size
             image-operating-system
@@ -77,6 +78,8 @@
   (name               image-name ;symbol
                       (default #f))
   (format             image-format) ;symbol
+  (system             image-system
+                      (default #f))
   (target             image-target
                       (default #f))
   (size               image-size  ;size in bytes as integer
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 4972d9067b..f3d5734381 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -131,6 +131,7 @@
 (define arm32-disk-image
   (image
    (format 'disk-image)
+   (system "armhf-linux")
    (target "arm-linux-gnueabihf")
    (partitions
     (list (partition
@@ -143,6 +144,7 @@
 (define arm64-disk-image
   (image
    (inherit arm32-disk-image)
+   (system "aarch64-linux")
    (target "aarch64-linux-gnu")))
 
 
@@ -613,7 +615,15 @@ it can be used for bootloading."
   "Return the derivation of IMAGE.  It can be a raw disk-image or an ISO9660
 image, depending on IMAGE format."
   (define substitutable? (image-substitutable? image))
-  (define target (image-target image))
+
+  ;; The image definition may provide the appropriate "system" architecture
+  ;; for the image.  If we are already running on this system, the image can
+  ;; be built natively.  If we are running on a different system, then we need
+  ;; to cross-compile, using the "target" provided by the image definition.
+  (define system (image-system image))
+  (define target (if (eq? system (%current-system))
+                     #f
+                     (image-target image)))
 
   (with-parameters ((%current-target-system target))
     (let* ((os (operating-system-for-image image))
diff --git a/gnu/system/images/hurd.scm b/gnu/system/images/hurd.scm
index 4417952c5d..6e7dbaa7a7 100644
--- a/gnu/system/images/hurd.scm
+++ b/gnu/system/images/hurd.scm
@@ -75,6 +75,7 @@
 (define hurd-disk-image
   (image
    (format 'disk-image)
+   (system "i586-gnu")
    (target "i586-pc-gnu")
    (partitions
     (list (partition
-- 
2.29.2





Merged 45020 45021. Request was from Mathieu Othacehe <mathieu <at> cervin.i-did-not-set--mail-host-address--so-tickle-me> to control <at> debbugs.gnu.org. (Thu, 03 Dec 2020 10:59:02 GMT) Full text and rfc822 format available.

Merged 45020 45021 45022. Request was from Mathieu Othacehe <mathieu <at> cervin.i-did-not-set--mail-host-address--so-tickle-me> to control <at> debbugs.gnu.org. (Thu, 03 Dec 2020 10:59:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#45021; Package guix-patches. (Thu, 03 Dec 2020 20:42:01 GMT) Full text and rfc822 format available.

Message #12 received at 45021 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 45021 <at> debbugs.gnu.org
Subject: Re: [PATCH 1/2] image: Add system field.
Date: Thu, 3 Dec 2020 21:41:30 +0100
[Message part 1 (text/plain, inline)]
Hi Mathieu,

On Thu,  3 Dec 2020 11:53:52 +0100
Mathieu Othacehe <othacehe <at> gnu.org> wrote:

> diff --git a/gnu/image.scm b/gnu/image.scm
> index a60d83b175..a56710d540 100644
> --- a/gnu/image.scm
> +++ b/gnu/image.scm
> @@ -33,6 +33,7 @@
>              image
>              image-name
>              image-format
> +            image-system
>              image-target
>              image-size
>              image-operating-system
> @@ -613,7 +615,15 @@ it can be used for bootloading."
>    "Return the derivation of IMAGE.  It can be a raw disk-image or an ISO9660
>  image, depending on IMAGE format."
>    (define substitutable? (image-substitutable? image))
> -  (define target (image-target image))
> +
> +  ;; The image definition may provide the appropriate "system" architecture
> +  ;; for the image.  If we are already running on this system, the image can
> +  ;; be built natively.  If we are running on a different system, then we need
> +  ;; to cross-compile, using the "target" provided by the image definition.
> +  (define system (image-system image))
> +  (define target (if (eq? system (%current-system))

Should be string=? instead of eq?, otherwise it downloads a cross compiler
for armhf on armhf.

With that change, I tested this patchset on armhf--works fine then.

LGTM!
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#45021; Package guix-patches. (Fri, 04 Dec 2020 08:13:01 GMT) Full text and rfc822 format available.

Message #15 received at 45021 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 45021 <at> debbugs.gnu.org
Subject: Re: [PATCH 1/2] image: Add system field.
Date: Fri, 04 Dec 2020 09:12:13 +0100
Hey Danny,

> Should be string=? instead of eq?, otherwise it downloads a cross compiler
> for armhf on armhf.

I used "eq?" because if "system" is left to its default in some image
definition, then we would end-up comparing "#f" and a string.

> With that change, I tested this patchset on armhf--works fine then.

Thanks for testing!

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#45021; Package guix-patches. (Fri, 04 Dec 2020 09:02:01 GMT) Full text and rfc822 format available.

Message #18 received at 45021 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 45021 <at> debbugs.gnu.org
Subject: Re: [PATCH 1/2] image: Add system field.
Date: Fri, 4 Dec 2020 10:01:10 +0100
[Message part 1 (text/plain, inline)]
Hi Mathieu,

On Fri, 04 Dec 2020 09:12:13 +0100
Mathieu Othacehe <othacehe <at> gnu.org> wrote:

> I used "eq?" because if "system" is left to its default in some image
> definition, then we would end-up comparing "#f" and a string.

Yeah, but eq? only compares the "addresses" of things, not the content.

(eq? "a" "a") could totally be #f if one is unlucky.

For example try:

(eq? "a" (read))

and enter "a".  The result will be #f.

On the other hand, (equal? "a" "a") would work; also (equal? "a" #f) would
not fail.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#45021; Package guix-patches. (Sat, 05 Dec 2020 10:25:02 GMT) Full text and rfc822 format available.

Message #21 received at 45021 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 45021 <at> debbugs.gnu.org
Subject: Re: [PATCH 1/2] image: Add system field.
Date: Sat, 05 Dec 2020 11:24:22 +0100
Hey Danny,

> On the other hand, (equal? "a" "a") would work; also (equal? "a" #f) would
> not fail.

Oh you're right, I always get confused with those equality procedures even
after all these years. I'll fix it before pushing.

Thanks,

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 08 Nov 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.