unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 9a432de9cd241547141f2eb15a7b4c6e27f0c015 2162 bytes (raw)
name: website/posts/show-dependencies.scm 	 # note: path name is non-authoritative(*)

 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
 
#!/usr/bin/env -S guile -s
!#

(use-modules (guix packages)
             ((gnu packages)  #:select (specification->package
                                        specification->package+output))
             ((srfi srfi-1)   #:select (delete-duplicates))
             ((srfi srfi-11)  #:select (let-values))
             ((ice-9 match)   #:select (match))
             ((ice-9 format)  #:select (format)))

(define (package->specification package)
  (format #f "~a@~a"
          (package-name package)
          (package-version package)))

(define (input->specification input)
  (match input
    ((label (? package? package) . _)
     (package->specification package))
    ((label (? origin? origin))
     (format #f "[source code from ~a]"
             (origin-uri origin)))
    (other-input
     (format #f "~a" other-input))))

(define (unique-inputs inputs)
  (delete-duplicates
   (map input->specification inputs)))

(define (main args)

  (define packages
    (map specification->package args))
  (define inputs
    (sort
     (delete-duplicates
      (apply append
             (map (lambda (package)
                    (unique-inputs
                     (package-direct-inputs package)))
                  packages)))
     string<))
  (define build-inputs
    (sort
     (delete-duplicates
      (apply append
             (map (lambda (package)
                    (unique-inputs
                     (bag-direct-inputs
                      (package->bag package))))
                  packages)))
     string<))
  (define closure
    (sort
     (delete-duplicates
      (map package->specification
           (package-closure packages)))
     string<))

  (format #t "Packages: ~d\n ~{ ~a~}\n"
          (length packages)
          (sort
           (map package->specification packages)
           string<))
  (format #t "Package inputs: ~d packages\n ~{ ~a~}\n"
          (length inputs)
          inputs)
  (format #t "Build inputs: ~d packages\n ~{ ~a~}\n"
          (length build-inputs)
          build-inputs)
  (format #t "Package closure: ~d packages\n ~{ ~a~}\n"
          (length closure)
          closure))

(main (cdr (command-line)))

debug log:

solving 9a432de ...
found 9a432de in https://yhetil.org/guix-devel/m1d0bme7al.fsf@ordinateur-de-catherine--konrad.home/

applying [1/1] https://yhetil.org/guix-devel/m1d0bme7al.fsf@ordinateur-de-catherine--konrad.home/
diff --git a/website/posts/show-dependencies.scm b/website/posts/show-dependencies.scm
new file mode 100755
index 0000000..9a432de

Checking patch website/posts/show-dependencies.scm...
Applied patch website/posts/show-dependencies.scm cleanly.

index at:
100755 9a432de9cd241547141f2eb15a7b4c6e27f0c015	website/posts/show-dependencies.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).