Hi, On ven., 22 mars 2024 at 15:48, Samuel Schmidt <sam...@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
(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)