From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: bug#32184: =?UTF-8?Q?=E2=80=98guix?= pack =?UTF-8?Q?--bootstrap=E2=80=99?= is ineffective Date: Tue, 17 Jul 2018 23:11:56 -0700 Message-ID: <87r2k1ul77.fsf@gmail.com> References: <87k1pu9pv3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fffhv-0001Uk-F5 for bug-guix@gnu.org; Wed, 18 Jul 2018 02:13:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fffhu-0004vV-7A for bug-guix@gnu.org; Wed, 18 Jul 2018 02:13:03 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:41070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fffhu-0004vP-2y for bug-guix@gnu.org; Wed, 18 Jul 2018 02:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fffht-0000kl-Rb for bug-guix@gnu.org; Wed, 18 Jul 2018 02:13:01 -0400 In-Reply-To: <87k1pu9pv3.fsf@gnu.org> Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fffh0-0001K5-0Z for bug-guix@gnu.org; Wed, 18 Jul 2018 02:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fffgy-0003eV-1n for bug-guix@gnu.org; Wed, 18 Jul 2018 02:12:05 -0400 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 32184@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) writes: > While preparing the 0.15 release I realized that =E2=80=98guix pack --boo= tstrap=E2=80=99 > had become ineffective. Concretely, =E2=80=98tests/guix-pack.sh=E2=80=99= would attempt > to build the world. > > This is a consequence of c45477d2a1a651485feede20fe0f3d15aec48b39w, which > introduced a dependency on guile-sqlite3 in derivations that build > packs, even if they don=E2=80=99t actually produce a =E2=80=98db.sqlite= =E2=80=99 file in there. > > I started looking for solutions, which led me to the patch below. > That=E2=80=99s quite intrusive and it doesn=E2=80=99t work because then w= e have a > similar issue with (guix hash) trying to dlopen libgcrypt. > > [...] > > diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm > index 6d5d745bc..45eeb2e7b 100644 > --- a/guix/scripts/pack.scm > +++ b/guix/scripts/pack.scm > > [...] >=20 > @@ -717,6 +734,9 @@ Create a bundle of PACKAGE.\n")) > (set-build-options-from-command-line store opts) >=20=20 > (parameterize ((%graft? (assoc-ref opts 'graft?)) > + (guile-sqlite3&co (if (assoc-ref opts 'bootstrap?) > + (list guile-sqlite3/mock) > + (guile-sqlite3&co))) > (%guile-for-build (package-derivation > store > (if (assoc-ref opts 'bootstrap?) You mentioned that you felt this change is "quite intrusive." How is this more intrusive than using parameters for %graft? and %guile-for-build to control how things get built? At first blush, this seems no worse than what we already doing here. You also mentioned that the proposed patch doesn't actually work, since we run into a similar problem with (guix hash) trying to dlopen libgcrypt. I applied your patch and ran the test, and I think I see what you mean. Somehow (I have to admit, I'm not sure how), the normal libgcrypt gets pulled in by the derivation, so we have to build it... Although I suppose it isn't ideal, maybe we can get away with working around it via similar parameterize tricks? If the intent of --bootstrap is to enable the tool to run quickly in tests, then it seems we MUST either find a way to substitute every heavy dependency (including libgcrypt) with a light replacement (e.g. the guile-sqlite3/mock you made), or find another way to short-circuit the build. 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? > I=E2=80=99m not sure how to best address it. Another approach would be t= o do > away with =E2=80=98--bootstrap=E2=80=99 and instead write those tests as = =E2=80=9Csystem tests=E2=80=9D > in a VM, though that=E2=80=99s maybe less satisfactory. If we ran these tests in a VM as "system tests" (instead of turning guile-sqlite3&co into a parameter), would we still need to build the world? =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAltO2i0ACgkQ3UCaFdgi Rp2guRAAwz4xVqKDOD1wLZ7ikSnrHEPd5sIPBKoCF8UuAy8i4pcBgr0CS2nEZWIF FztGu4CJxHzimornKeExAnuy3X56PYCVcEPncgOoqQM2tqGJzIIMomb+f6lXYuPx BVkfMODeZ7YzyVsDK8c4LlxhHpbNEP3/WTa5hNmqn8dKY48clKFyTFL6yUlrhbWl bsBgkNnivKcYOS4BlkhqhiBMKP/wlTURqe44mLoPE2tqnbpvA+RHBu2ubqUyM/0n Y5owDUWCLi+Fvl8BwKKs0l9sgXXKEmJABrY340ldmGTMObztsE+iQ5O1OBqQTkly xFBtF2k9CiZtKm+ZLUccByFwMnklXuqNckn5cfCHpKT88Y0i/AVTTi2i35zjrKDk GJUNld3faqUsIfw3NBTwihOFBfxKEhLTfQo0+9NvcprxCBxu3vGBDdplvCl0lrBz thlTGjn8V3VcV8trARilPtWlDntBDS1Qenq5hkPXnnEWeVpJlbbHVK5flhypWsp8 9qh6BwpMzPumzyp3CKoHJiOI+kiZoP5THeXn7skx0nYhPPdoC7iL9NufsByP1nD9 p0bNZ/AFHqlmc9+fm3q9byDKXF1Nfz0KD3v5zQcZEyrdHXJWQdS3PTBjLbtUzQgc lPlSL4ta0yAEeysjnSx3CLkAfEqAXwoRlaHRwKpkD/iNQXHrqPI= =ZaHH -----END PGP SIGNATURE----- --=-=-=--