GNU bug report logs -
#51838
[PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
Previous Next
Reported by: Philip McGrath <philip <at> philipmcgrath.com>
Date: Sun, 14 Nov 2021 12:43:01 UTC
Severity: normal
Tags: patch
Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Philip,
Philip McGrath <philip <at> philipmcgrath.com> writes:
> - (define (resolve-dependencies package-meta meta-key)
> - (fold (lambda (key+value acc)
> - (match key+value
> - ('@ acc)
> - ((key . value) (acons key (hash-ref index key value) acc))))
> + (define (resolve-dependencies meta-alist meta-key)
> + (match (assoc-ref meta-alist meta-key)
> + (#f
> + '())
> + (('@ . orig-deps)
> + (fold (match-lambda*
> + (('@ acc)
> + acc)
> + (((key . value) acc)
> + (if (member key absent-dependencies)
> + acc
> + (acons key (hash-ref index key value) acc))))
> '()
> - (or (assoc-ref package-meta meta-key) '())))
> + orig-deps))))
There’s a lot of refactoring going here in addition to change at hand.
To me, it needlessly obscures the actual change (which is just the check
for membership in 'absent-dependencies', AFAICS).
> (with-atomic-file-replacement "package.json"
> (lambda (in out)
> - (let ((package-meta (read-json in)))
> - (assoc-set! package-meta "dependencies"
> - (append
> - '(@)
> - (resolve-dependencies package-meta "dependencies")
> - (resolve-dependencies package-meta "peerDependencies")))
> - (assoc-set! package-meta "devDependencies"
> - (append
> - '(@)
> - (resolve-dependencies package-meta "devDependencies")))
> + ;; It is unsafe to rely on 'assoc-set!' to update an
> + ;; existing assosciation list variable:
> + ;; see 'info "(guile)Adding or Setting Alist Entries"'.
Good catch!
> + (let* ((package-meta (read-json in))
> + (alist (match package-meta
> + ((@ . alist) alist)))
Why do we have to unwrap (and then re-wrap later on) the alist? It
would be nice to explain that in the changelog. Maybe it’s just me, but
I can’t figure it out! :)
Thanks!
-- Tim
This bug report was last modified 3 years and 195 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.