~ruther/guix-local

ref: cfc5ec77a72d4e4d04d4e93aa8dee8462baa2cf7 guix-local/etc/teams/release/os-manifest-generator.scm -rw-r--r-- 3.2 KiB
cfc5ec77 — Hugo Buddelmeijer gnu: guile-2.2.4: Fix build by using libxcrypt-without-failure-tokens. 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;;; GNU Guix --- Functional package management for GNU
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(use-modules (guix packages)
             (guix gexp)
             (gnu services)
             (gnu tests install)
             (ice-9 match)
             (guix utils)
             (srfi srfi-26)
             (srfi srfi-1))

;; TODO find a better way to check for thunked fields
(define* (thunked-field? field obj)
  (and
   (procedure? obj)
   (eq?
    (car (procedure-minimum-arity obj))
    1)
   ; Uhhh
   (string-suffix? "(x)>"
                   (format #f "~a" obj))))

;; Prints names of all packages, prepending the service they
;; come from.
(define* (print-all-packages obj #:optional (pred package?))
  (match obj
    ((? pred)
     (format #t "\"~a\"~%" (package-name obj))
     (list obj))
    ((? gexp?)
     (list))
    ((a . b)
     (append (print-all-packages a pred)
           (print-all-packages b pred)))
    ((_ ...)
     (apply append
            (map (cut print-all-packages <> pred)
                 obj)))
    (#(_ ...)
     (print-all-packages (vector->list obj) proc))
    ((or (? service-type?)
         (? origin?))
     (list))
    ((? record?)
      (let* ((record-type (record-type-descriptor obj))
             (record-fields (record-type-fields record-type)))
        (when (service? obj)
          (format #t ";; ~a-service~%" (service-type-name (service-kind obj))))
        (apply append
               (map (lambda (field)
                      (let* ((accessor (record-accessor record-type field))
                             (field-obj (accessor obj)))
                        (if (thunked-field? field field-obj)
                            (print-all-packages (field-obj obj) pred)
                            (print-all-packages field-obj pred))))
                    record-fields))))
    ((? parameter?)
     (list))
    (_
     (list))))

(define full-installer-os
  ((@@ (gnu tests install) installation-target-desktop-os-for-gui-tests)))

(define minimal-installer-os
  ((@@ (gnu tests install) installation-target-os-for-gui-tests)))

(display "Full os packages:")
(print-all-packages full-installer-os)
(display "Minimal os packages:")
(print-all-packages minimal-installer-os)

;; Note that the printed packages will contain duplicates.
;; I recommend to first put packages out of the profile service
;; and out of packages field (they will be above service packages)
;; at the bottom of the list and then filtering only unique lines, ie.
;; with `awk '!a[$0]++'`. And lastly removing services that no longer
;; have packages and also the packages that are already in minimal manifest
;; (in case of desktop manifest)