From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 07/17] gnu: linux-libre: Use make-linux-libre. Date: Sun, 11 Sep 2016 23:07:50 +0200 Message-ID: <87a8fei1qx.fsf@gnu.org> References: <20160909013641.GA9202@jasmine> <20160909123426.18499-1-david@craven.ch> <20160909123426.18499-7-david@craven.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjByp-0001DT-Rm for guix-devel@gnu.org; Sun, 11 Sep 2016 17:08:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjByk-00024X-Ho for guix-devel@gnu.org; Sun, 11 Sep 2016 17:07:58 -0400 In-Reply-To: <20160909123426.18499-7-david@craven.ch> (David Craven's message of "Fri, 9 Sep 2016 14:34:16 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: David Craven Cc: guix-devel@gnu.org David Craven skribis: > * gnu/packages/linux.scm (linux-libre, linux-libre-4.4, > linux-libre-4.1): Use make-linux-libre. > (make-linux-libre): New variable. [...] > +(define-public linux-libre > + (let* ((version "4.7.2") > + (conf (kernel-config > + (or (%current-target-system) > + (%current-system)) > + #:variant (version-major+minor version)))) I just realized that this won=E2=80=99t do what we want. The expression (or (%current-target-system) (%current-system)) is evaluated at the top-level=E2=80=94i.e., when (gnu packages linux) is loade= d. At that time, (%current-system) holds its default value and (%current-target-system) is #f. IOW, even if you do: guix build -s foo linux-libre or: guix build --target=3Dbar linux-libre you always end up with the x86_64-linux kernel config (if you=E2=80=99re on x86_64-linux). Conversely, when we write: (package ;; =E2=80=A6 (inputs `(("conf" ,(kernel-config (or (%current-target-system) =E2=80=A6)))))) things work as expected because the =E2=80=98inputs=E2=80=99 field is =E2= =80=9Cthunked=E2=80=9D (lazy-evaluated) specifically for this purpose. A solution would be to pass a procedure instead of a config: (define* (make-linux-libre version hash #:key (configuration-file #f) (defconfig "defconfig")) (package (name "linux-libre") (version version) (source (origin (method url-fetch) (uri (linux-libre-urls version)) (sha256 (base32 hash)) (patches (origin-patches %boot-logo-patch)))) (build-system gnu-build-system) (supported-systems '("x86_64-linux" "i686-linux")) (inputs `(("bc" ,bc) ;; =E2=80=A6 ;; Call =E2=80=98configuration-file=E2=80=99 and pass it the right= system type. ,@(if configuration-file `(("kconfig" ,(configuration-file (or (%current-target-system) =E2=80=A6)))) '()))) (define variant1 (make-linux-libre v h #:configuration-file (lambda (system) =E2=80=A6))) Makes sense? HTH! Ludo=E2=80=99.