From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: Recursively propagate build-system 'arguments' to dependency packages? Date: Wed, 08 Feb 2017 17:01:16 +0100 Message-ID: <874m04ekp4.fsf@elephly.net> References: <87r3394y6l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbUgT-0003k5-M3 for help-guix@gnu.org; Wed, 08 Feb 2017 11:01:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbUgQ-0004Bu-Jg for help-guix@gnu.org; Wed, 08 Feb 2017 11:01:29 -0500 Received: from sender-of-o51.zoho.com ([135.84.80.216]:21121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cbUgQ-0004Bh-Cq for help-guix@gnu.org; Wed, 08 Feb 2017 11:01:26 -0500 In-reply-to: <87r3394y6l.fsf@gmail.com> 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: Myles English Cc: help-guix , Federico Beffa Myles English writes: > Hello Fede, Eric, > > on [2017-02-07] at 15:15 Federico Beffa writes: > >> Eric Bavier writes: >> >>> On Mon, 06 Feb 2017 21:09:33 +0000 >>> Myles English wrote: >>> >>>> Trying to define a package to be compiled by ghc-8, and I think all of >>>> its dependencies must also be compiled by ghc-8 rather than ghc (which >>>> is version 7). This is easy to do with one package, e.g..: >>>> >>>> (define-module (my-packages myhaskell) >>>> ... >>>> #:use-module ((gnu packages haskell) #:prefix haskellmain:)) >>>> >>>> (define-public ghc-hunit8 >>>> (package >>>> (inherit haskellmain:ghc-hunit) >>>> (arguments `(#:haskell ,ghc-8)))) >>>> >>>> To do that recursively for all the dependencies seems Too Difficult so, >>>> is there a way to do something like --with-input=ghc=ghc-8 but with the >>>> build-system arguments? Perhaps doing the work in between the Bag and >>>> the Derivation? > > Thanks Eric for your suggestion. I made a start on this... > >>> You may take a look at the 'package-with-python2' procedure in >>> guix/build-system/python.scm, which seems like it could be adapted to >>> work with haskell/ghc packages. >> >> Hi Eric, Myles, >> >> 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’m doing the same for some Perl packages. I defined a procedure “package-for-perl-5.14” which takes a package and rewrites it. It looks like this: --8<---------------cut here---------------start------------->8--- (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)))))) --8<---------------cut here---------------end--------------->8--- The problem here is that it doesn’t rewrite the “#:perl” argument recursively, so the dependencies of a Perl package will still refer to the latest version of Perl as that’s what’s used in the build system. We would need a solution that would take care of this problem for all build systems. -- Ricardo GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC https://elephly.net