From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: using package-for-guile2.0 outside of guile.scm Date: Mon, 28 Jan 2019 13:48:30 +0100 Message-ID: <87va29rlr5.fsf@gnu.org> References: <877eepssan.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:49620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1go6LA-0001od-6e for guix-devel@gnu.org; Mon, 28 Jan 2019 07:48:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1go6L7-0000ca-99 for guix-devel@gnu.org; Mon, 28 Jan 2019 07:48:39 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:38842) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1go6L5-0000T2-7F for guix-devel@gnu.org; Mon, 28 Jan 2019 07:48:37 -0500 In-Reply-To: <877eepssan.fsf@elephly.net> (Ricardo Wurmus's message of "Sun, 27 Jan 2019 22:29:36 +0100") 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: Ricardo Wurmus Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, Ricardo Wurmus skribis: > I tried to move most of the packages in gnu/packages/guile.scm to a new > module gnu/packages/guile-xyz.scm. > > The only problem with this is that package-for-guile2.0 cannot be used > in guile-xyz.scm. I cannot compile the module when there=E2=80=99s a ref= erence > to package-for-guile2.0, even when the definition is in guile-xyz.scm. > The definition of package-for-guile2.0 refers to guile-2.2, which is > located in guile.scm. > > What to do? The problem is that =E2=80=98package-with-guile-2.0=E2=80=99 needs to resol= ve =E2=80=98guile-2.0=E2=80=99. So if you use it at the top-level, then (gnu = packages guile) has to be fully loaded, or you have to be in (gnu packages guile) itself and =E2=80=98guile-2.0=E2=80=99 has been defined above. I think we can get around it using this cute hack. I=E2=80=99ll commit it = if that=E2=80=99s fine with you. Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 1a3069c2fd..5bcb6f4dd7 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -413,7 +413,7 @@ GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its (define package-for-guile-2.0 ;; A procedure that rewrites the dependency tree of the given package to use ;; GUILE-2.0 instead of GUILE-2.2. - (package-input-rewriting `((,guile-2.2 . ,guile-2.0)) + (package-input-rewriting (delay `((,guile-2.2 . ,guile-2.0))) (guile-variant-package-name "guile2.0"))) (define-public guile-for-guile-emacs diff --git a/guix/packages.scm b/guix/packages.scm index f191327718..f4ce406f00 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -861,7 +861,10 @@ package to replace, and the second one is the replacement. Optionally, REWRITE-NAME is a one-argument procedure that takes the name of a package and returns its new name after rewrite." (define (rewrite p) - (match (assq-ref replacements p) + (match (assq-ref (if (promise? replacements) + (force replacements) + replacements) + p) (#f (package (inherit p) (name (rewrite-name (package-name p))))) --=-=-=--