From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wLKaH/Lk72DfjgAAgWs5BA (envelope-from ) for ; Thu, 15 Jul 2021 09:34:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 2LySGfLk72CuZwAAB5/wlQ (envelope-from ) for ; Thu, 15 Jul 2021 07:34:10 +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 157AC2C087 for ; Thu, 15 Jul 2021 09:34:10 +0200 (CEST) Received: from localhost ([::1]:43314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3vsn-0007Hs-4z for larch@yhetil.org; Thu, 15 Jul 2021 03:34:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3vsh-0007Eh-I2 for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3vsh-0000yl-9u for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3vsh-0006wf-35 for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#39258] [PATCH v6 2/2] DRAFT scripts: package: Use cache in 'find-packages-by-description'. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Jul 2021 07:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39258 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 39258@debbugs.gnu.org Cc: ludo@gnu.org, arunisaac@systemreboot.net, zimoun Received: via spool by 39258-submit@debbugs.gnu.org id=B39258.162633442826660 (code B ref 39258); Thu, 15 Jul 2021 07:34:03 +0000 Received: (at 39258) by debbugs.gnu.org; 15 Jul 2021 07:33:48 +0000 Received: from localhost ([127.0.0.1]:46667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3vsS-0006vu-6y for submit@debbugs.gnu.org; Thu, 15 Jul 2021 03:33:48 -0400 Received: from mail-wr1-f41.google.com ([209.85.221.41]:43748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3vsN-0006vI-M8 for 39258@debbugs.gnu.org; Thu, 15 Jul 2021 03:33:44 -0400 Received: by mail-wr1-f41.google.com with SMTP id a13so6388669wrf.10 for <39258@debbugs.gnu.org>; Thu, 15 Jul 2021 00:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q96Oqdu7AN+kHj5/yhfWJ5qZNWVSRHSqyOco2OpaOS0=; b=o4MUinOnfDyJOuYrV8XNTr2wgth12z0/2DOIUhFi5mM/z7+ksPWn4JvFZwAoGwDBU+ DPWbVFfw3F6jZWcbIotJv+ALbSZUijFG3iu7PEZPWes2gsBuSKTaHQxrgyp3kDpkMcgd 4+TY7zFWE6f2v8W8tbjwpe+NsokOK/7m893nc2DjrTZHreNK4KV4T9/Y8g+BspDeQO1E CwXAXi6uMyt//XGddKn3TUnwG9MHrN7xRj8EEetJyJd+IYHH8fEck8tdue/gVkmulBbk zDS1RThQP+m6VqKnTRPcTOCB95KmA8DfUh5gw5Y5qK725T+SYUiTm3BKoNL9h5gpnHSY kcdw== 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q96Oqdu7AN+kHj5/yhfWJ5qZNWVSRHSqyOco2OpaOS0=; b=LL+NCX0Ppw0jbIWo+z8QNq/jbtYslKyxFk+AOmM7rAFmAEk9vMneEBiudxTcGSvUfl O9qgOON727gBO0mQoer4SJxYR9nxrCLdkC9x19QjZZGnC7KzaHx44E2ITUjWiNs9ngMA Y9eCS7kCqsSjdaw5UlUJc+LM4A7UA3oxHcEDtc7Fk5M/R5Jpm2ycoiPKlca4wT7Dkwr9 i15n6qdw095De2JzpOPOUB3JqKPSJCRoQiYYB0IN9EzQGtCrXCRPyDk5n3OocyX/Gijy gYy7sGFLfBkQ+qJDHvbKQ996lxckpv0iT9ZzkvZwxek5CHe5bXKGqph2eh0g/wFzl0ir DEAQ== X-Gm-Message-State: AOAM530hcQ6bZ8htDfI9VdGiRFMG+2w+PqO3Ythf7eVNfu4/D3BmSOUm V4JL5wvYb/pPUUH9UAa//wLSfYs/FSM= X-Google-Smtp-Source: ABdhPJzbzCalx+tl+6TfRqV6nVv1R4h5gUVcklKnl+8PyXB71NjMQJ3lZqReLZS3z/Tr7NthXBRzxQ== X-Received: by 2002:adf:ed07:: with SMTP id a7mr3822135wro.70.1626334418108; Thu, 15 Jul 2021 00:33:38 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id y3sm5376205wrh.16.2021.07.15.00.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 00:33:37 -0700 (PDT) From: zimoun Date: Thu, 15 Jul 2021 09:33:28 +0200 Message-Id: <20210715073328.212123-3-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715073328.212123-1-zimon.toutoune@gmail.com> References: <20210715073328.212123-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626334450; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Q96Oqdu7AN+kHj5/yhfWJ5qZNWVSRHSqyOco2OpaOS0=; b=o60kJavS9ExWBc+BoD9+5X/ueCid9zZmk7Q4TAySrZ5rN+mb6WaTIZRp1S1hGJkVcYp7HL v1Z+mLhJQupcrMuPatIuU4HpKz919KtjZ72/G1evNypmh9GyseY4zMj3H/Q0HjGi44qfH/ feu6L+ldvjVWqU++Dy76GuBCJrqa/qcys/NjwOEndjj2dZCfdER8dhTiUnw8OlCvte9roQ qRta4HK0MAh4lSEtR3P2Pe88a+oPCsVIKRRu6gs6q+QVT8D2C1/CFTaQxV7MnlNjwy43D0 p2147MbGA284VjeBBkL9quhHPdf6EONdsX5hurzUwtSjgzfGGLd4Sh6oz0LCzQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626334450; a=rsa-sha256; cv=none; b=s0OwSL/B9SXRobVXjo5qRJQ8OWdp3srk54tuZH60GkN1/SIsrjzNwN++2gtFaKUT0VrlmA OYYOJDqixQo7IHIXG8H0k6kaGuDQ1iNHq3An2Skmqr7VQAFcXeYUzHKm/vSoMAfwT8m/5k VL7LVA5IrEBIS7VBgSZkjdVW71+sLIKlm89uIg42fcZgySC5QPKEw3GblLJnKAQiSk0CMH Ro7gE5tSqQyGDluMnKCCtb8PCBuzy/e6c9Onx1T+bluMa9hMtI8Gc/pqtZIOimpdokEruX KLd6eGQz2iQg/s07b9AbGGWfhknZB2VxKDvUZJ874pC+7+gBeZVjFWVmciWHCA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=o4MUinOn; 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-Migadu-Spam-Score: 0.20 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=o4MUinOn; 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-Migadu-Queue-Id: 157AC2C087 X-Spam-Score: 0.20 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0Cdzp2IGoqjB * guix/scripts/package.scm (find-packages-by-description): Replace 'fold-packages' by 'fold-available-packages'. --- guix/scripts/package.scm | 46 +++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 694959d326..ff2aed6905 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; Copyright © 2020 Ricardo Wurmus -;;; Copyright © 2020 Simon Tournier +;;; Copyright © 2020, 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -181,17 +181,39 @@ hooks\" run when building the profile." "Return a list of pairs: packages whose name, synopsis, description, or output matches at least one of REGEXPS sorted by relevance, and its non-zero relevance score." - (let ((matches (fold-packages (lambda (package result) - (if (package-superseded package) - result - (match (package-relevance package - regexps) - ((? zero?) - result) - (score - (cons (cons package score) - result))))) - '()))) + (define (read-package-from module symbol) + (module-ref (resolve-interface module) symbol)) + + (let ((matches (fold-available-packages + (lambda* (name version result + #:key outputs description synopsis location + module symbol + deprecated? + #:allow-other-keys) + (if deprecated? + result + (let* ((package + (package + (name name) + (version version) + (source #f) + (build-system #f) + (outputs outputs) + (synopsis synopsis) + (description description) + (home-page #f) + (license #f) + (location location)))) + (match (package-relevance package + regexps) + ((? zero?) + result) + (score + (cons (cons (read-package-from module symbol) + score) + result)))))) + '()))) + (sort matches (lambda (m1 m2) (match m1 -- 2.32.0