From: Guillaume Le Vaillant <glv@posteo.net>
To: Charles <Charles.b.jackson@proton.me>
Cc: "59592@debbugs.gnu.org" <59592@debbugs.gnu.org>
Subject: [bug#59592] Keep asd-systems for cl-* packages
Date: Tue, 10 Jan 2023 13:05:02 +0000 [thread overview]
Message-ID: <87cz7mlbye.fsf@kitej> (raw)
In-Reply-To: <y318LPg_jXXPcPcsFoNhc-na22BwuViNRYMgrZ-Ly5UVapf3Z_hO0RUVvwQecb_k4oiB_RwUekSUBwZUwMfDCY5CzQk4vEYVVweAkFAFTV4=@proton.me>
[-- Attachment #1.1: Type: text/plain, Size: 1540 bytes --]
Hi,
The 'asd-systems' field contains the minimal subset of the ASDF systems
defined by a library that, when compiled, compiles all the systems of
the library.
For example, the ironclad package has many subsystems:
"ironclad/ciphers"
"ironclad/digests"
"ironclad/cipher/aes"
"ironclad/cipher/threefish"
"ironclad/digest/sha256"
"ironclad/public-key/ed25519"
...
but the 'asd-systems' field only contains "ironclad".
The mcclim package also has many subsystems:
"automaton"
"clim"
"clim-core"
"clim-core/frames"
"clim-core/system"
"drei-mcclim"
"esa-mcclim"
"mcclim-backend-common"
"mcclim-fonts"
"slim"
...
but the 'asd-systems' field only contains the top level ones, "mcclim",
"clim-examples" and "clim-debugger".
So you can't rely on the contents of 'asd-systems' to have a complete
list of the systems defined by a library.
You could get the full list by searching the for 'defsystem' forms in
the sources directly, with something like:
--8<---------------cut here---------------start------------->8---
find sources -name "*.asd" -exec grep "(defsystem" {} \; | cut -d ' ' -f 2
--8<---------------cut here---------------end--------------->8---
But it would only work for systems not using the package-inferred-system
feature of ASDF.
In my files, I found a function (I don't remember where I got it from)
that can get all the dependencies of a loaded system, even the ones
using package-inferred-system. Maybe it could be modified to limit the
results to a specific library's source tree...
[-- Attachment #1.2: get-dependencies.lisp --]
[-- Type: application/octet-stream, Size: 2904 bytes --]
(asdf!load-system :fset)
(defun get-dependencies (system)
"Returns a set with all dependencies of a given system.
System should be loaded first."
(labels ((normalize (name)
(etypecase name
(string (string-downcase name))
(symbol (normalize (symbol-name name)))
(list
(let ((dep-type (first name))
(supported-dep-types (list :version :feature :require)))
(unless (member dep-type
supported-dep-types)
(error "This component \"~A\" should have first element from this list: ~A."
name
supported-dep-types))
(normalize
(case dep-type
(:version (second name))
(:feature (third name))
(:require (second name)))))))))
(let ((processed (fset:set))
(queue (fset:set (normalize system))))
(do ((current-name (fset:arb queue)
(fset:arb queue)))
((null current-name)
;; return result
processed)
;; Remove current name from the queue
(setf queue
(fset:less queue current-name))
;; And put it into the "processed" pool
(setf processed
(fset:with processed current-name))
;; And add it's dependencies which aren't processed or in the queue already
;; Sometimes system can't be found because itself depends on some feature,
;; for example, you can specify dependency as a list:
;; (:FEATURE :SBCL (:REQUIRE :SB-INTROSPECT))
;; and it will be loaded only on SBCL.
;; When we are collecting dependencies on another implementation,
;; we don't want to fail with an error because ASDF is unable to find
;; such dependencies
(let* ((system (ignore-errors
(asdf:find-system current-name)))
(deps (when system
(asdf:component-sideway-dependencies system))))
(dolist (dep deps)
(let ((normalized-dep (normalize dep)))
(unless (or (fset:lookup processed normalized-dep)
(fset:lookup queue normalized-dep))
(setf queue
(fset:with queue normalized-dep)))))))
(values processed))))
#|
DEPENDENCIES> (asdf:load-system :clinch)
DEPENDENCIES> (get-dependencies :clinch)
#{
"cffi"
"sdl2"
"uiop"
"babel"
"swank"
"clinch"
"cl-glut"
"cl-json"
"cl-ppcre"
"rtg-math"
"cl-opengl"
"cl-plus-c"
"alexandria"
"cl-autowrap"
"glsl-symbols"
"defpackage-plus"
"trivial-garbage"
"trivial-timeout"
"bordeaux-threads"
"trivial-channels"
"trivial-features" }
|#
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]
next prev parent reply other threads:[~2023-01-10 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 4:09 [bug#59592] Keep asd-systems for cl-* packages Charles via Guix-patches via
2022-12-08 4:14 ` Charles via Guix-patches via
2023-01-10 13:05 ` Guillaume Le Vaillant [this message]
2023-01-20 20:24 ` [bug#59592] (No Subject) Charles via Guix-patches via
2023-01-28 9:46 ` Guillaume Le Vaillant
2023-01-28 16:23 ` Charles via Guix-patches via
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=87cz7mlbye.fsf@kitej \
--to=glv@posteo.net \
--cc=59592@debbugs.gnu.org \
--cc=Charles.b.jackson@proton.me \
/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.