From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +OcvJxqD82SM2wAA9RJhRA:P1 (envelope-from ) for ; Sat, 02 Sep 2023 20:46:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +OcvJxqD82SM2wAA9RJhRA (envelope-from ) for ; Sat, 02 Sep 2023 20:46:50 +0200 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 5071D51916 for ; Sat, 2 Sep 2023 20:46:50 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ReNbPTPL; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693680410; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GUZGyj/7wrqFp9KGIYv4o8XWBPZZhJrFVLGy7DXYtiM=; b=suGyiDLwZxElIEde8Nb/NC9UaR4gS33HKjrF/33Is2kNqr8fEaqftp/CLuET//EZMvxEtq fEqoEc+XIdkgJy0a+ZbNmf9Haa9W236Stannw2F5E67y0bprt+cIwFRV0Juh57PYarbucN KTKDqoCR02SHykZTrlNwlVpbQ8bnyXOL0ADz/OlZzIu2HAoN7MJbSy+uhywitnbQLtAYOu gv6Lmmd7JgWqWvbFwXzwSJKaxy6DAwCpRQoJ8cqEuV/qL5XnDWsno7mM4f98KzZAwT8yB2 /WTUmKMEaW4LhvUfluu/X59ZmMAGCSKREsto8pLWbAXauPRatp05BU+EH1gXJA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693680410; a=rsa-sha256; cv=none; b=mTGVNSBGBNAObPysRoRWSRKSvwVzA8Jajps8OR7zDVdWGjjovBLCVHktigKR1B0yqR84Ni hQ1gz3FxxRSrHe+attgIf8P/+dMB7edF6CmzsYYCsnkhEtdeCfW70o3PCU+qTrx4J6Z+R8 QNJArtRjtvEniZlcnDLQoQOZS+nilUDoAzK6imbW0MXuTSHRju8xM13DeJCu9FlCGvTuEU 1EaEN1K0IBCZ3kjO5gznofr/Wu80CrRU58yBlwUJ5lRbpBCHoFhSQyrNFI5zzQRYqRFZma fWj14gEQmDlSx4REq3Pg7yb1FIXD2jzljJwzb+lm5h9oLQWMTS1wHKXADRAfAw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=ReNbPTPL; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcVdO-0006F9-57; Sat, 02 Sep 2023 14:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcVdH-0006Ew-VJ for guix-devel@gnu.org; Sat, 02 Sep 2023 14:46:08 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcVdF-0007id-CW for guix-devel@gnu.org; Sat, 02 Sep 2023 14:46:07 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1c4f4d67f5bso101197fac.0 for ; Sat, 02 Sep 2023 11:46:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693680364; x=1694285164; darn=gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GUZGyj/7wrqFp9KGIYv4o8XWBPZZhJrFVLGy7DXYtiM=; b=ReNbPTPLwJO2XC+puHjdhSKEJENwpyaY4v4ukNmKWdTzRyu2u43KgdoaflclnSoih3 Mziktl1EnU3b4+EZPKi6J2Uk+QqHbuP/L3FLCfAdqHO7Mu1ISCULTgS0JmC4Tbrfy/aF xDf9F/uMWS55i6X2h6jdMPuQLuUYFfSbw0x3NxHlUhnUkA329MAROAeTbOEE280JbyFk idCLce1NQIa4sVBDKIq1J9aBfcMIS0bSl7A+qbmNgeIcyaDv2Spr3qlFcEdxqVtYsFRW SG/RlRUWHWDoyT2nwY+UwP9DCwVHvOJ9IGZIc8Jhh1RnUfeekpUmTs/wCLaIWzFy+Jhx EsHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693680364; x=1694285164; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GUZGyj/7wrqFp9KGIYv4o8XWBPZZhJrFVLGy7DXYtiM=; b=gD5NO1WS8KA1UkDgU/US7GbhuhdrcHGbi6gvIA1Gd9rh2afYj/Xws4WjXGMPxTRr07 snAIHam2O3ZvY84iBZEG1PhRZQ3WGn7THzMvP4+RN4HpUaiogJwMCjXD4V/r+VkhRXvK cyGp+m89pwP5HPmt7KmSFAnd36Be4rWqaEIowQpEFiFhOAyfEGnt8sPWIpMvSVBLtw4y b6WhMjdpuvUsK2TkKBDgmqQn0qFdXl20vTZCcvF+MRIWAqrfLw2s6+J0saZPyTMnmUdp tysxNpw2TXP6NiUiW2Aj7xqFRHHVd6uS7GwTVp8XUrtHNj+ON9l4VQOYsuQlz0wLrVGI ca8Q== X-Gm-Message-State: AOJu0Yx+WexL25MvjqiPJvU4WQPb82IxBYW5x6keXgWJnvrlhaizn2Jc H7v0mjb1M2ZOKDUANjd6E2+/hRDGUJLz0g== X-Google-Smtp-Source: AGHT+IE5robwp7dnqPyVWDigrpWH2KIDHpiKf+8Vx23eiPHfSPRIThqTobHN/uDEFfyx1crOnX9CBA== X-Received: by 2002:a05:6871:5221:b0:1bb:b13c:7fa4 with SMTP id ht33-20020a056871522100b001bbb13c7fa4mr8069733oac.26.1693680363759; Sat, 02 Sep 2023 11:46:03 -0700 (PDT) Received: from hurd (dsl-154-228.b2b2c.ca. [66.158.154.228]) by smtp.gmail.com with ESMTPSA id e13-20020ac84b4d000000b0041079ba4f6bsm2333819qts.12.2023.09.02.11.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 11:46:03 -0700 (PDT) From: Maxim Cournoyer To: Mark H Weaver Cc: Simon Tournier , Tobias Geerinckx-Rice , Guix Devel Subject: Re: The package/inherit trap References: <20230221130600.18932-1-sharlatanus@gmail.com> <20230226004406.6215-1-sharlatanus@gmail.com> <87ilfmhkuh.fsf_-_@gnu.org> <87lekijcwi.fsf@gmail.com> <87v8jixg6u.fsf@gnu.org> <87o7p94yqk.fsf@gmail.com> <87jzzxy6l0.fsf@nckx> <86lek8dbsf.fsf@gmail.com> <87bkl4y0kh.fsf@gmail.com> <86o7p4a1yt.fsf@gmail.com> <0F2AA797-A329-4E6D-924E-AF5AB9F89064@tobias.gr> <86v8jb8vby.fsf@gmail.com> <87h6pbojgn.fsf@netris.org> <87sf8uewz7.fsf@gmail.com> <878raid40b.fsf@netris.org> Date: Sat, 02 Sep 2023 14:46:02 -0400 In-Reply-To: <878raid40b.fsf@netris.org> (Mark H. Weaver's message of "Thu, 10 Aug 2023 16:40:57 -0400") Message-ID: <87pm30wh05.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=maxim.cournoyer@gmail.com; helo=mail-oa1-x36.google.com 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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx2.migadu.com X-Spam-Score: -8.08 X-Migadu-Queue-Id: 5071D51916 X-Migadu-Spam-Score: -8.08 X-TUID: N8nxS3DEqMw7 Hi Mark, Mark H Weaver writes: [...] > I don't have time to write the doc, but I can offer a few words here. > > The fundamental question that needs to be asked, to decide whether to > write (define DERIVED-PACKAGE (package/inherit BASE OVERRIDES ...)) or > (define DERIVED-PACKAGE (package (inherit BASE) OVERRIDES ...)) is this: > if BASE had a replacement, would it make sense to apply the same > OVERRIDES to BASE's replacement to automatically create a replacement > for DERIVED-PACKAGE? > > Consider 'kodi/wayland' as an example: > > __ (define-public kodi/wayland > ____ (package > ______ (inherit kodi) > ______ (name "kodi-wayland") > ______ (arguments > _______ (substitute-keyword-arguments (package-arguments kodi) > _________ ((#:configure-flags flags) > __________ `(cons "-DCORE_PLATFORM_NAME=wayland" > _________________ (delete "-DCORE_PLATFORM_NAME=x11" ,flags))))) > ______ (inputs > _______ (modify-inputs (package-inputs kodi) > _________ (prepend libinput > __________________ libxkbcommon > __________________ waylandpp > __________________ wayland-protocols))) > ______ (synopsis "Kodi with Wayland rendering backend"))) > > Suppose, at some future time, 'kodi' were given a replacement named > 'kodi-with-fixes' to apply a security update. > > The question to ask yourself is this: would it make sense for > 'kodi/wayland' to automatically be given a replacement field defined > exactly as above except with (inherit kodi) changed to (inherit > kodi-with-fixes)? > > If the answer is "yes", then use (package/inherit BASE OVERRIDES ...), > and make sure that BASE is simply a variable name. > > If the answer is "no", use (package (inherit BASE) OVERRIDES ...), in > which case any replacement of BASE will simply be dropped, and the new > package will not have a replacement unless one is explicitly given in > OVERRIDES. > > The rationale for 'package/inherit' is to ensure that, e.g., security > updates applied to 'kodi' will automatically be propagated to > 'kodi/wayland', and similarly for other packages. > > Unless I'm mistaken, the criterion given above is fully general, and > thus sufficient on its own. However, for the sake of reducing the > cognitive load on contributors, one could proceed to enumerate simpler > heuristics that can be used in common cases. > > For example, if OVERRIDES includes a new 'source' field, the next > question to ask is: does the new 'source' field make an incremental > change to (package-source BASE) e.g. by simply adding another patch? If > so, then 'package/inherit' might do the right thing. However, if the > new 'source' field doesn't even look at (package-source BASE), then it's > certainly not going to work sensibly when applied to BASE's replacement. > > Another common case is when the package you're defining *is* BASE's > replacement. In that case, you certainly don't want to use > 'package/inherit'. > > If you want to rename 'package/inherit', I'd suggest something like > 'package/inherit-with-replacements'. > > Hope this helps. Feel free to do as you wish without consulting me > further. I'm using a private branch that hasn't been merged with > upstream Guix since April 2021, so your decisions won't affect me > in any case. Thank you, that is abundantly detailed and clear; I'll try adapting it in our manual. Cheers! -- Maxim