guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] list-packages: Display package usage count.


From: Eric Bavier
Subject: Re: [PATCH] list-packages: Display package usage count.
Date: Sun, 26 Oct 2014 13:23:05 -0500
User-agent: mu4e 0.9.9.5; emacs 23.3.1

Ludovic Courtès writes:

> Eric Bavier <address@hidden> skribis:
>
>> +  (define (users package)
>> +    (let ((n (length (package-transitive-dependents
>> +                      (find-packages-by-name* (package-name package)
>> +                                              (package-version package))))))
>
> Why not just (package-transitive-dependents package)?

Because that would not accurately count the "true" number of dependents.
It is constistent with the discussion and script I attached at
https://lists.gnu.org/archive/html/guix-devel/2014-10/msg00196.html

>> -(define find-packages-by-name
>> +(define (find-packages fold)
>>    (let ((packages (delay
>> -                    (fold-packages (lambda (p r)
>> -                                     (vhash-cons (package-name p) p r))
>> -                                   vlist-null))))
>> +                    (fold (lambda (p r)
>> +                            (vhash-cons (package-name p) p r))
>> +                          vlist-null))))
>>      (lambda* (name #:optional version)
>>        "Return the list of packages with the given NAME.  If VERSION is not 
>> #f,
>>  then only return packages whose version is equal to VERSION."
>> @@ -207,6 +208,9 @@ then only return packages whose version is equal to 
>> VERSION."
>>                      matching)
>>              matching)))))
>>  
>> +(define find-packages-by-name  (find-packages fold-packages))
>> +(define find-packages-by-name* (find-packages fold-packages*))
>
> ‘fold-packages*’ is the variant that also looks for private packages,
> right? (It’s from one of the recent patches that hasn’t made it yet.)

That's correct.

-- 
Eric Bavier

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



reply via email to

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