From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id QNytEpVosl+7DAAA0tVLHw (envelope-from ) for ; Mon, 16 Nov 2020 11:55:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uHKADpVosl//GQAAbx9fmQ (envelope-from ) for ; Mon, 16 Nov 2020 11:55:01 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0CBE09401BF for ; Mon, 16 Nov 2020 11:55:01 +0000 (UTC) Received: from localhost ([::1]:36322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ked63-00076A-VW for larch@yhetil.org; Mon, 16 Nov 2020 06:54:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ked5X-000753-6t for guix-devel@gnu.org; Mon, 16 Nov 2020 06:54:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60835) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ked5W-00019Z-UV; Mon, 16 Nov 2020 06:54:26 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=47716 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ked5T-0000ZV-I5; Mon, 16 Nov 2020 06:54:25 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: zimoun Subject: Re: A plan for parameterized packages References: <87eeku8trb.fsf@gnu.org> <86v9e6seqq.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 26 Brumaire an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 16 Nov 2020 12:54:22 +0100 In-Reply-To: <86v9e6seqq.fsf@gmail.com> (zimoun's message of "Sun, 15 Nov 2020 18:37:33 +0100") Message-ID: <87r1oty0sx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: gw5ueEC8khpt Hi, zimoun skribis: >> To me the requirements for package parameters are: >> >> 1. it must be possible to discover them and choose them from the UI; >> >> 2. they must contain on-line internationalized documentation such that >> the UI can list a package=E2=80=99s parameters and their type; > > Except =E2=80=99boolean=E2=80=99, which kind of type do you have in mind?= Aside that > you did not find examples of packages requiring parameters. ;-) Another example would be enumerated types. >> 3. the chosen parameters when installing a package in a profile must >> be preserved; > > You mean track the parameters with =E2=80=99properties=E2=80=99 in /manifest, > right? Yup! >> 4. it must be possible to enumerate all the possible values of a >> parameter, and thus to build the Cartesian product of all the >> possible parameter combinations of a package (or of a package >> graph!), so we can test those combinations as much as possible. > > The values of the option are therefore known at package time, right? > However, this implies restricted possibility for the type, right? The record has to specify a type, and the type must have a finite universe. So there cannot be an =E2=80=9Cinteger=E2=80=9D ty= pe, for instance, but there can be =E2=80=9Cinteger between 10 and 42=E2=80=9D. >> +(define (evaluate-parameter-specs specs proc) >> + "Parse SPECS, a list of strings like \"bitlbee=3Dpurple=3Dtrue\", and= return a >> +list of spec/procedure pairs, where (PROC PACKAGE PARAMETER VALUE) is c= alled >> +to return the replacement package. Raise an error if an element of SPE= CS uses >> +invalid syntax, or if a package it refers to could not be found." >> + (map (lambda (spec) >> + (match (string-tokenize spec %not-equal) >> + ((spec name value) >> + (define (replace old) >> + (proc old name value)) >> + >> + (cons spec replace)) >> + (_ >> + (raise >> + (formatted-message >> + (G_ "invalid package parameter specification: ~s") >> + spec))))) >> + specs)) > > Here =E2=80=99proc=E2=80=99 could be anything, right? But then=E2=80=A6 > >> +(define (transform-package-parameters replacement-specs) >> + "Return a procedure that, when passed a package, replaces its direct >> +dependencies according to REPLACEMENT-SPECS. REPLACEMENT-SPECS is a li= st of >> +strings like \"guile-next=3Dstable-3.0\" meaning that packages are buil= t using >> +'guile-next' from the latest commit on its 'stable-3.0' branch." >> + (define (replace old name value) >> + (set-package-parameter-value old name value)) >> + >> + (let* ((replacements (evaluate-parameter-specs replacement-specs >> + replace)) >> + (rewrite (package-input-rewriting/spec replacements))) >> + (lambda (obj) >> + (if (package? obj) >> + (rewrite obj) >> + obj)))) > > =E2=80=A6 it is =E2=80=99set-package-parameter-value=E2=80=99. It is not= clear in my mind. Yes I could have used =E2=80=98set-package-parameter-value=E2=80=99 directl= y instead of adding this =E2=80=98proc=E2=80=99 parameter; it would have been more reada= ble I guess! Thanks, Ludo=E2=80=99.