~ruther/guix-local

1df54ceab38873dfc0fd2ec27313d7d17c79c350 — Ludovic Courtès 3 years ago 61a6b05
packages: 'package-direct-sources' correctly handles non-origin sources.

Previously 'package-direct-sources' would trigger a wrong-type-arg error
when passed a package whose 'source' is not an origin, such as
'ruby-sorbet-runtime'.

* guix/packages.scm (package-direct-sources): Call 'expand' if and only
if (package-source package) is an origin.
1 files changed, 7 insertions(+), 4 deletions(-)

M guix/packages.scm
M guix/packages.scm => guix/packages.scm +7 -4
@@ 1234,11 1234,14 @@ input list."
  "Return all source origins associated with PACKAGE; including origins in
PACKAGE's inputs and patches."
  (define (expand source)
    (cons
     source
     (filter origin? (origin-patches source))))
    (cons source
          (filter origin? (origin-patches source))))

  `(,@(or (and=> (package-source package) expand) '())
  `(,@(match (package-source package)
        ((? origin? origin)
         (expand origin))
        (_
         '()))
    ,@(filter-map (match-lambda
                   ((_ (? origin? orig) _ ...)
                    orig)