2

I know how to list all systems providing by Quicklisp

(ql:system-list)

And I need to get a sort of most depended systems which I want to pack for Guix. Is there any ASD or Quicklisp facility which provide that?

Hellseher
  • 286
  • 2
  • 10

2 Answers2

4

All the info quicklisp has about system relationships is in the two files releases.txt and systems.txt. systems.txt will tell you dependency relationships and releases.txt will map a project name (like "alexandria") to the systems it provides.

They are both simple space-delimited record files, so it should hopefully be easy to parse and get the info you need.

To get example dependency infowithin Lisp, take a look at the source of ql:dependency-tree.

Xach
  • 11,774
  • 37
  • 38
2

Some working solution of what I needed, thanks Xach for pointing out to the systems.txt file

(defparameter *quicklisp-systems-path*
  (merge-pathnames
   (make-pathname :directory '(:relative "dists" "quicklisp")
                  :name "systems" :type "txt")
   ql:*quicklisp-home*))

(defun quicklisp-systems ()
  "Return a list of all systems listed in Quicklisp's sistems.txt"
  (with-open-file
      (stream *quicklisp-systems-path*
              :direction :input
              :element-type :default
              :external-format :default
              :if-does-not-exist nil)
  (loop
    :for line := (read-line stream nil)
    :while line
    :for line-list := (split-sequence:split-sequence #\Space line)
    :if (not (find "#" line-list :test #'equal))
     :append (cdr line-list))))

(defun quicklisp-system-occurrences (list)
  "Return a list of conces for each element and it's accurrences of LIST.
ref: https://codereview.stackexchange.com/questions/215682"
  (let ((table (make-hash-table :test #'equal)))
    (loop
      :for x :in list
      :do (incf (gethash x table 0)))
    (loop
      :for k :being :the hash-key :of table
      :using (hash-value v)
      :collect (cons k v))))

Some results

CL-USER> (subseq (sort (occurrences (get-systems)) #'> :key #'cdr) 0 50)
(("asdf" . 2441) ("alexandria" . 781) ("cl-ppcre" . 350)
 ("cl-glfw-opengl-core" . 346) ("cffi" . 337) ("fiveam" . 309)
 ("bordeaux-threads" . 228) ("closer-mop" . 194) ("split-sequence" . 185)
 ("iterate" . 180) ("uiop" . 158) ("prove" . 153) ("prove-asdf" . 146)
 ("hu.dwim.asdf" . 146) ("babel" . 136) ("local-time" . 132)
 ("flexi-streams" . 131) ("drakma" . 121) ("trivial-garbage" . 113)
 ("cl-fad" . 103) ("usocket" . 93) ("trivial-features" . 90)
 ("named-readtables" . 90) ("documentation-utils" . 83)
 ("trivial-gray-streams" . 75) ("ironclad" . 73) ("cffi-grovel" . 65)
 ("cl-json" . 62) ("anaphora" . 62) ("hunchentoot" . 60) ("hu.dwim.util" . 57)
 ("lift" . 56) ("cxml" . 55) ("log4cl" . 53) ("cl-base64" . 52) ("trivia" . 49)
 ("parse-number" . 46) ("cl-interpol" . 46) ("let-plus" . 46) ("yason" . 46)
 ("quri" . 43) ("parachute" . 41) ("lisp-unit" . 41) ("hu.dwim.stefil" . 40)
 ("puri" . 39) ("trivial-utf-8" . 38) ("swank" . 38) ("esrap" . 35)
 ("qtools-ui-base" . 35) ("cl-opengl" . 34))
Hellseher
  • 286
  • 2
  • 10