From mboxrd@z Thu Jan 1 00:00:00 1970 From: zimoun Subject: Re: Parameterized packages Date: Tue, 21 Jan 2020 20:04:00 +0100 Message-ID: References: <8736ldq74z.fsf@netris.org> <20190719202906.lbanx5puk7t6q4cr@cf0> <87a7753boq.fsf@ambrevar.xyz> <87h813wah0.fsf@gnu.org> <87v9piut40.fsf@ambrevar.xyz> <87o8v5ukgb.fsf@ambrevar.xyz> <87d0blhr9s.fsf@ambrevar.xyz> <20200116190644.uytvzvypuvdwh2iq@n0> <87d0bfrxr1.fsf@gnu.org> <87tv4qjy06.fsf@ambrevar.xyz> <875zh6rm5h.fsf@ambrevar.xyz> <87lfq1q7ea.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58584) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ityp7-00085w-M4 for guix-devel@gnu.org; Tue, 21 Jan 2020 14:04:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ityp5-0000c0-Ru for guix-devel@gnu.org; Tue, 21 Jan 2020 14:04:25 -0500 In-Reply-To: <87lfq1q7ea.fsf@ambrevar.xyz> 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-mx.org@gnu.org Sender: "Guix-devel" To: Pierre Neidhardt Cc: Guix Devel On Tue, 21 Jan 2020 at 14:13, Pierre Neidhardt wrote: > > zimoun writes: > > >> > --8<---------------cut here---------------start------------->8--- > >> > (define (make-me-a-package option1 option2) > >> > (package > >> > =E2=80=A6)) > >> > --8<---------------cut here---------------end--------------->8--- > >> > >> The ellipsis is a bit vague here. What is this trying to do? > > > > What you wrote below. :-) > > ? --8<---------------cut here---------------start------------->8--- (define (make-me-a-package VIDEO-PLAYER PYTHON-VERSION WITH-FFMPEG) (package [all your "messy" code using stuff] )) (define-public you-get-vlc (make-me-a-package 'vlc 'python #t)) --8<---------------cut here---------------start------------->8--- > > And my opinion is that you described is already possible (more or > > less) using 'inherit'. Except the modification of the compiling > > options (build-system). > > The crucial difference is the current approach with inherit /does not > compose/. This is where USE flags stand strong because you can tell > what happens when both flags X and Y are set, e.g. I do not understand what you do mean by "does not compose". To me, a package is: "./configure && make && make check && make install" so I understand why tweak the flags used by "./configure", for example change "--with-vlc=3D" from the default 0 to the tuned 1. Or use another compiling toolchain. I understand also these flags could require different inputs. And again from my understanding, this is more or less cover by 'inherit'. Or some macrology should be improved in 'package/inherit' or in 'records.scm', i.e., something more fine grained when inheriting. --8<---------------cut here---------------start------------->8--- (define (make-you-get VIDEO-PLAYER PYTHON-VERSION WITH-FFMPEG) (package (inherit you-get #:add-inputs `(("PLAYER" ,VIDEO-PLAYER)) ,@(IF WITH-FFMPEG) ;; FOR MULTI-PART AND >=3D1080P VIDEOS `("FFMPEG" ,FFMPEG) #:replace-arguments ... #:add-phase ... '()))) (define-public you-get-vlc (make-you-get 'vlc)) --8<---------------cut here---------------end--------------->8--- Something like that. And everything is more controlled, i.e., no mess with global parameters. What you want to do is: add/remove/replace inputs/arguments so #:add-inputs, #:remove-native-inputs, etc. And this composes in the same way function composes. And yes, it composes explicitly which can be annoying, But implicit composition will end up to the Gentoo USE flag mess, IMHO. > >> - To let the user choose which video player to use. This is a popular > >> USE flag on Gentoo (maybe with a different name). > > > > What I do not understand is: people who used Gentoo and especially USE > > flag are saying that it ends with a big mess with broken packages. > > Therefore, why does Guix want to reproduce the mess? > > Because it is extremely powerful: in a simple declaration like "no-X + > pulseaudio + python3 + gtk2" you can build /your entire system/, > according to the flags you've set, in just one command. Hum? but months later your system is broken... so I am not convinced it is powerful. :-) It is broken because composing complex system is an hard task. Typing helps a bit to detect error at compile time (in this case at building package time) but run-time errors will still remain and it will be hard time to find them. Cheers, simon