From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 15 03:33:46 2021 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 To: 39258@debbugs.gnu.org Subject: [PATCH v6 1/2] DRAFT packages: Add fields to packages cache. 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-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39258 Cc: ludo@gnu.org, arunisaac@systemreboot.net, zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * 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