diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2024-11-25 14:30:28 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2024-12-01 20:14:15 +0100 |
| commit | 4b5dae8defe4c0d5e98b5ce6abba853007485f23 (patch) | |
| tree | aa400c2eb90fc7a7d929f2c25c6daea00705133b | |
| parent | a6334223719bf6b2695d2dc0e75dbfe69e901bd7 (diff) | |
packages: Factorize ‘all-packages’.
* 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
| -rw-r--r-- | etc/source-manifest.scm | 13 | ||||
| -rw-r--r-- | gnu/packages.scm | 20 | ||||
| -rw-r--r-- | guix/scripts/graph.scm | 10 | ||||
| -rw-r--r-- | guix/scripts/refresh.scm | 10 | ||||
| -rw-r--r-- | 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 f96a5da6f71..3e1ae079592 100644 --- a/etc/source-manifest.scm +++ b/etc/source-manifest.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2021, 2024 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -25,17 +25,6 @@ | |||
| 25 | (guix packages) (guix profiles) | 25 | (guix packages) (guix profiles) |
| 26 | (gnu packages)) | 26 | (gnu packages)) |
| 27 | 27 | ||
| 28 | (define (all-packages) | ||
| 29 | "Return the list of all the packages, public or private, omitting only | ||
| 30 | superseded packages." | ||
| 31 | (fold-packages (lambda (package lst) | ||
| 32 | (match (package-replacement package) | ||
| 33 | (#f (cons package lst)) | ||
| 34 | (replacement | ||
| 35 | (append (list replacement package) lst)))) | ||
| 36 | '() | ||
| 37 | #:select? (negate package-superseded))) | ||
| 38 | |||
| 39 | (define (upstream-origin source) | 28 | (define (upstream-origin source) |
| 40 | "Return SOURCE without any patches or snippet." | 29 | "Return SOURCE without any patches or snippet." |
| 41 | (origin (inherit source) | 30 | (origin (inherit source) |
diff --git a/gnu/packages.scm b/gnu/packages.scm index 80c22d1d7f5..1af3b8d440a 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012-2020, 2022-2023 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012-2020, 2022-2024 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> | 3 | ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> | 4 | ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> |
| 5 | ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com> | 5 | ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com> |
| @@ -56,6 +56,7 @@ | |||
| 56 | cache-is-authoritative? | 56 | cache-is-authoritative? |
| 57 | 57 | ||
| 58 | fold-packages | 58 | fold-packages |
| 59 | all-packages | ||
| 59 | fold-available-packages | 60 | fold-available-packages |
| 60 | 61 | ||
| 61 | find-newest-available-packages | 62 | find-newest-available-packages |
| @@ -253,6 +254,23 @@ is guaranteed to never traverse the same package twice." | |||
| 253 | init | 254 | init |
| 254 | modules)) | 255 | modules)) |
| 255 | 256 | ||
| 257 | (define all-packages | ||
| 258 | (mlambda () | ||
| 259 | "Return the list of all public packages, including replacements and hidden | ||
| 260 | packages, excluding superseded packages." | ||
| 261 | (delete-duplicates | ||
| 262 | (fold-packages (lambda (package result) | ||
| 263 | (match (package-replacement package) | ||
| 264 | ((? package? replacement) | ||
| 265 | (cons* replacement package result)) | ||
| 266 | (#f | ||
| 267 | (cons package result)))) | ||
| 268 | '() | ||
| 269 | |||
| 270 | ;; Dismiss deprecated packages but keep hidden packages. | ||
| 271 | #:select? (negate package-superseded)) | ||
| 272 | eq?))) | ||
| 273 | |||
| 256 | (define %package-cache-file | 274 | (define %package-cache-file |
| 257 | ;; Location of the package cache. | 275 | ;; Location of the package cache. |
| 258 | "/lib/guix/package.cache") | 276 | "/lib/guix/package.cache") |
diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm index 6740858d8b8..935721edea8 100644 --- a/guix/scripts/graph.scm +++ b/guix/scripts/graph.scm | |||
| @@ -119,16 +119,6 @@ name." | |||
| 119 | ;;; Reverse package DAG. | 119 | ;;; Reverse package DAG. |
| 120 | ;;; | 120 | ;;; |
| 121 | 121 | ||
| 122 | (define (all-packages) ;XXX: duplicated from (guix scripts refresh) | ||
| 123 | "Return the list of all the distro's packages." | ||
| 124 | (fold-packages (lambda (package result) | ||
| 125 | ;; Ignore deprecated packages. | ||
| 126 | (if (package-superseded package) | ||
| 127 | result | ||
| 128 | (cons package result))) | ||
| 129 | '() | ||
| 130 | #:select? (const #t))) ;include hidden packages | ||
| 131 | |||
| 132 | (define %reverse-package-node-type | 122 | (define %reverse-package-node-type |
| 133 | ;; For this node type we first need to compute the list of packages and the | 123 | ;; For this node type we first need to compute the list of packages and the |
| 134 | ;; list of back-edges. Since we want to do it only once, we use the | 124 | ;; 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 ec7d38c22a4..8c72d0c5450 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm | |||
| @@ -455,16 +455,6 @@ releases for ~a~%") | |||
| 455 | ;;; Dependents. | 455 | ;;; Dependents. |
| 456 | ;;; | 456 | ;;; |
| 457 | 457 | ||
| 458 | (define (all-packages) | ||
| 459 | "Return the list of all the distro's packages." | ||
| 460 | (fold-packages (lambda (package result) | ||
| 461 | ;; Ignore deprecated packages. | ||
| 462 | (if (package-superseded package) | ||
| 463 | result | ||
| 464 | (cons package result))) | ||
| 465 | '() | ||
| 466 | #:select? (const #t))) ;include hidden packages | ||
| 467 | |||
| 468 | (define (list-dependents packages) | 458 | (define (list-dependents packages) |
| 469 | "List all the things that would need to be rebuilt if PACKAGES are changed." | 459 | "List all the things that would need to be rebuilt if PACKAGES are changed." |
| 470 | ;; Using %BAG-NODE-TYPE is more accurate than using %PACKAGE-NODE-TYPE | 460 | ;; 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 08a1b22a746..29432fd9239 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm | |||
| @@ -55,21 +55,6 @@ | |||
| 55 | #:use-module (ice-9 vlist) | 55 | #:use-module (ice-9 vlist) |
| 56 | #:export (guix-weather)) | 56 | #:export (guix-weather)) |
| 57 | 57 | ||
| 58 | (define (all-packages) | ||
| 59 | "Return the list of public packages we are going to query." | ||
| 60 | (delete-duplicates | ||
| 61 | (fold-packages (lambda (package result) | ||
| 62 | (match (package-replacement package) | ||
| 63 | ((? package? replacement) | ||
| 64 | (cons* replacement package result)) | ||
| 65 | (#f | ||
| 66 | (cons package result)))) | ||
| 67 | '() | ||
| 68 | |||
| 69 | ;; Dismiss deprecated packages but keep hidden packages. | ||
| 70 | #:select? (negate package-superseded)) | ||
| 71 | eq?)) | ||
| 72 | |||
| 73 | (define (call-with-progress-reporter reporter proc) | 58 | (define (call-with-progress-reporter reporter proc) |
| 74 | "This is a variant of 'call-with-progress-reporter' that works with monadic | 59 | "This is a variant of 'call-with-progress-reporter' that works with monadic |
| 75 | scope." | 60 | scope." |
