all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Samuel Schmidt <samuel@schmidt-contact.com>,
	Help Guix <help-guix@gnu.org>
Subject: Re: Statistics for coverage of different software repos?
Date: Wed, 27 Mar 2024 16:51:23 +0100	[thread overview]
Message-ID: <87il17ad1g.fsf@gmail.com> (raw)
In-Reply-To: <1843759644.2555899.1711118905517@fidget.co-bxl>

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

      reply	other threads:[~2024-03-27 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 14:48 Statistics for coverage of different software repos? Samuel Schmidt
2024-03-27 15:51 ` Simon Tournier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87il17ad1g.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=samuel@schmidt-contact.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.