From mboxrd@z Thu Jan 1 00:00:00 1970 From: zimoun Subject: Re: Parameterized packages Date: Tue, 21 Jan 2020 13:15:03 +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> 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]:49840) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itsRF-0006Ey-6v for guix-devel@gnu.org; Tue, 21 Jan 2020 07:15:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itsRC-0003uS-Ae for guix-devel@gnu.org; Tue, 21 Jan 2020 07:15:21 -0500 In-Reply-To: <875zh6rm5h.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 Hi, Thank you for the explanations. On Mon, 20 Jan 2020 at 19:57, Pierre Neidhardt wrote: > > The solution of 2. and 3. seems to write, as Ludo mentioned: > > > > --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-public you-get > (package > (name "you-get") > (version "0.4.1355") > (PARAMETERS VIDEO-PLAYER PYTHON-VERSION WITH-FFMPEG) > (source (origin > (method git-fetch) > (uri (git-reference > (url "https://github.com/soimort/you-get.git") > (commit (string-append "v" version)))) > (file-name (git-file-name name version)) > (sha256 > (base32 > "0xq7z04hvw3b3npiahlpzhbxsjvam9n9dynplyrkn84dx6k9ajbj")))= ) > (build-system python-build-system) > (inputs > `(("PLAYER" ,(DEREF-PARAM VIDEO-PLAYER)) > ,@(IF (DEREF-PARAM WITH-FFMPEG) > ;; FOR MULTI-PART AND >=3D1080P VIDEOS > `("FFMPEG" ,FFMPEG) > '()))) > (arguments > `(#:PYTHON ,(DEREF-PARAM PYTHON-VERSION) > #:phases > (modify-phases %standard-phases > ,(WHEN (DEREF-PARAM WITH-FFMPEG) > (add-after 'unpack 'qualify-input-references > ;; Explicitly invoke the input ffmpeg, instead of whichever= one > ;; happens to be in the user's $PATH at run time. > (lambda* (#:key inputs #:allow-other-keys) > (let ((ffmpeg (string-append (assoc-ref inputs "ffmpeg") > "/bin/ffmpeg"))) > (substitute* "src/you_get/processor/ffmpeg.py" > ;; Don't blindly replace all occurrences of =E2=80=98= 'ffmpeg'=E2=80=99: the > ;; same string is also used when sniffing ffmpeg's ou= tput. > (("(FFMPEG =3D=3D |\\()'ffmpeg'" _ prefix) > (string-append prefix "'" ffmpeg "'"))) > #t)))) > (ADD-AFTER 'UNPACK 'TWEAK-PLAYER-SETTINGS > (LAMBDA* (#:KEY INPUTS #:ALLOW-OTHER-KEYS) > (MATCH ,(DEREF-PARAM VIDEO-PLAYER) > (VLC > ;; DO SOMETHING WITH VLC. > ) > (MPV > ;; DO SOMETHING WITH MPV. > ) > (_ > ;; ERROR OUT? > ))))) > #:tests? #f)) ; XXX some tests need Internet ac= cess > (synopsis "Download videos, audio, or images from Web sites") > (description > "You-Get is a command-line utility to download media contents (video= s, > audio, images) from the Web. It can use either mpv or vlc for playback."= ) > (home-page "https://you-get.org/") > (license license:expat))) > --8<---------------cut here---------------end--------------->8--- > > In the above I've highlighted the changes in uppercase. Welcome in a big and unmaintainable mess! :-) And my opinion is that you described is already possible (more or less) using 'inherit'. Except the modification of the compiling options (build-system). > On line (PARAMETERS ...) I've declared which parameters I'm going to use > in my package declaration. Those parameters must be defined globally > somewhere in Guix. This will end up with a big and unmaintainable mess, IMHO. > The point of declaring the parameters in advance is that it allows the > user to list all parameters used by a given package. I bet that the number of broken packages will increase. > - 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? All the best, simon