diff mbox series

[bug#47615,7/9] build: qemu-command: Add support for powerpc.

Message ID 9f9bc5d3686731bf30c72c821f0b5a54c66843aa.1617711307.git.efraim@flashner.co.il
State Accepted
Headers show
Series Add 32-bit powerpc support | expand

Checks

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

Commit Message

Efraim Flashner April 6, 2021, 12:32 p.m. UTC
* gnu/build/vm.scm (qemu-command): Add missing case for powerpc.
---
 gnu/build/vm.scm | 1 +
 1 file changed, 1 insertion(+)

Comments

Vincent Legoll April 6, 2021, 5:02 p.m. UTC | #1
Hello,

On Tue, Apr 6, 2021 at 2:44 PM Efraim Flashner <efraim@flashner.co.il> wrote:
> +                    ((string-match "powerpc" cpu) "ppc")

Won't there be some "powerpc64le" conflict here ?
Efraim Flashner April 6, 2021, 7:17 p.m. UTC | #2
On Tue, Apr 06, 2021 at 07:02:47PM +0200, Vincent Legoll wrote:
> Hello,
> 
> On Tue, Apr 6, 2021 at 2:44 PM Efraim Flashner <efraim@flashner.co.il> wrote:
> > +                    ((string-match "powerpc" cpu) "ppc")
> 
> Won't there be some "powerpc64le" conflict here ?
> 

I thought not, but it appears it would match all of powerpc*

(ins)scheme@(guile-user)> (use-modules (ice-9 regex))
(ins)scheme@(guile-user)> (string-match "powerpc" "powerpc")
$1 = #("powerpc" (0 . 7))
(ins)scheme@(guile-user)> (string-match "powerpc" "powerpc64le")
$2 = #("powerpc64le" (0 . 7))
(ins)scheme@(guile-user)> (string-match "powerpc" "armhf")
$3 = #f

If it were string=? then it would be fine, but that would break the
^i[3456]86$ regex. It looks like I would need to add a powerpc64 case
above the powerpc case. Looking at the output of qemu adding
((string-match "powerpc64" cpu) "ppc64") would be the right answer.
Vincent Legoll April 6, 2021, 10:27 p.m. UTC | #3
On Tue, Apr 6, 2021 at 9:18 PM Efraim Flashner <efraim@flashner.co.il> wrote:
>
> On Tue, Apr 06, 2021 at 07:02:47PM +0200, Vincent Legoll wrote:
> > Hello,
> >
> > On Tue, Apr 6, 2021 at 2:44 PM Efraim Flashner <efraim@flashner.co.il> wrote:
> > > +                    ((string-match "powerpc" cpu) "ppc")
> >
> > Won't there be some "powerpc64le" conflict here ?
> >
>
> I thought not, but it appears it would match all of powerpc*
>
> (ins)scheme@(guile-user)> (use-modules (ice-9 regex))
> (ins)scheme@(guile-user)> (string-match "powerpc" "powerpc")
> $1 = #("powerpc" (0 . 7))
> (ins)scheme@(guile-user)> (string-match "powerpc" "powerpc64le")
> $2 = #("powerpc64le" (0 . 7))
> (ins)scheme@(guile-user)> (string-match "powerpc" "armhf")
> $3 = #f
>
> If it were string=? then it would be fine, but that would break the
> ^i[3456]86$ regex. It looks like I would need to add a powerpc64 case
> above the powerpc case. Looking at the output of qemu adding
> ((string-match "powerpc64" cpu) "ppc64") would be the right answer.

or you can use anchored regex, like in the x86 case:

((string-match "^powerpc$" cpu) "ppc")
diff mbox series

Patch

diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 253d9bcd31..a2c2d79bb9 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -75,6 +75,7 @@ 
                    (cond
                     ((string-match "^i[3456]86$" cpu) "i386")
                     ((string-match "armhf" cpu) "arm")
+                    ((string-match "powerpc" cpu) "ppc")
                     (else cpu)))))
 
 (define* (load-in-linux-vm builder