From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id yK8oI8ZpsV9uNgAA0tVLHw (envelope-from ) for ; Sun, 15 Nov 2020 17:47:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6KskH8ZpsV+aNQAAB5/wlQ (envelope-from ) for ; Sun, 15 Nov 2020 17:47:50 +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 3CE8F9405D0 for ; Sun, 15 Nov 2020 17:47:50 +0000 (UTC) Received: from localhost ([::1]:55562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keM7x-0003fL-8R for larch@yhetil.org; Sun, 15 Nov 2020 12:47:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keM7g-0003fA-KS for guix-devel@gnu.org; Sun, 15 Nov 2020 12:47:32 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:39473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1keM7e-00009V-SN; Sun, 15 Nov 2020 12:47:32 -0500 Received: by mail-wr1-x435.google.com with SMTP id o15so16205759wru.6; Sun, 15 Nov 2020 09:47:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=33xXPyoKtw2VNfr9pJRxMsIMEYqe4/M0bWhW2LM7XH4=; b=nLJoSAkAHHODEXbTByGz8QszdC6RPpN7YpHlfTzo4pNFPqO9m/lQNU0RzfiHan4WrV XBW6VtZvPhEjP8t4Y4/ax/tSeqj031FD9lMf8+JtcRirFiGAezzWHl6WEw6aEwzIR3Ef GM+h/xPCXPH9HuXlKrTqAf/vYcifTLhjnQiCvmlz9X5Xz2WddWe0drlHPuPG/eEyabak dcsoHUhDOlQQqWsJFCSc6tn2OGgJHeuwlIhvTpgkdaa7EEbns9HRrSaaCFrXzAkY0abX W2ALiFMtzaR9q7uot4U5rjTuDmmC2jsuumJeHHrFqvqKOeQpudGrF7Ww0EZMIfJoVL8D k/uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=33xXPyoKtw2VNfr9pJRxMsIMEYqe4/M0bWhW2LM7XH4=; b=gdtNTDOd3O5Fk3UlydZAoI6Ap/wSsdxeRg9sQP48GtGj8nOPi3iJE11f9nbmxLSfF+ 4t2rVHf12BqitC2P8h4GGU2i20OiVQSZIKDdoI05UFBZxVLAE+ynIsj4o/7IuOXdrMu5 JC7KfjSy6Ih7B5Y0D4ulY28qhNCVQ5dY/QGaaNo5iAvwHE44XVI8nSO+9y9/BA7kRT42 KdGRxQRvf9D25g+LpkSNV2Jj9XUDlOaGcLaQH51woyVYsnMql66lu+Q4IzcY6B6uzajl cxbGrf/ziO4bxERwwZgXA4Fbc1+shxsmz2Al9aIaUWpMomViec01gX+O8GrdNvLePz3i +qBA== X-Gm-Message-State: AOAM533UIH7aXbjmxVxNLSHH127ONzeJCYtDkQ6HVmC8HgrqJlMMaIpm i8y/Vyr6j4ylXSdlcjJp0TzEr3Yx8JQANA== X-Google-Smtp-Source: ABdhPJx6TUi9kmbHSnr+VJqvdbjV4qCwGlcSSi7bkNGhnaJVApzsK1WtpUq8kARiJag3+ELCWPDJUg== X-Received: by 2002:adf:e351:: with SMTP id n17mr15512584wrj.308.1605462448807; Sun, 15 Nov 2020 09:47:28 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id m20sm23487659wrg.81.2020.11.15.09.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 09:47:28 -0800 (PST) From: zimoun To: Ludovic =?utf-8?Q?Court=C3=A8s?= , guix-devel@gnu.org Subject: Re: A plan for parameterized packages In-Reply-To: <87eeku8trb.fsf@gnu.org> References: <87eeku8trb.fsf@gnu.org> Date: Sun, 15 Nov 2020 18:37:33 +0100 Message-ID: <86v9e6seqq.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x435.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , 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=pass header.d=gmail.com header.s=20161025 header.b=nLJoSAkA; dmarc=pass (policy=none) header.from=gmail.com; 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.71 X-TUID: WAKH3fZlW+lx Hi Lduo, On Sun, 15 Nov 2020 at 17:33, Ludovic Court=C3=A8s wrote: > That said, this message is about a possible implementation of package > parameters, so here we go. :-) Cool! > 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. ;-) The answer leads to your point #4. > 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? > 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? > Subject: [PATCH 1/4] DRAFT Add (guix parameters). > > DRAFT: Missing tests & doc. > > * guix/parameters.scm: New file. > * Makefile.am (MODULES): Add it. > --- [...] > diff --git a/guix/parameters.scm b/guix/parameters.scm > + > +;; Type of a package parameter. > +(define-record-type* parameter-type > + make-parameter-type > + parameter-type? > + (name parameter-type-name) ;debugging purposes o= nly! > + (string->value parameter-type-string->value) > + (value->string parameter-type-value->string) > + (universe parameter-type-universe)) > + > +(define boolean > + ;; The Boolean parameter type. > + (parameter-type (name 'boolean) > + (universe '(#true #false)) > + (value->string > + (match-lambda > + (#f "false") > + (#t "true"))) > + (string->value > + (lambda (str) > + (cond ((string-ci=3D? str "true") > + #t) > + ((string-ci=3D? str "false") > + #f) > + (else > + (raise (condition > + (&message (message "wrong value"))))= )))))) The types will be =E2=80=9Chard-coded=E2=80=9C here, right? Boolean being = the simplest example and imagination just needs to be released, right? :-) > Subject: [PATCH 2/4] DRAFT transformations: Add '--with-parameter'. > > DRAFT: Missing tests & doc. > > * guix/transformations.scm (evaluate-parameter-specs) > (transform-package-parameters): New procedures. > (%transformations, %transformation-options): Add 'with-parameter'. > --- > guix/transformations.scm | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/guix/transformations.scm b/guix/transformations.scm [...] > +(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 ca= lled > +to return the replacement package. Raise an error if an element of SPEC= S 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 lis= t of > +strings like \"guile-next=3Dstable-3.0\" meaning that packages are built= 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 c= lear in my mind. Does this constrain the hypothetical types? Cheers, simon