From debbugs-submit-bounces@debbugs.gnu.org Sun May 13 05:31:34 2018 Received: (at 31416) by debbugs.gnu.org; 13 May 2018 09:31:34 +0000 Received: from localhost ([127.0.0.1]:60172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHnLq-0003u6-AS for submit@debbugs.gnu.org; Sun, 13 May 2018 05:31:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHnLo-0003tu-OJ for 31416@debbugs.gnu.org; Sun, 13 May 2018 05:31:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHnLi-0003lh-NM for 31416@debbugs.gnu.org; Sun, 13 May 2018 05:31:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHnLi-0003lb-Ix; Sun, 13 May 2018 05:31:26 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=41206 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fHnLi-0007Ns-4v; Sun, 13 May 2018 05:31:26 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Danny Milosavljevic Subject: Re: [bug#31416] [PATCH 2/4] bootloader: install-u-boot: Automatically select the correct installer. 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> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31416 Cc: 31416@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) 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.