Hi,

On Wed, 12 Apr 2023 at 23:04, Rodrigo Morales <moralesrodrigo1...@gmail.com> 
wrote:

>   Today, I was wondering what the most used build system and the least
>   one are. The most used build system is `gnu-build-system'. The least
>   used build system is `dub-build-system'. Here's how I found that out.

Please give a look at:

    https://issues.guix.gnu.org/msgid/y0zgy7ifjg0vk...@bluewin.ch

(Argh I am so late for completing the review of this!)

It comes from:
<https://10years.guix.gnu.org/video/guix-repl-to-infinity-and-beyond/>
where some examples traverse all the packages and collect build system
by build system if the modify the field ’arguments’.


Well, here an example to list the most used methods in ’origin’ field.

--8<---------------cut here---------------start------------->8---
$ cat sources.scm
(use-modules (guix)
             (guix git-download)
             (guix hg-download)
             (guix svn-download)
             (guix cvs-download)
             (guix bzr-download)
             (gnu)
             (ice-9 match)
             (srfi srfi-1)
             (srfi srfi-26))

(define packages-with-source
  (fold-packages (lambda (package result)
                   (if (origin? (package-source package))
                     (cons package result)
                     result))
                 '()))

(map (lambda (package)
       (let* ((origin (package-source package))
              (method (origin-method origin))
              (str (cond ((or (eq? method url-fetch)
                              (eq? method url-fetch/tarbomb)
                              (eq? method url-fetch/zipbomb)) "url-fetch")
                         ((eq? method git-fetch) "git-fetch")
                         ((eq? method hg-fetch) "hg-fetch")
                         ((or (eq? method svn-fetch)
                              (eq? method svn-multi-fetch)) "svn-fetch")
                         ((eq? method cvs-fetch) "cvs-fetch")
                         ((eq? method bzr-fetch) "bzr-fetch")
                         (else "other"))))
         (format #t (string-append str "~%"))))
     packages-with-source)

$ guix repl -- sources.scm | sort | uniq -c | sort -rn
  13600 url-fetch
   8047 git-fetch
    458 svn-fetch
     38 other
     32 hg-fetch
      5 bzr-fetch
      2 cvs-fetch
--8<---------------cut here---------------end--------------->8---


Hope that helps.

Cheers,
simon

Reply via email to