From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHnMJ-0001wM-HH for guix-patches@gnu.org; Sun, 13 May 2018 05:32:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHnMI-0003zR-Og for guix-patches@gnu.org; Sun, 13 May 2018 05:32:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:52275) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHnMI-0003zJ-K8 for guix-patches@gnu.org; Sun, 13 May 2018 05:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fHnMI-0003uo-EC for guix-patches@gnu.org; Sun, 13 May 2018 05:32:02 -0400 Subject: [bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180511143515.23435-1-dannym@scratchpost.org> <20180511143652.26935-1-dannym@scratchpost.org> <20180511143652.26935-2-dannym@scratchpost.org> Date: Sun, 13 May 2018 11:31:23 +0200 In-Reply-To: <20180511143652.26935-2-dannym@scratchpost.org> (Danny Milosavljevic's message of "Fri, 11 May 2018 16:36:50 +0200") Message-ID: <87d0xznbpw.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: Danny Milosavljevic Cc: 31416@debbugs.gnu.org Danny Milosavljevic skribis: > * gnu/bootloader/u-boot.scm (install-u-boot): Automatically select the co= rrect > installer. > --- > gnu/bootloader/u-boot.scm | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm > index bc8f98f32..e0941c961 100644 > --- a/gnu/bootloader/u-boot.scm > +++ b/gnu/bootloader/u-boot.scm > @@ -41,7 +41,24 @@ > (define install-u-boot > #~(lambda (bootloader device mount-point) > (if bootloader > - (error "Failed to install U-Boot")))) > + (let* ((config-file-name (string-append bootloader "/libexec/.co= nfig")) > + (soc (call-with-input-file config-file-name > + (let loop ((line (read-line po= rt))) > + (if (not (eof-object? line)) > + (let ((match > + (string-match > + "^CONFIG_SYS_SOC= =3D\"([^\"]*)\"" > + line))) > + (if match > + (match:substring m= atch 1) > + (loop (read-line p= ort)))) > + #f))))) > + (match soc > + ("am33xx" (install-beaglebone-black-u-boot bootloader device = mount-point)) > + ("mx6" (install-imx-u-boot bootloader device mount-point)) > + ("sunxi" (install-allwinner-u-boot bootloader device mount-po= int)) > + (_ (error "Failed to install U-Boot (no installation method f= ound)" > + soc))))))) Hmm =E2=80=98install-beaglebone-black-u-boot=E2=80=99 & co are not in the s= ame stage AFAICS; are you missing #$ escapes here? Also we=E2=80=99re probably missing (ice-9 rdelim) and (ice-9 regex) as in = the build stage. Last, isn=E2=80=99t it a bit hacky? :-) Previously every wou= ld contain its installation method, so this was unambiguous, but now we=E2=80= =99re back to guessing what installation method to use. Ludo=E2=80=99.