From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4N4MB39yB2R1dwEASxT56A (envelope-from ) for ; Tue, 07 Mar 2023 18:21:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OKcFB39yB2TcqwAA9RJhRA (envelope-from ) for ; Tue, 07 Mar 2023 18:21:03 +0100 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 97AAA204B2 for ; Tue, 7 Mar 2023 18:21:02 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=UeAmlW4w; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678209662; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6QRbDDVH6o/ytumYy8LG8YndqDJXizJUZivCVyCwSlk=; b=RsVReKZvkhWmqOTRCffL19U3NaxqXWIoBfd7k+Qc6xrzIf5WP5hiSUGOsE9c2bnh4rSjM/ dPu4MbntKLpjFs6PlSSam3C8oNQh3llkXC4bGsOO2iMiK+5u7bvI0kh5ypD0FR3UuwXzbH Frw/B3EjRizMkU85M/5D6Z4enZ9+A49ADAdphn4eN1W1XVyeD/cIw3wSJcY0IS2maWvXER MBNYbiN3UnmV5WMYDawegM/XdLWifl+hZceINs8BFrnK/q9A5GPZVFRayPcJhDv1YZignS UQnwq9LgTERmOB269rnpCJI4rmvNqzHyGD6QcDMrKCnsY32+hIVNCBuTYead/A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678209662; a=rsa-sha256; cv=none; b=r1D6zsMLvzmFC7fE4XDZX93ClP/IHgE4U55ZJzcy+fyJztlkjJOL7qb/ZePP6BGwvC++/A 72DvSzsNyXvOG3S3HGmncjB758lSJ7DNEtpluXH46W79o0XHfUY4dPzpM2i9MPnsXWhd+o PK0C1GmMuOber9/zFpB9XpXURKP60yMAmLW6e4S2g9p3gsd44voVf7Vkq5R4QWukP/X77G oQmhLBiVEuHNbI31NueF4Og7IaC6POs93bMAkQrWLuPnxWtYwsiW3r4sS6mJfglahpTi7A bRDwqdYoR74zAGQ16gJHZwNSU9ziN2YMuaBHEYNlTAL+s4rr7EJ45l1zB/rOwg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=UeAmlW4w; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZayA-0006qe-7L; Tue, 07 Mar 2023 12:19:24 -0500 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 1pZaxt-0006cr-Lr for guix-patches@gnu.org; Tue, 07 Mar 2023 12:19:08 -0500 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 1pZaxt-0007go-9f; Tue, 07 Mar 2023 12:19:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pZaxp-00043K-O9; Tue, 07 Mar 2023 12:19:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#62036] [PATCH] guix: packages: Consider 'patches' by 'package-direct-sources'. Resent-From: Simon Tournier 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: Tue, 07 Mar 2023 17:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62036 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62036@debbugs.gnu.org Cc: Simon Tournier , Christopher Baines , Josselin Poiret , , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.167820952715556 (code B ref -1); Tue, 07 Mar 2023 17:19:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Mar 2023 17:18:47 +0000 Received: from localhost ([127.0.0.1]:47108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZaxa-00042n-N0 for submit@debbugs.gnu.org; Tue, 07 Mar 2023 12:18:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:45514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pZaxY-00042f-5P for submit@debbugs.gnu.org; Tue, 07 Mar 2023 12:18:44 -0500 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 1pZaxX-0004h5-QN for guix-patches@gnu.org; Tue, 07 Mar 2023 12:18:43 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZaxW-0007cd-2Q for guix-patches@gnu.org; Tue, 07 Mar 2023 12:18:43 -0500 Received: by mail-wr1-x42d.google.com with SMTP id v16so12952451wrn.0 for ; Tue, 07 Mar 2023 09:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678209520; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6QRbDDVH6o/ytumYy8LG8YndqDJXizJUZivCVyCwSlk=; b=UeAmlW4wutQUp9NQ7VDDAGhxgsYCyesh7QasCEwTjrfFy00wpgXoDy7v0eJlgOqfnI oBbDP4A6jMZMjoOCR3GiMg62WVjG3onz9OE3UOiPyvlF/xytTKnGmV1jITwOVYvBZ0gj mPkj+JG+A0i6+dNK5IU8Fs5BN90U5G910J0xyyutw6t61xmhQ5xp4NHtybaIaTJoHtqc K7m4BatWJd4hxaR0nlP80BIeU0jOyf36PZQTIyXBwAADRXdFVYHP5h1fMYxzZ5TMXilX CIBvpd8jBdyWEh6dNpI1F0vI3BQgKijPLdU/8rRdGmZJSxxDdlIcWlhipm4ZPrJlB+bf oTIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678209520; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6QRbDDVH6o/ytumYy8LG8YndqDJXizJUZivCVyCwSlk=; b=vUOvYl8J5jtdGXzKRbesytqWwsfz5cUZVUMIPi4xwk0HIPcn/v47KWywBrNBUMOVCR MN0nee/gjt9S8Wdg2ClFB8LqjI/neXnFY2FOKSIMLricbjV0pPfeTAWz2XfmS63JOxZT UvVJQ4DlXZyRvsggPttpCDl13Q5HQH/AlHAIvckvJG12LTmsEjQeeabrMUTuR3qLI8U9 YLibXZCV41TtF8LkU1orzcMUArVH+lgReRmkliKb+cjckaBba6GI3QwTKdoB9IJlZugb AXbnqQE/hxraUPTleR77IOvKZLkH8c3AYEyUAkcPMJxrPgg/3X03EZvum2z3mioBoB5A gqvQ== X-Gm-Message-State: AO0yUKWaZ5wJ72ubXUiFt30iYWv0OAw5KmoyLdagU135L/E7f05PKHM1 i8tdAcM91oOKs+/oy+PoF8KrSs2AYbI= X-Google-Smtp-Source: AK7set82pLYM0JxDbYApO7tqB0cuGUHpt7bR+i+n6Q0WWwDQnmGvKCKSdv8ruSJA1JYIFgUqog1rIg== X-Received: by 2002:adf:fc0d:0:b0:2c7:1755:30ad with SMTP id i13-20020adffc0d000000b002c7175530admr10984311wrr.2.1678209520378; Tue, 07 Mar 2023 09:18:40 -0800 (PST) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id e13-20020a5d65cd000000b002c3f81c51b6sm12807621wrw.90.2023.03.07.09.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 09:18:39 -0800 (PST) From: Simon Tournier Date: Tue, 7 Mar 2023 18:18:33 +0100 Message-Id: <20230307171833.4170067-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42d.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: 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: X-Migadu-Scanner: scn0.migadu.com X-Migadu-Queue-Id: 97AAA204B2 X-Spam-Score: 7.60 X-Migadu-Spam-Score: 7.60 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 X-TUID: /QoHmgUdjLWD * guix/packages.scm (package-direct-sources): Return 'origin' from 'patches'. * tests/packages.scm: Test it. --- guix/packages.scm | 10 ++++++++-- tests/packages.scm | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) Hi, This patch improves some coverage when listing all the origins (fixed outputs) of some packages. The procedure 'packages-direct-sources' already lists the 'origin' as inputs but is missing the 'origin' as 'patches'. For an instance of such, see the package 'ntp'. Note that it is not recursive. If an 'origin' is listed in 'patches' or 'inputs' and that origin also contains 'patches' which is another 'origin' then it will be missed. For now, it is not covered because it somehow adds complexity without an instance (yet) of such case. Cheers, simon diff --git a/guix/packages.scm b/guix/packages.scm index 041a872f9d..0f88564ab4 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2021 Chris Marusich ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2022 jgart +;;; Copyright © 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -1239,8 +1240,13 @@ (define-syntax modify-inputs (define (package-direct-sources package) "Return all source origins associated with PACKAGE; including origins in -PACKAGE's inputs." - `(,@(or (and=> (package-source package) list) '()) +PACKAGE's inputs and patches." + (define (expand source) + (append + (list source) + (filter origin? (origin-patches source)))) + + `(,@(or (and=> (package-source package) expand) '()) ,@(filter-map (match-lambda ((_ (? origin? orig) _ ...) orig) diff --git a/tests/packages.scm b/tests/packages.scm index f58c47817b..27fb918f90 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -418,12 +419,15 @@ (define read-at (let* ((o (dummy-origin)) (u (dummy-origin)) (i (dummy-origin)) + (j (dummy-origin (patches (list o)))) (a (dummy-package "a")) (b (dummy-package "b" (inputs (list a i)))) (c (package (inherit b) (source o))) (d (dummy-package "d" (build-system trivial-build-system) - (source u) (inputs (list c))))) + (source u) (inputs (list c)))) + (e (dummy-package "e" (source j))) + (f (package (inherit e) (inputs (list u))))) (test-assert "package-direct-sources, no source" (null? (package-direct-sources a))) (test-equal "package-direct-sources, #f source" @@ -437,6 +441,17 @@ (define read-at (and (= (length (pk 's-sources s)) 2) (member o s) (member i s)))) + (test-assert "package-direct-sources, with patches" + (let ((s (package-direct-sources e))) + (and (= (length (pk 's-sources s)) 2) + (member o s) + (member j s)))) + (test-assert "package-direct-sources, with patches and inputs" + (let ((s (package-direct-sources f))) + (and (= (length (pk 's-sources s)) 3) + (member o s) + (member j s) + (member u s)))) (test-assert "package-transitive-sources" (let ((s (package-transitive-sources d))) (and (= (length (pk 'd-sources s)) 3) base-commit: 723fc5df3e964fcecb09c7c6fd48f00f97e2e806 -- 2.38.1