unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: jgart <jgart@dismail.de>, Guix Devel <guix-devel@gnu.org>
Subject: Re: (M)ELPA package metadata accuracy
Date: Mon, 21 Nov 2022 20:07:26 +0100	[thread overview]
Message-ID: <87cz9gunwx.fsf@gmail.com> (raw)
In-Reply-To: <87mt8kmxtx.fsf_-_@gnu.org>

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

Hi Ludo,

On Mon, 21 Nov 2022 at 11:00, Ludovic Courtès <ludo@gnu.org> wrote:

> So that’d be 72% accurate package metadata for (M)ELPA, not too bad!

IMHO, one could extrapolate that if someone applies a similar approach
as Lars for CRAN, then 70-75% of (M)ELPA should build out-of-the box.

BTW, unrelated to the topic but note that I engaged a discussion [1]
with Org folk about using Guix as a brick for quality assurance of Emacs
packages – starting with Org. ;-)  Well, the GNU project should reuse
its own components instead of relying on other distros. :-)

1: <https://list.orgmode.org/orgmode/87sfiiycat.fsf@gmail.com/>


> I tried to estimate repository package data accuracy for my PackagingCon
> talk last year in a sophisticated way (perhaps too sophisticated):
>
>   https://git.savannah.gnu.org/cgit/guix/maintenance.git/plain/talks/packaging-con-2021/grail/talk.20211110.pdf
>   (slide 53)
>
>   https://lists.gnu.org/archive/html/guix-devel/2021-10/msg00297.html

IIRC, you mainly investigated the accuracy of the importers…

> I think we should identify common sources of inaccuracy in package
> metadata

…and indeed maybe a systematic analysis of the modifications of the
default emacs-build-system could help in 2 directions:

 1. maybe draw some heuristics to improve the importer accuracy,

>              talk with repo maintainers to improve on that.

and 2. report upstream if some patterns appear.


Well, for packages using ’emacs-build-system’, only comparing ’keyword’
arguments, it reads:

        emacs        : 1234 = 1234 = 878  + 356
            ("phases" . 213)
            ("tests?" . 144)
            ("test-command" . 127)
            ("include" . 87)
            ("emacs" . 25)
            ("exclude" . 20)
            ("modules" . 7)
            ("imported-modules" . 4)
            ("parallel-tests?" . 1) 

Considering this 356 packages, 144 modifies the keyword #:tests?.  Note
that ’#:tests? #t’ is counted in these 144 and it reads,

    $ ag 'tests\? #t' gnu/packages/emacs-xyz.scm | wc -l
    117

Ah!  It requires some investigations. :-)

Indeed, it could be worth to identify common sources of the extra
modifications we are doing compared to the default emacs-build-system.


Cheers,
simon


[-- Attachment #2: script --]
[-- Type: text/plain, Size: 2831 bytes --]

(use-modules (guix)
             (gnu)
             (srfi srfi-1)
             (ice-9 match))


(define %table (make-hash-table))

(define (keyword-as-string arg)
  (map (compose symbol->string keyword->symbol)
       (filter keyword? arg)))

(define (count-items lst)
  (if (null? lst)
      '()
      (let ((sorted (sort lst string<=?)))
        (sort
         (fold (lambda (keyword result)
                 (match result
                   ((head tail ...)
                    (match head
                      ((k . v)
                       (if (string= k keyword)
                           (cons `(,k . ,(+ 1 v)) tail)
                           (cons `(,keyword . 1) result)))
                      (_ (format #t "Error:"))))
                   (_ (format #t "Error:"))))
               (list `(,(car sorted) . 1))
               (cdr sorted))
         (lambda (x1 x2)
           (match x1
             ((k1 . v1)
              (match x2
                ((k2 . v2)
                 (> v1 v2))))))))))


(fold-packages (lambda (package result)
                 (let ((bs  (build-system-name
                             (package-build-system package)))
                       (arg (package-arguments     package)))
                   (match (hash-ref result bs)
                     ((tot wo wi args)
                      (if (null? arg)
                          (hash-set! result bs (list
                                                (1+ tot)
                                                (1+ wo)
                                                wi args))
                          (hash-set! result bs (list
                                                (1+ tot)
                                                wo
                                                (1+ wi)
                                                (append (keyword-as-string arg)
                                                        args)))))
                     (#f (if (null? arg)
                             (hash-set! result bs (list 1 1 0 '()))
                             (hash-set! result bs (list 1 0 1 (keyword-as-string arg)))))
                     (_ (format #t "Error: ~s~%" (package-name package))))
                   result))
              %table)


(define fmt "~13s: ~4s = ~4s = ~4s + ~4s  ~{ ~s ~}~%")
(format #t fmt
        'key 'tot 'tot 'no-arguments 'arguments (list 'pattern?))
(hash-for-each-handle (lambda (kv)
                        (match kv
                          ((key . value)
                           (match value
                             ((tot wo wi args)
                              (format #t fmt
                                      key
                                      (+ wo wi)
                                      tot wo wi (count-items args)))))))
                      %table)

  reply	other threads:[~2022-11-21 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 13:09 guix melpa mirror! jgart
2022-11-16 15:52 ` Joshua Branson
2022-11-16 16:48   ` jgart
2022-11-17 15:14 ` Ludovic Courtès
2022-11-18  1:06   ` jgart
2022-11-18  8:20     ` zimoun
2022-11-21 10:00       ` (M)ELPA package metadata accuracy Ludovic Courtès
2022-11-21 19:07         ` zimoun [this message]
2022-11-18  9:46 ` guix melpa mirror! Mekeor Melire

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87cz9gunwx.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=jgart@dismail.de \
    --cc=ludo@gnu.org \
    /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 public inbox

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

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