From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +s4FC/jk72ArjwAAgWs5BA (envelope-from ) for ; Thu, 15 Jul 2021 09:34:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aGqIBPjk72BpRQAA1q6Kng (envelope-from ) for ; Thu, 15 Jul 2021 07:34:16 +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 85DC72BECA for ; Thu, 15 Jul 2021 09:34:15 +0200 (CEST) Received: from localhost ([::1]:43416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3vss-0007MV-Hg for larch@yhetil.org; Thu, 15 Jul 2021 03:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3vsg-0007Dx-W6 for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3vsg-0000xo-OT for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3vsg-0006wW-Kh for guix-patches@gnu.org; Thu, 15 Jul 2021 03:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#39258] [PATCH v6 1/2] DRAFT packages: Add fields to packages cache. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Jul 2021 07:34:02 +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.162633442626650 (code B ref 39258); Thu, 15 Jul 2021 07:34:02 +0000 Received: (at 39258) by debbugs.gnu.org; 15 Jul 2021 07:33:46 +0000 Received: from localhost ([127.0.0.1]:46665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3vsP-0006vg-OJ for submit@debbugs.gnu.org; Thu, 15 Jul 2021 03:33:46 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:40785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3vsN-0006vF-8O for 39258@debbugs.gnu.org; Thu, 15 Jul 2021 03:33:43 -0400 Received: by mail-wr1-f47.google.com with SMTP id l7so6414785wrv.7 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=/ETrfqt6DlChIkn+STgAdUgzArDXN/30X5H0lAwQnU4=; b=O+jNMlbCW5xz2OPfbZh027qckUJO0bRN+XZ32So/mbYdG0s6PdYzVsQXYSx/sQR9Qh mpGbLlnrI9waYMP61gAZv3Nfe0zCKb6gpawnDLy6H/Vzk4aNY9hVB8CLFLzdtHBLqbuw g2VJsmEomG/kXmaYzEkGNCDSRm5avAUJ2tcQL3w7rS1GqZZDmpAU2vfdZEJ59zlTKWj1 7nwmIhYMMByto+lw4Z2r29b/7pcMqj9+lzLTnGHFBlAaziryjaLc2iO4qFD6NiHVOIvf a/Zo7UJc7vG7Ekl4XCDOLvoeg7+C+0rVWiHOjn1/4qYmsnzLen5kGS058sSBLWMdSve4 x9kA== 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=/ETrfqt6DlChIkn+STgAdUgzArDXN/30X5H0lAwQnU4=; b=sSY0c5555FOAkCoHZCvhqnFAH8eAsyMvWJJPU+THEbLq/atfLcFSuud1uUK/ERSUKq 3bH6g4qMlGOMOTM7D1XJHHIE/HSBeRbSQNGyEO+XFX5ll2Dn6RCEmzmb5RXTk7HkpV46 hsLWMDpYRLoCnhkFKa9yDZl6C/j5ros2RPU8/AEm2JO7JLu97G13FA/P+yxew/kqHlID aIRG5lTAdrGOLZLKqKDJpPhpMFQme9yUIgbXo7jV11Qe0vV4YH7BU3kDHqxKfdHzw/ZA N388nbtc5QM+qawalTy/PY5MmA3ht80yNwcB2B/2GdZpqgtn79UNzqACCxKpCyIwUadg jcBw== X-Gm-Message-State: AOAM530r+HpijDJM4qM+v+iPZ4KJ2RoX5oaoYCUigUqox3JLEyciUNwh JuUP1grLogYVzoz1/nOmPZvohYpZ5i4= X-Google-Smtp-Source: ABdhPJykfFrSsZdXN7lqBguFHEd4FzSOna+Nl1Sxim6YOYkeHn+rwYvDvQouieAOoLjp3hgkn3R19A== X-Received: by 2002:adf:a1c2:: with SMTP id v2mr3657932wrv.155.1626334417589; Thu, 15 Jul 2021 00:33:37 -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:27 +0200 Message-Id: <20210715073328.212123-2-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=1626334455; 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=/ETrfqt6DlChIkn+STgAdUgzArDXN/30X5H0lAwQnU4=; b=Ic+3LZ7LUnwbmcKtGtxfzs3X+BCA249LKinRL0zmBq+0nnP7uc+y46YHLBstWzgXE6PcKy TnxJMTspaxX6p8e6lbqiulpExenl01Qg6ea2Di/J+kWvYXPt0zQNzlzTkLcC2bAXnUnmUB 9HBWJ1QHHgDPNn0jIfZApRwgMhLOpXktPtmjfLJfo3Jh8MtoTBKTc6IA8+28rNrUyqlDhx XMP5oaCVFecOmGj68ghfXrIw/9cF8rX0PI5Haq4K+jbc64DOdxS63SSng3uVF9GwvyKqwr kEapDQSBzcdMabdBmzg4w9KJHSta4K9xwoLBHT36XDIjhBl7uh2+7Co1axmNIQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626334455; a=rsa-sha256; cv=none; b=kvDrHDimDIsJ7PCtQgwVrvSzFrNitVTeZkjOZ49+UzJN0VGLZ6T+W81qI9LTibj1vb12Sd kPLd/cJWDlRJolIyRy16fW2Z3ydmf9tker+EvKoWAjtIkA8TNXMdUdQFG02T63QUBaR9T8 /v2LnbBHu+PqGWZhqFugiK//879KRuZQaqpDv281YhSwG5TdrYL5D0l3Af/L9YbtTYzlLJ Vzt6eTFUrs7twpBxeMUjPifho/eRUHIvecTjV2zhzVvP3QC3+ee1C+vFRmXS+kg5JA1WFu u5bF9QhwxAJAlwei57BZOr/B5oefTq19M+U15DfEpC+MKtO4Z1ocbDzXO9Hy6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=O+jNMlbC; 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=O+jNMlbC; 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: 85DC72BECA X-Spam-Score: 0.20 X-Migadu-Scanner: scn0.migadu.com X-TUID: Y/FdS9eRoh6h * gnu/packages.scm (generate-package-cache)[expand-cache]: Add synopsis and description. (load-package-cache, find-packages-by-names, find-packages-locations): Adapt accordingly. (fold-available-packages): Add synopsis, description, module and symbol when cache is authoritative. Replace 'fold-packages' by 'fold-module-public-variables*' when cache is not authoritative. --- gnu/packages.scm | 52 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/gnu/packages.scm b/gnu/packages.scm index ccfc83dd11..34c6d73b86 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2016, 2017 Alex Kost ;;; Copyright © 2016 Mathieu Lirzin +;;; Copyright © 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -211,28 +212,45 @@ package module." (vhash-fold (lambda (name vector result) (match vector (#(name version module symbol outputs + synopsis description supported? deprecated? file line column) (proc name version result #:outputs outputs + #:synopsis synopsis + #:description description #:location (and file (location file line column)) + #:module module + #:symbol symbol #:supported? supported? #:deprecated? deprecated?)))) init cache) - (fold-packages (lambda (package result) - (proc (package-name package) - (package-version package) - result - #:outputs (package-outputs package) - #:location (package-location package) - #:supported? - (->bool (supported-package? package)) - #:deprecated? - (->bool - (package-superseded package)))) - init))) + (fold-module-public-variables* + (lambda (module symbol variable result) + (let ((package (false-if-exception + (variable-ref variable)))) + (if (package? package) + (proc (package-name package) + (package-version package) + result + #:outputs (package-outputs package) + #:synopsis (package-synopsis package) + #:description (package-description package) + #:location (package-location package) + #:module (module-name module) + #:symbol symbol + #:supported? + (->bool (supported-package? package)) + #:deprecated? + (->bool + (package-superseded package))) + result))) + init + (all-modules (%package-module-path) + #:warn + warn-about-load-error)))) (define* (fold-packages proc init #:optional @@ -268,6 +286,7 @@ package names. Return #f on failure." (fold (lambda (item vhash) (match item (#(name version module symbol outputs + synopsis description supported? deprecated? file line column) (vhash-cons name item vhash)))) @@ -316,7 +335,7 @@ decreasing version order." (if (and (cache-is-authoritative?) cache) (match (cache-lookup cache name) (#f #f) - ((#(_ versions modules symbols _ _ _ _ _ _) ...) + ((#(_ versions modules symbols _ _ _ _ _ _ _ _) ...) (fold (lambda (version* module symbol result) (if (or (not version) (version-prefix? version version*)) @@ -337,9 +356,8 @@ matching NAME and VERSION." (if (and cache (cache-is-authoritative?)) (match (cache-lookup cache name) (#f '()) - ((#(name versions modules symbols outputs - supported? deprecated? - files lines columns) ...) + ((#(_ versions _ _ _ _ _ _ _ + files lines columns) ...) (fold (lambda (version* file line column result) (if (and file (or (not version) @@ -393,6 +411,8 @@ reducing the memory footprint." ,(module-name module) ,symbol ,(package-outputs package) + ,(package-synopsis package) + ,(package-description package) ,(->bool (supported-package? package)) ,(->bool (package-superseded package)) ,@(let ((loc (package-location package))) -- 2.32.0