From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Generalizing DAG rewriting Date: Thu, 09 Feb 2017 10:55:06 +0100 Message-ID: <87mvdv3czp.fsf_-_@gnu.org> References: <87r3394y6l.fsf@gmail.com> <874m04ekp4.fsf@elephly.net> 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]:43818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cblRe-0005sA-3c for help-guix@gnu.org; Thu, 09 Feb 2017 04:55:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cblRd-0002N9-9N for help-guix@gnu.org; Thu, 09 Feb 2017 04:55:18 -0500 In-Reply-To: <874m04ekp4.fsf@elephly.net> (Ricardo Wurmus's message of "Wed, 08 Feb 2017 17:01:16 +0100") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Ricardo Wurmus Cc: help-guix , Federico Beffa Hi! Ricardo Wurmus skribis: > Myles English writes: > >> Hello Fede, Eric, >> >> on [2017-02-07] at 15:15 Federico Beffa writes: [...] >>> it seems that the only Python specific part of >>> 'package-with-explicit-python' is the keyword '#:python'. What do you >>> think of generalizing it by making it a function keyword argument and >>> move the procedure to its own module (maybe (guix build-system >>> utils)?). >> >> ...I came the same conclusion as Fede: it could be generalised. It is >> probably close to working for me (with respect to ghc) so I will keep >> going for now. I am not competent enough to generalise it but if >> someone else does I can help test it. > > I=E2=80=99m doing the same for some Perl packages. I defined a procedure > =E2=80=9Cpackage-for-perl-5.14=E2=80=9D which takes a package and rewrite= s it. > > It looks like this: > > (define (package-for-perl-5.14 pkg) > (let* ((rewriter (package-input-rewriting `((,perl . ,perl-5.14)) > perl-5.14-package-name)) > (new (rewriter pkg))) > (package > (inherit new) > (arguments `(#:perl ,perl-5.14 > ,@(package-arguments new)))))) > > The problem here is that it doesn=E2=80=99t rewrite the =E2=80=9C#:perl= =E2=80=9D argument > recursively, so the dependencies of a Perl package will still refer to > the latest version of Perl as that=E2=80=99s what=E2=80=99s used in the b= uild system. > > We would need a solution that would take care of this problem for all > build systems. I agree that this is asking for generalization. Another instance of DAG rewriting is the =E2=80=98package-with-=E2=80=99 he= lpers in (guix build-system gnu). We should have a general form of transformation procedure that handles DAG traversal and memoization like all these procedures do. Ludo=E2=80=99.