From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#32184: =?UTF-8?Q?=E2=80=98guix?= pack =?UTF-8?Q?--bootstrap=E2=80=99?= is ineffective Date: Thu, 26 Jul 2018 15:26:50 +0200 Message-ID: <87r2jqyvol.fsf@gnu.org> References: <87k1pu9pv3.fsf@gnu.org> <87r2k1ul77.fsf@gmail.com> 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]:50485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1figJJ-0003uT-1f for bug-guix@gnu.org; Thu, 26 Jul 2018 09:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1figJG-00080Q-1e for bug-guix@gnu.org; Thu, 26 Jul 2018 09:28:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1figJF-0007zr-SE for bug-guix@gnu.org; Thu, 26 Jul 2018 09:28:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1figJF-0004th-MD for bug-guix@gnu.org; Thu, 26 Jul 2018 09:28:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1figIC-0003r8-KN for bug-guix@gnu.org; Thu, 26 Jul 2018 09:26:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1figI9-0005oC-KF for bug-guix@gnu.org; Thu, 26 Jul 2018 09:26:56 -0400 In-Reply-To: <87r2k1ul77.fsf@gmail.com> (Chris Marusich's message of "Tue, 17 Jul 2018 23:11:56 -0700") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Chris Marusich Cc: 32184@debbugs.gnu.org Hi Chris, Chris Marusich skribis: > Basically, we're manually doing dependency injection here depending on > whether or not --bootstrap was given, right? Instead of parameterizing > the dependencies, what if we used a dependency injector (or "oracle", or > "container", or whatever you want to call it) that, when invoked, would > give us the dependency that is appropriate for the current context? > Perhaps we could control the context via a single parameter. For > example, something like this: > > (parameterize ((test-environment? #t)) > (injector-get-dependency guile)) > > would return the bootstrap guile, but something like this: > > (parameterize ((test-environment? #f)) > (injector-get-dependency guile)) > > would return the usual guile. This isn't much different from using > parameters like we're already doing, except that it might save us from > having to remember multiple parameters, and it might make the code > cleaner by hiding the dependency selection/construction logic behind the > injector abstraction. > > What do you think of that idea? Yes, that makes sense. Or we could simply have something like: (define (lookup-package name) (if (test-environment?) (match name ("guile" =E2=80=A6) =E2=80=A6) (match name =E2=80=A6))) Another option that comes to mind is using the little-known =E2=80=98map-derivation=E2=80=99 procedure: we would compute the =E2=80=98g= uix pack=E2=80=99 derivation as usual, but at the end we=E2=80=99d call =E2=80=98map-derivation=E2=80=99= to replace libgcrypt.drv, guile-sqlite3.drv, etc. with dummy variants. That might turn out to be more complicated that the above solution, though. Ludo=E2=80=99.