From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AM48E5Xc6mAnVAAAgWs5BA (envelope-from ) for ; Sun, 11 Jul 2021 13:57:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sPHvDpXc6mAMVgAAbx9fmQ (envelope-from ) for ; Sun, 11 Jul 2021 11:57:09 +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 16D252878E for ; Sun, 11 Jul 2021 13:57:09 +0200 (CEST) Received: from localhost ([::1]:57156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2Y56-0002mC-7L for larch@yhetil.org; Sun, 11 Jul 2021 07:57:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2Y4z-0002ld-VF for guix-patches@gnu.org; Sun, 11 Jul 2021 07:57:01 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2Y4z-0004ME-Ne for guix-patches@gnu.org; Sun, 11 Jul 2021 07:57:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m2Y4z-0007HN-OG for guix-patches@gnu.org; Sun, 11 Jul 2021 07:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49522] [PATCH] weather: Don't look for exported package replacements twice. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Jul 2021 11:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49522 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49522@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162600460627959 (code B ref -1); Sun, 11 Jul 2021 11:57:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jul 2021 11:56:46 +0000 Received: from localhost ([127.0.0.1]:34114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2Y4k-0007Gt-Kn for submit@debbugs.gnu.org; Sun, 11 Jul 2021 07:56:46 -0400 Received: from lists.gnu.org ([209.51.188.17]:44606) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2Y4i-0007Gk-5R for submit@debbugs.gnu.org; Sun, 11 Jul 2021 07:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2Y4h-0002R1-CY for guix-patches@gnu.org; Sun, 11 Jul 2021 07:56:43 -0400 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:41403) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2Y4f-0003uW-LJ for guix-patches@gnu.org; Sun, 11 Jul 2021 07:56:43 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id 5B15227BC81 for ; Sun, 11 Jul 2021 12:56:39 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id e8ee5b3b for ; Sun, 11 Jul 2021 11:56:38 +0000 (UTC) From: Christopher Baines Date: Sun, 11 Jul 2021 12:56:38 +0100 Message-Id: <20210711115638.30207-1-mail@cbaines.net> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=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: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626004629; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: 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; bh=dxIpv8nwOOmMihwn67M5jqYm6yxYwJS6Rg5oPetWnUM=; b=Tj3JmFu1S15FlMrjVtkruMdZEBbIZbV7/y7idDtlaC8wP1oGVsbaMmvquuDL71n14bflf8 xZRb/DP5VeSsc1Au2XUrAnc+VsoSBQNydA1kBBrNQKtmThutdPkTRS36hhcn60X8IyAxoY g1fD/1Ju8K3ZK9u9K3+CRXQrLjcyFbICKXEhzyBH9is3s4rTKrug1UBi0L0Q3cxkok8LN2 whtZR8HcgKlY73hLj8qgU0pdm718Gu31kIzwJyJRsIk9vkxDEvFo64pFAJqfYd8qt9Lj3d uClReZihpoNBkIOuipS/zC4o/TpegBQ7ypGdpjIbVIvA7mwnLisWAu791yMDRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626004629; a=rsa-sha256; cv=none; b=lJ5WhwnfnkiJ8BCSQrZsVyrm+Q6XaRtXcrISfhAnygtLDIG35JjPKxO4p0nws35GcdJlXf ilkXQzSSudOsAlgCbAKYbqyaeBz4gMcD4zEpPnAtqo6US3D+EgHLFKokDW1UQpZfp/0ZFs qd3MMwIdwyLE52HpJhSZV+bPn+yu9AyqzKEIP8WGpUyvij3riKD3hiu/FCAmeaV858dtY/ PDmDRgixMZwVwEMhx5hPKyVNJY9G7p0V1sl9ACKZ6ptUos/D+OU00lBRzNuLPF+X7fbRCt UH5OYcFjvNSbJ0gEk/8huYi2LNwt89tIKBudLcX3MpuGg//3FgypSRmSmjb5ag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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-Migadu-Spam-Score: 2.59 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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-Migadu-Queue-Id: 16D252878E X-Spam-Score: 2.59 X-Migadu-Scanner: scn1.migadu.com X-TUID: l7qJY46a6Nx2 There could be performance issues with member here, but only if there are lots of replacements. * guix/scripts/weather.scm (all-packages): Return all exported packages, plus non exported replacements, rather than including exported replacements twice. --- guix/scripts/weather.scm | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index 06312d65a2..0f70dc8460 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -53,17 +53,30 @@ #:export (guix-weather)) (define (all-packages) - "Return the list of public packages we are going to query." - (fold-packages (lambda (package result) - (match (package-replacement package) - ((? package? replacement) - (cons* replacement package result)) - (#f - (cons package result)))) - '() - - ;; Dismiss deprecated packages but keep hidden packages. - #:select? (negate package-superseded))) + "Return the list of packages we are going to query." + (let* ((packages + (fold-packages (lambda (package result) + (cons package result)) + '() + + ;; Dismiss deprecated packages but keep hidden packages. + #:select? (negate package-superseded))) + (non-exported-replacement-packages + (fold-packages (lambda (package result) + (let ((replacement (package-replacement package))) + (if (and replacement + ;; Avoid double couting replacements + ;; that are themselves exported + (not (member replacement packages))) + (cons replacement result) + result))) + '() + + ;; Dismiss deprecated packages but keep hidden packages. + #:select? (negate package-superseded)))) + (append + packages + non-exported-replacement-packages))) (define (call-with-progress-reporter reporter proc) "This is a variant of 'call-with-progress-reporter' that works with monadic -- 2.32.0