From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxVql-0006EL-5l for guix-patches@gnu.org; Mon, 10 Apr 2017 05:43:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxVqg-0004tk-9R for guix-patches@gnu.org; Mon, 10 Apr 2017 05:43:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:42361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cxVqg-0004tg-5u for guix-patches@gnu.org; Mon, 10 Apr 2017 05:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cxVqf-0000jy-Uy for guix-patches@gnu.org; Mon, 10 Apr 2017 05:43:01 -0400 Subject: bug#26341: [PATCH 1/5] build: syscalls: Add reboot. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170408160329.4068-1-m.othacehe@gmail.com> <20170408160329.4068-2-m.othacehe@gmail.com> Date: Mon, 10 Apr 2017 11:42:16 +0200 In-Reply-To: <20170408160329.4068-2-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Sat, 8 Apr 2017 18:03:25 +0200") Message-ID: <87lgr8fvk7.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Mathieu Othacehe Cc: 26341@debbugs.gnu.org Hi Mathieu, Mathieu Othacehe skribis: > * guix/build/syscalls.scm (static-or-ffi): New macro. Used to dispatch be= tween > static Guile core implementation and FFI version. > (reboot): New export procedure. Reimplemented from guile-linux-syscalls.p= atch. > (RB_AUTOBOOT, ..., RB_KEXEC): New exported flags replacing static Guile f= lags. [...] > + #: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=E2=80=99s nothing to replace=C2=B9). So perhaps we should remove #:export, #:replace, and #:re-export for =E2=80=98mount=E2=80=99 & 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-expo= rt 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=E2=80=99. =C2=B9 In practice #:replace works even when there=E2=80=99s nothing to rep= lace, but I=E2=80=99d rather not rely on it.