gnu: pypy: Remove unused module imports.
[jackhill/guix/guix.git] / etc / source-manifest.scm
CommitLineData
3b758dd2
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19;;; This file returns a manifest containing origins of all the packages. The
20;;; main purpose is to allow continuous integration services to keep upstream
21;;; source code around. It can also be passed to 'guix weather -m'.
22
23(use-modules (srfi srfi-1) (srfi srfi-26)
24 (ice-9 match) (ice-9 vlist)
25 (guix packages) (guix profiles)
26 (gnu packages))
27
28(define (all-packages)
29 "Return the list of all the packages, public or private, omitting only
30superseded 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)
40 "Return SOURCE without any patches or snippet."
41 (origin (inherit source)
42 (snippet #f) (patches '())))
43
44(define (all-origins)
45 "Return the list of origins referred to by all the packages."
46 (let loop ((packages (all-packages))
47 (origins '())
48 (visited vlist-null))
49 (match packages
50 ((head . tail)
51 (let ((new (remove (cut vhash-assq <> visited)
52 (package-direct-sources head))))
53 (loop tail (append new origins)
54 (fold (cut vhash-consq <> #t <>)
55 visited new))))
56 (()
57 origins))))
58
59;; Return a manifest containing all the origins.
60(manifest (map (lambda (origin)
61 (manifest-entry
62 (name (or (origin-actual-file-name origin)
63 "origin"))
64 (version "0")
65 (item (upstream-origin origin))))
66 (all-origins)))