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 iFB0Jlv3m1+lfwAA0tVLHw (envelope-from ) for ; Fri, 30 Oct 2020 11:22:03 +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 YKI6Ilv3m193DwAAbx9fmQ (envelope-from ) for ; Fri, 30 Oct 2020 11:22:03 +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 E99939403C9 for ; Fri, 30 Oct 2020 11:22:02 +0000 (UTC) Received: from localhost ([::1]:46564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYSTp-0003md-U5 for larch@yhetil.org; Fri, 30 Oct 2020 07:22:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYSSs-0002ud-Tk for guix-patches@gnu.org; Fri, 30 Oct 2020 07:21:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYSSs-000402-KS for guix-patches@gnu.org; Fri, 30 Oct 2020 07:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kYSSs-0006b6-F1 for guix-patches@gnu.org; Fri, 30 Oct 2020 07:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44321] [PATCH 6/6] doc: Add "Defining Package Variants" section. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 30 Oct 2020 11:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44321 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 44321@debbugs.gnu.org Received: via spool by 44321-submit@debbugs.gnu.org id=B44321.160405682725294 (code B ref 44321); Fri, 30 Oct 2020 11:21:02 +0000 Received: (at 44321) by debbugs.gnu.org; 30 Oct 2020 11:20:27 +0000 Received: from localhost ([127.0.0.1]:56304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYSSI-0006Zt-Vo for submit@debbugs.gnu.org; Fri, 30 Oct 2020 07:20:27 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38220) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYSSI-0006Zi-1d for 44321@debbugs.gnu.org; Fri, 30 Oct 2020 07:20:26 -0400 Received: by mail-wr1-f65.google.com with SMTP id n18so6033550wrs.5 for <44321@debbugs.gnu.org>; Fri, 30 Oct 2020 04:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=iZIgqjg+albf4cg3shrfvSEnTF85Z6itzDwIcs2W5eo=; b=ZvnuH+ab2LXM6/+I1qqeo8PXnkLvkowW5Xcfua3e/U0N5cBD/8X3++B2ifhnF7GnZF 5+xu/LFY8BLJDzb8U306VTvUBNCDbB1x1Ge25g+btoUYAJFclFdjBeJoAiXLcg/dxtA3 kbbxggWuS/Ag2eRUwnWeAthEWZcen1Uj0jTW+YMFmscybom+PZFi6/f8svUU3Wt2c3SA JAxNL55FaDbxtFaU0pMs5y9iqFikwi3OKedxgohjvrCq2YJ693Weeng8ykPZy1KMkjnu hddetpEP8DoHdaco8vtw9mjdOZeJFokwyI+eDUOeQ6ckALH9d/IGCZhL1CnVXLQF2Cs9 UVRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=iZIgqjg+albf4cg3shrfvSEnTF85Z6itzDwIcs2W5eo=; b=l9g/rx0jg8NL8dcOqxtgAD9UgLIZcGjef7N9ciaKgWuMGevKEID8HUhLNpRSVJAVis IVRfsS0/74QznH+lPAByFJB42MmyOodLvgwxJ3iQiZeiZhK4rT/Se18D5YgRVv9NXhNV L6D4CKzktToYwKMaUwthME3JfoPEFYvs4f9HTHrK+hQkFooUOy+b7TsFx5A/1esOyepM I27qvP441H9EOssTas5s8kyZrD2CBtQUDoDcDa7XLRxsMrqpP/onMSnEKqHZOov/GmIu SQ3S63GPdiYqmI0Lci6im2a+S0CpdnxuiLM1aLtezysc3r67XCNxB9/YmlckavtwNlzH JvHQ== X-Gm-Message-State: AOAM532F7QkQwaSlyfWZKBOl9Iqvzk7qO0EYsP9DZlRaYmk41tn4W4ph 4s/RK6x6tTK67gj5vEqdLDzrGL49EN4= X-Google-Smtp-Source: ABdhPJzHzcHB56Q8Wm4kjD2Rwdybb5a50EwQKpKhBfnluToQkTfm5vhQkvkIvN90m6pQsSblc3hGQg== X-Received: by 2002:a5d:4dc7:: with SMTP id f7mr2379096wru.375.1604056819834; Fri, 30 Oct 2020 04:20:19 -0700 (PDT) Received: from pfiuh02 ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id a185sm4320936wmf.24.2020.10.30.04.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 04:20:19 -0700 (PDT) From: zimoun References: <20201029231000.14568-1-ludo@gnu.org> <20201029231000.14568-6-ludo@gnu.org> Date: Fri, 30 Oct 2020 12:20:18 +0100 In-Reply-To: <20201029231000.14568-6-ludo@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 30 Oct 2020 00:10:00 +0100") Message-ID: <875z6s6jv1.fsf@gmail.com> 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-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=ZvnuH+ab; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: imUECHQv1Wg+ Hi, On Fri, 30 Oct 2020 at 00:10, Ludovic Court=C3=A8s wrote: > -* Invoking guix repl:: Programming Guix in Guile. > +* Invoking guix repl:: Programming Guix in Guile This change is already in commit 729d4ba025bc8556d00041f9af5b6609eeec9d80. > +You can just as well define variants with a different set of > +dependencies than the original package. For example, the default > +@code{gdb} package depends on @code{guile}, but since that is an > +optional dependency, you can define a variant that removes that > +dependency like so: > + > +@lisp > +(use-modules (gnu packages gdb) ;for 'gdb' > + (srfi srfi-1)) ;for 'alist-delete' > + > +(define gdb-sans-guile > + (package > + (inherit gdb) > + (inputs (alist-delete "guile" > + (package-inputs gdb))))) > +@end lisp Does it make sense to add a sentence explaining that the =E2=80=9Cguile=E2= =80=9D is the name provided by the string in the =E2=80=99inputs=E2=80=99 list of the pac= kage =E2=80=99gdb=E2=80=99, namely: --8<---------------cut here---------------start------------->8--- (inputs `(("expat" ,expat) ("mpfr" ,mpfr) ("gmp" ,gmp) ("readline" ,readline) ("ncurses" ,ncurses) ("guile" ,guile-2.0) ("python-wrapper" ,python-wrapper) ("source-highlight" ,source-highlight) ;; Allow use of XML-formatted syscall information. This enables 'ca= tch ;; syscall' and similar commands. ("libxml2" ,libxml2) ;; The Hurd needs -lshouldbeinlibc. ,@(if (hurd-target?) `(("hurd" ,hurd)) '()))) --8<---------------cut here---------------end--------------->8--- ? Because it can be confusing. Especially when the =E2=80=99rewriting=E2= =80=99 works on symbols instead. > +@deffn {Scheme Procedure} options->transformation @var{opts} > +Return a procedure that, when passed an object to build (package, > +derivation, etc.), applies the transformations specified by @var{opts} a= nd returns > +the resulting objects. @var{opts} must be a list of symbol/string pairs= such as: > + > +@example > +((with-branch . "guile-gcrypt=3Dmaster") > + (without-tests . "libgcrypt")) > +@end example Is it on purpose that here you use =E2=80=99without-tests=E2=80=99 and then= =E2=80=A6 > +Each symbol names a transformation and the corresponding string is an ar= gument > +to that transformation. > +@end deffn > + > +For instance, a manifest equivalent to this command: > + > +@example > +guix build guix \ > + --with-branch=3Dguile-gcrypt=3Dmaster \ > + --with-debug-info=3Dzlib > +@end example > + > +@noindent > +... would look like this: > + > +@lisp > +(use-modules (guix transformations)) > + > +(define transform > + ;; The package transformation procedure. > + (options->transformation > + '((with-branch . "guile-gcrypt=3Dmaster") > + (with-debug-info . "zlib")))) > + > +(packages->manifest > + (list (transform (specification->package "guix")))) > +@end lisp =E2=80=A6you use =E2=80=99with-debug-info=E2=80=99 as example? > +@lisp > +(define libressl-instead-of-openssl > + ;; Replace all the packages called "openssl" with LibreSSL. > + (package-input-rewriting/spec `(("openssl" . ,(const libressl))))) > +@end lisp It is already in the manual but why this =E2=80=99const=E2=80=99? BTW, cool! Nice features! :-) All the best, simon