GNU bug report logs - #26341
[PATCH] build: vm: Add missing module.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Sun, 2 Apr 2017 15:03:01 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 26341 <at> debbugs.gnu.org
Subject: bug#26341: [PATCH 1/5] build: syscalls: Add reboot.
Date: Mon, 10 Apr 2017 11:42:16 +0200
Hi Mathieu,

Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> * guix/build/syscalls.scm (static-or-ffi): New macro. Used to dispatch between
>   static Guile core implementation and FFI version.
> (reboot): New export procedure. Reimplemented from guile-linux-syscalls.patch.
> (RB_AUTOBOOT, ..., RB_KEXEC): New exported flags replacing static Guile flags.

[...]

> +  #:replace (RB_AUTOBOOT
> +             RB_HALT_SYSTEM
> +             RB_ENABLED_CAD
> +             RB_DISABLE_CAD
> +             RB_POWER_OFF
> +             RB_SW_SUSPEND
> +             RB_KEXEC
> +             reboot))

The problem is that we cannot #:replace unconditionally (when not using
the patched Guile, there’s nothing to replace¹).

So perhaps we should remove #:export, #:replace, and #:re-export for
‘mount’ & co, and instead have a macro like this:

  (define-syntax define-as-needed
    (syntax-rules ()
      "Define VARIABLE.  If VARIABLE already exists in (guile) then re-export it,
  otherwise export the newly-defined VARIABLE."
      ((_ (proc args ...) body ...)
       (define-as-needed proc (lambda (args ...) body ...)))
      ((_ variable value)
       (begin
         (when (module-defined? the-scm-module 'variable)
           (re-export variable))

         (define variable
           (if (module-defined? the-scm-module 'variable)
               (module-ref the-scm-module 'variable)
               value))

         (unless (module-defined? the-scm-module 'variable)
           (export variable))))))

  (define-as-needed RB_AUTOBOOT #x123)
  (define-as-needed (mount foo bar)
    'baz)

WDYT?

Sorry that this simple thing ends up being complicated!  ;-)

Thank you,
Ludo’.

¹ In practice #:replace works even when there’s nothing to replace, but
  I’d rather not rely on it.




This bug report was last modified 8 years and 44 days ago.

Previous Next


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