From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GHc0KDC7dGQPcwEASxT56A (envelope-from ) for ; Mon, 29 May 2023 16:48:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iE4VKDC7dGScDAAAauVa8A (envelope-from ) for ; Mon, 29 May 2023 16:48:16 +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 6940E30E32 for ; Mon, 29 May 2023 16:48:16 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3e9f-0002Ol-Np; Mon, 29 May 2023 10:47:27 -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 1q3e9O-00028T-H2 for guix-patches@gnu.org; Mon, 29 May 2023 10:47:12 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3e9O-00035Y-8D; Mon, 29 May 2023 10:47:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3e9N-0001Ql-0O; Mon, 29 May 2023 10:47:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63571] [PATCH v2 18/19] upstream: Honor package properties for ignored and extra inputs. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: mail@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 29 May 2023 14:47:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63571 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63571@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 63571-submit@debbugs.gnu.org id=B63571.16853716185343 (code B ref 63571); Mon, 29 May 2023 14:47:08 +0000 Received: (at 63571) by debbugs.gnu.org; 29 May 2023 14:46:58 +0000 Received: from localhost ([127.0.0.1]:58797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e9B-0001Ny-8o for submit@debbugs.gnu.org; Mon, 29 May 2023 10:46:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3e8J-0001Jq-Pb for 63571@debbugs.gnu.org; Mon, 29 May 2023 10:46:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3e8E-0002gr-IT; Mon, 29 May 2023 10:45:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=xHJkI/EXECaO6ZFnNjXQdPtLzxbH/PfUAYOl/Ajh9mw=; b=AVysLTdlba+/hwPM2QuG GQTcc1WCnzVrFFryjTn86LE0DhQK3SeS+hd+WWrLPUEvsyj43v81/tf/MTvRhxXdcKJGvatiy5Ppm l2ALUdM20e/NFxvcalPK7p/bwmXI5EMpnz09naQXDRWyw0LYXfNwHlfRBZBavE/NqALpaQUzyUQIS 9Mzv9pLGE1+LB8W0cl2qMw48KlVpaB/NkDu73GjscGPuOMUj9GUc1PbpjWdA/ZZIlNSwliJDdlbyR AP3Bp9SIPioN7KdYBwf127EtiyqZOS5Sfm9w5GzLEfRnRrqVhfmRX8SETKNyINGZfrUWEdkTDTrLb jpZeCKLLmbRlAg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3e8E-00044B-5I; Mon, 29 May 2023 10:45:58 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Mon, 29 May 2023 16:45:29 +0200 Message-Id: <04e9c2249a49f86a49b5af638ceecb8379fd9a37.1685371175.git.ludo@gnu.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <87y1l7fb9j.fsf@gnu.org> References: <87y1l7fb9j.fsf@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685371696; a=rsa-sha256; cv=none; b=eYACg6aR8bfP5zUt4aA/FUOXNj1+Wkw3vZcXbTPqA1+3TodlkRmzelBLbQu9LLITqB+ATv ClgDe2p/FpjZVo48Hrj/BRIYB3R2HGko8kJnYKNor2Hf+E9xvFe5i+byaRv/sR1sorJOJW +T2CJue1iTwc9B/LGfqs/xgi5NB9R2bEcX/B6tGvdXFx0Yh2wb5nZ29Oa8/YgkLf1TSWUJ 6UX2hdxmyeP7Clofv8SV5ymMqwYVL1RC0WOWzPdPZIXlsR7Y5aDJP629rSqhSgmJlfsqMv /UJwqbsNJ0/iIDK4VfYsj2dDH2iTJP1115pVqlOyJ/XBgQkUy0tzAsLDmwxuzA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=AVysLTdl; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685371696; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xHJkI/EXECaO6ZFnNjXQdPtLzxbH/PfUAYOl/Ajh9mw=; b=SFEw41h0TpdW377RbG40DbBJOhPBu/7BXYWkGrs33a0wUhBAu3uuLcuu/Y7LOtmGXrcY85 t3BSCTsLSBFfAGMPJwsLSBz1zaQjkyZ0vpEzElrahyWCJoZOJ+GxENNkY3Cck501ot5a0l NPeo67XFQkWTytXU42QN2RB+Fp9FE3TmGcMiq6jMPeV9KSu3G2Dkf/yOz3LZ233i3tOy/V tkbB2igha284j06L8vATTRz/qyM2O/80TUejnIZwtJyAuo/CEqTgP71KdGX8ySlja47VFr 8SXUxgpvjry+FsIOQs/V1hXfSfI2iq7kVlv1e5TqXOi/iLccB13ygiCG+/6Ytw== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=AVysLTdl; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.05 X-Spam-Score: -1.05 X-Migadu-Queue-Id: 6940E30E32 X-TUID: RE6sTqlWwGjG * guix/upstream.scm (update-package-inputs)[filtered-inputs] [regular-inputs, native-inputs, propagated-inputs]: New procedures. Use them in 'update-field' calls. * tests/guix-refresh.sh (GUIX_TEST_UPDATER_TARGETS): Add "libreoffice" to the dependencies of "the-test-package". Add 'updater-ignored-inputs' property to "the-test-package". * doc/guix.texi (Invoking guix refresh): Document it. --- doc/guix.texi | 30 ++++++++++++++++++++++++++++++ guix/upstream.scm | 39 ++++++++++++++++++++++++++++++++++++--- tests/guix-refresh.sh | 5 +++-- 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index c54a72bfaa..33528e997e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14358,6 +14358,36 @@ Invoking guix refresh @xref{Creating a Channel}, on how to create a channel. +This command updates the version and source code hash of the package. +Depending on the updater being used, it can also update the various +@samp{inputs} fields of the package. In some cases, the updater might +get inputs wrong---it might not know about an extra input that's +necessary, or it might add an input that should be avoided. + +@cindex @code{updater-extra-inputs}, package property +@cindex @code{updater-ignored-inputs}, package property +To address that, packagers can add properties stating inputs that should +be added to those found by the updater or inputs that should be ignored: +the @code{updater-extra-inputs} and @code{updater-ignored-inputs} +properties pertain to ``regular'' inputs, and there are equivalent +properties for @samp{native} and @samp{propagated} inputs. In the +example below, we tell the updater that we need @samp{openmpi} as an +additional input: + +@lisp +(define-public python-mpi4py + (package + (name "python-mpi4py") + ;; @dots{} + (inputs (list openmpi)) + (properties + '((updater-extra-inputs . ("openmpi")))))) +@end lisp + +That way, @command{guix refresh -u python-mpi4py} will leave the +@samp{openmpi} input, even if it is not among the inputs it would +normally add. + @item --select=[@var{subset}] @itemx -s @var{subset} Select all the packages in @var{subset}, one of @code{core}, @code{non-core} diff --git a/guix/upstream.scm b/guix/upstream.scm index 53e473715c..33248d645c 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -557,11 +557,44 @@ (define (update-package-inputs package source) (G_ "~a: expected '~a' value: ~s~%") (package-name package) field new)))) + (define (filtered-inputs source-inputs extra-property ignore-property) + ;; Return a procedure that behaves like SOURCE-INPUTS but additionally + ;; honors EXTRA-PROPERTY and IGNORE-PROPERTY from PACKAGE. + (lambda (source) + (let* ((inputs (source-inputs source)) + (properties (package-properties package)) + (ignore (or (assoc-ref properties ignore-property) '())) + (extra (or (assoc-ref properties extra-property) '()))) + (append (if (null? ignore) + inputs + (remove (lambda (input) + (member (upstream-input-downstream-name input) + ignore)) + inputs)) + (map (lambda (name) + (upstream-input + (name name) + (downstream-name name))) + extra))))) + + (define regular-inputs + (filtered-inputs upstream-source-regular-inputs + 'updater-extra-inputs + 'updater-ignored-inputs)) + (define native-inputs + (filtered-inputs upstream-source-native-inputs + 'updater-extra-native-inputs + 'updater-ignored-native-inputs)) + (define propagated-inputs + (filtered-inputs upstream-source-propagated-inputs + 'updater-extra-propagated-inputs + 'updater-ignored-propagated-inputs)) + (for-each update-field '(inputs native-inputs propagated-inputs) - (list upstream-source-regular-inputs - upstream-source-native-inputs - upstream-source-propagated-inputs) + (list regular-inputs + native-inputs + propagated-inputs) (list package-inputs package-native-inputs package-propagated-inputs))) diff --git a/tests/guix-refresh.sh b/tests/guix-refresh.sh index 9d7a57a36e..51d34c4b51 100644 --- a/tests/guix-refresh.sh +++ b/tests/guix-refresh.sh @@ -35,7 +35,7 @@ GUIX_TEST_UPDATER_TARGETS=' ("libreoffice" "" (("1.0" "file:///dev/null"))) ("idutils" "" (("'$idutils_version'" "file:///dev/null"))) ("the-test-package" "" (("5.5" "file://'$PWD/$module_dir'/source" - ("grep" "sed")))))' + ("grep" "sed" "libreoffice")))))' # No newer version available. guix refresh -t test idutils # XXX: should return non-zero? @@ -93,7 +93,8 @@ cat > "$module_dir/sample.scm"<