Browse Source

packages: Add 'hidden-package'.

* guix/packages.scm (hidden-package, hidden-package?): New procedures.
* gnu/packages.scm (fold-packages): Filter out 'hidden-package?'.
* tests/packages.scm ("hidden-package"): New test.
version-0.11.0
Ludovic Courtès 6 years ago
parent
commit
6980511b73
No known key found for this signature in database GPG Key ID: 90B11993D9AEBB5
  1. 3
      gnu/packages.scm
  2. 15
      guix/packages.scm
  3. 4
      tests/packages.scm

3
gnu/packages.scm

@ -200,7 +200,8 @@ same package twice."
(fold2 (lambda (module result seen)
(fold2 (lambda (var result seen)
(if (and (package? var)
(not (vhash-assq var seen)))
(not (vhash-assq var seen))
(not (hidden-package? var)))
(values (proc var result)
(vhash-consq var #t seen))
(values result seen)))

15
guix/packages.scm

@ -81,6 +81,8 @@
package-maintainers
package-properties
package-location
hidden-package
hidden-package?
package-field-location
package-direct-sources
@ -290,6 +292,19 @@ name of its URI."
package)
16)))))
(define (hidden-package p)
"Return a \"hidden\" version of P--i.e., one that 'fold-packages' and thus,
user interfaces, ignores."
(package
(inherit p)
(properties `((hidden? . #t)
,@(package-properties p)))))
(define (hidden-package? p)
"Return true if P is \"hidden\"--i.e., must not be visible to user
interfaces."
(assoc-ref (package-properties p) 'hidden?))
(define (package-field-location package field)
"Return the source code location of the definition of FIELD for PACKAGE, or
#f if it could not be determined."

4
tests/packages.scm

@ -79,6 +79,10 @@
(write
(dummy-package "foo" (location #f)))))))
(test-assert "hidden-package"
(and (hidden-package? (hidden-package (dummy-package "foo")))
(not (hidden-package? (dummy-package "foo")))))
(test-assert "package-field-location"
(let ()
(define (goto port line column)

Loading…
Cancel
Save