bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu-maintenance: Improve 'official-gnu-packages'; add relate


From: Ludovic Courtès
Subject: Re: [PATCH] gnu-maintenance: Improve 'official-gnu-packages'; add related procedures.
Date: Thu, 28 Mar 2013 17:48:44 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Nikita Karetnikov <address@hidden> skribis:

>> What about calling that field ‘doc-urls’ (plural) and having it hold a
>> list of URLs?
>
> Done.
>
> By the way, some fields return "none."  Should it be converted to #f?

Hmm, dunno.  Let’s leave it for later.  ;-)

> +(define (find-packages regexp)
> +  "Find GNU packages which satisfy REGEXP."
> +  (let ((name-rx (make-regexp regexp)))
> +    (filter (lambda (package)
> +              (and=> (false-if-exception
> +                      (regexp-exec name-rx (gnu-package-name package)))
> +                     (const package)))
> +            (official-gnu-packages))))

This would give the same result:

  (filter (lambda (p)
            (false-if-exception
             (regexp-exec name-rx (gnu-package-name package))))
          (official-gnu-packages))

>  (define gnu-package?
>    (memoize
> @@ -97,10 +200,10 @@
>  network to check in GNU's database."
>       ;; TODO: Find a way to determine that a package is non-GNU without going
>       ;; through the network.
> -     (let ((url (and=> (package-source package) origin-uri)))
> +     (let ((url  (and=> (package-source package) origin-uri))
> +           (name (package-name package)))
>         (or (and (string? url) (string-prefix? "mirror://gnu" url))
> -           (and (member (package-name package) (official-gnu-packages))
> -                #t))))))
> +           (not (null-list? (find-packages (format #f "^~a$" name)))))))))

This can be simplified:

  (or (and (string? url) ...)
      (and (member name (map gnu-package-name (official-gnu-packages)))
           #t))

Thus I think you can remove ‘find-packages’, which is a special case
anyway.

WDYT?

If you agree with the changes, you can then push the final version.

Thanks!

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]