unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 74542@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Christopher Baines" <guix@cbaines.net>,
	"Josselin Poiret" <dev@jpoiret.xyz>,
	"Ludovic Court?s" <ludo@gnu.org>,
	"Mathieu Othacehe" <othacehe@gnu.org>,
	"Simon Tournier" <zimon.toutoune@gmail.com>,
	"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#74542] [PATCH 05/11] packages: Factorize ‘all-packages’.
Date: Tue, 26 Nov 2024 11:33:44 +0100	[thread overview]
Message-ID: <21b5368441ff34f5a54b78550b87d97ca765785e.1732615193.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1732615193.git.ludo@gnu.org>

* gnu/packages.scm (all-packages): New procedure.
* etc/source-manifest.scm (all-packages): Remove.
* guix/scripts/graph.scm (all-packages): Remove.
* guix/scripts/refresh.scm (all-packages): Remove.
* guix/scripts/weather.scm (all-packages): Remove.

Change-Id: I6072952c4b877b541037ce86402cfb7744eeb0a0
---
 etc/source-manifest.scm  | 13 +------------
 gnu/packages.scm         | 20 +++++++++++++++++++-
 guix/scripts/graph.scm   | 10 ----------
 guix/scripts/refresh.scm | 10 ----------
 guix/scripts/weather.scm | 15 ---------------
 5 files changed, 20 insertions(+), 48 deletions(-)

diff --git a/etc/source-manifest.scm b/etc/source-manifest.scm
index f96a5da6f7..3e1ae07959 100644
--- a/etc/source-manifest.scm
+++ b/etc/source-manifest.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021, 2024 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,17 +25,6 @@
              (guix packages) (guix profiles)
              (gnu packages))
 
-(define (all-packages)
-  "Return the list of all the packages, public or private, omitting only
-superseded packages."
-  (fold-packages (lambda (package lst)
-                   (match (package-replacement package)
-                     (#f (cons package lst))
-                     (replacement
-                      (append (list replacement package) lst))))
-                 '()
-                 #:select? (negate package-superseded)))
-
 (define (upstream-origin source)
   "Return SOURCE without any patches or snippet."
   (origin (inherit source)
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 80c22d1d7f..1af3b8d440 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2020, 2022-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2020, 2022-2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
@@ -56,6 +56,7 @@ (define-module (gnu packages)
             cache-is-authoritative?
 
             fold-packages
+            all-packages
             fold-available-packages
 
             find-newest-available-packages
@@ -253,6 +254,23 @@ (define* (fold-packages proc init
                                 init
                                 modules))
 
+(define all-packages
+  (mlambda ()
+    "Return the list of all public packages, including replacements and hidden
+packages, excluding superseded packages."
+    (delete-duplicates
+     (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))
+     eq?)))
+
 (define %package-cache-file
   ;; Location of the package cache.
   "/lib/guix/package.cache")
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm
index 6740858d8b..935721edea 100644
--- a/guix/scripts/graph.scm
+++ b/guix/scripts/graph.scm
@@ -119,16 +119,6 @@ (define %package-node-type
 ;;; Reverse package DAG.
 ;;;
 
-(define (all-packages)            ;XXX: duplicated from (guix scripts refresh)
-  "Return the list of all the distro's packages."
-  (fold-packages (lambda (package result)
-                   ;; Ignore deprecated packages.
-                   (if (package-superseded package)
-                       result
-                       (cons package result)))
-                 '()
-                 #:select? (const #t)))           ;include hidden packages
-
 (define %reverse-package-node-type
   ;; For this node type we first need to compute the list of packages and the
   ;; list of back-edges.  Since we want to do it only once, we use the
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index ec7d38c22a..8c72d0c545 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -455,16 +455,6 @@ (define* (check-for-package-update update-spec updaters #:key warn?)
 ;;; Dependents.
 ;;;
 
-(define (all-packages)
-  "Return the list of all the distro's packages."
-  (fold-packages (lambda (package result)
-                   ;; Ignore deprecated packages.
-                   (if (package-superseded package)
-                       result
-                       (cons package result)))
-                 '()
-                 #:select? (const #t)))           ;include hidden packages
-
 (define (list-dependents packages)
   "List all the things that would need to be rebuilt if PACKAGES are changed."
   ;; Using %BAG-NODE-TYPE is more accurate than using %PACKAGE-NODE-TYPE
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 08a1b22a74..29432fd923 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -55,21 +55,6 @@ (define-module (guix scripts weather)
   #:use-module (ice-9 vlist)
   #:export (guix-weather))
 
-(define (all-packages)
-  "Return the list of public packages we are going to query."
-  (delete-duplicates
-   (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))
-   eq?))
-
 (define (call-with-progress-reporter reporter proc)
   "This is a variant of 'call-with-progress-reporter' that works with monadic
 scope."
-- 
2.46.0





  parent reply	other threads:[~2024-11-26 10:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 10:32 [bug#74542] [PATCH 00/11] Improved tooling for package updates Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 01/11] transformations: Export ‘package-with-upstream-version’ Ludovic Courtès
2024-11-26 15:00   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 02/11] gnu-maintenance: ‘import-html-release’ doesn’t abort upon HTTP 404 Ludovic Courtès
2024-11-26 15:09   ` Simon Tournier
2024-11-26 17:16     ` Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 03/11] gnu-maintenance: Savannah/Xorg updaters no longer abort on network errors Ludovic Courtès
2024-11-26 15:12   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 04/11] build: Add ‘--development’ option Ludovic Courtès
2024-11-26 15:26   ` Simon Tournier
2024-11-26 10:33 ` Ludovic Courtès [this message]
2024-11-26 10:33 ` [bug#74542] [PATCH 06/11] guix build: Add ‘--dependents’ Ludovic Courtès
2024-11-26 10:33 ` [bug#74542] [PATCH 07/11] import: gnome: Keep going upon HTTP errors Ludovic Courtès
2024-11-26 15:26   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 08/11] gnu-maintenance: ‘gnu-ftp’ updater excludes GnuPG-hosted packages Ludovic Courtès
2024-11-26 15:28   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 09/11] gnu: Update updater properties for GnuPG-related packages Ludovic Courtès
2024-11-26 15:28   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 10/11] guix build: Validate that the file passed to ‘-m’ returns a manifest Ludovic Courtès
2024-11-26 15:36   ` Simon Tournier
2024-11-26 10:33 ` [bug#74542] [PATCH 11/11] etc: Add upgrade manifest Ludovic Courtès
2024-11-26 15:49   ` Simon Tournier
2024-11-26 17:18     ` Ludovic Courtès
2024-11-26 14:42 ` [bug#74542] [PATCH 00/11] Improved tooling for package updates Ludovic Courtès
2024-11-26 16:04   ` Simon Tournier
2024-11-26 14:59 ` Simon Tournier
2024-11-26 17:21   ` Ludovic Courtès
2024-11-26 16:32 ` Suhail Singh
2024-11-26 17:23   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=21b5368441ff34f5a54b78550b87d97ca765785e.1732615193.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=74542@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).