unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Statistics for coverage of different software repos?
@ 2024-03-22 14:48 Samuel Schmidt
  2024-03-27 15:51 ` Simon Tournier
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Schmidt @ 2024-03-22 14:48 UTC (permalink / raw)
  To: Help Guix

Hello everyone,

Are there are any statistics or similar information about the amount of packages covered in Guix compared with (specialized) software repos?
As an end result I am imagine something like: 
"80% of the 300 packages in melpa are also packaged in the guix-main channel"
"2% of the packages in CRAN are also available in the guix-main channel"
"100% of the packages in CRAN are also available in the Guix-cran channel"

I am aware of https://repology.org, but has someone maybe already tried to gather data more focused on Guix?

Thanks to everyone taking the time to answer,

Samuel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Statistics for coverage of different software repos?
  2024-03-22 14:48 Statistics for coverage of different software repos? Samuel Schmidt
@ 2024-03-27 15:51 ` Simon Tournier
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Tournier @ 2024-03-27 15:51 UTC (permalink / raw)
  To: Samuel Schmidt, Help Guix

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]

Hi,

On ven., 22 mars 2024 at 15:48, Samuel Schmidt <samuel@schmidt-contact.com> wrote:

> Are there are any statistics or similar information about the amount of packages covered in Guix compared with (specialized) software repos?
> As an end result I am imagine something like: 
> "80% of the 300 packages in melpa are also packaged in the guix-main channel"
> "2% of the packages in CRAN are also available in the guix-main channel"
> "100% of the packages in CRAN are also available in the Guix-cran channel"

Nothing I am aware.  However, we could have a script (guix repl) that
extracts information from package definition.  For instance,

--8<---------------cut here---------------start------------->8---
$ guix repl stats-melpa.scm

Emacs: 4.72% (1413 / 29908)
MELPA: .02% (6 + 0 / 29908)
MELPA/Emacs: .42% (6 + 0 / 1413)
--8<---------------cut here---------------end--------------->8---

with the script attached (modulo the bug of such script ;-))

Now, if MELPA serves a way to know the number of packages they provide,
then it becomes straightforward to know.  However, I do not know if
there is a central index.


Cheers,
simon


[-- Attachment #2: stat.scm --]
[-- Type: text/plain, Size: 2854 bytes --]

(use-modules (guix packages)
             (gnu packages)
             (guix build-system emacs)
             (guix git-download)
             (srfi srfi-1)
             (srfi srfi-26)
             (ice-9 match)
             (ice-9 vlist)
             )

(define (all-packages)
  (fold-packages (lambda (package lst)
                   (match (package-replacement package)
                     (#f (cons package lst))
                     (replacement
                      (append (list replacement package) lst))))
                 '()
                 #:select? (negate package-superseded)))

(define melpa-url
  "melpa.org")

(define (melpa? p)
  (match (package-source p)
    ((? origin? o)
     (match (origin-uri o)
       ((url rest ...)
        (string-contains url melpa-url)) ;XXXX: deal with rest?
       ((? string? url)
        (string-contains url melpa-url))
       ((? git-reference? ref)
        (string-contains (git-reference-url ref) melpa-url))
       ;; XXXX: Maybe other methods?
       (_ #false)))
    (_ #false)))

(define (update! table key)
  (match (hash-ref table key 'default)
    ((? number? value)
     (hash-set! table key (1+ value)))
    ('default
      (hash-set! table key 1))))

(define (packages->table)
  (define table (make-hash-table))

  (fold
   (lambda (pkg result)
     (begin
       (if (eq? emacs-build-system (package-build-system pkg))
           (begin
             (update! result 'bs-emacs)
             (if (melpa? pkg)
                 (update! result 'bs-emacs+melpa)
                 (update! result 'bs-emacs-other)))
           (begin
             (update! result 'bs-other)
             (if (melpa? pkg)
                 (update! result 'bs-other+melpa)
                 (update! result 'bs-other-other))))
       result))
   table
   (all-packages)))

(define (format-table)
  (define table
    (packages->table))

  (define (value type)
    (or (hash-ref table type)
        0))

  (define total
    (+ (value 'bs-emacs) (value 'bs-other)))

  (define (percent x tot)
    (* 100. (/ x tot)))

  (format #t "~%")
  (format #t "Emacs: ~2,2f% (~d / ~d)~%" (percent
                                        (value 'bs-emacs)
                                        total)
          (value 'bs-emacs) total)
  (format #t "MELPA: ~2,2f% (~d + ~d / ~d)~%" (percent
                                             (+ (value 'bs-emacs+melpa)
                                                (value 'bs-other+melpa))
                                             total)
          (value 'bs-emacs+melpa) (value 'bs-other+melpa) total)
  (format #t "MELPA/Emacs: ~2,2f% (~d + ~d / ~d)~%"
          (percent
           (+ (value 'bs-emacs+melpa)
              (value 'bs-other+melpa))
           (value 'bs-emacs))
          (value 'bs-emacs+melpa) (value 'bs-other+melpa) (value 'bs-emacs)))

(format-table)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-27 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 14:48 Statistics for coverage of different software repos? Samuel Schmidt
2024-03-27 15:51 ` Simon Tournier

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