mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
snow package updates
This commit is contained in:
parent
05294de078
commit
e658a29e16
3 changed files with 40 additions and 9 deletions
|
@ -69,12 +69,13 @@
|
||||||
(define (package-name package)
|
(define (package-name package)
|
||||||
(and (pair? package)
|
(and (pair? package)
|
||||||
(eq? 'package (car package))
|
(eq? 'package (car package))
|
||||||
(or (cond ((assoc-get (cdr package) 'name)
|
(cond ((assoc-get (cdr package) 'name)
|
||||||
=> (lambda (x) (and (pair? x) x)))
|
=> (lambda (x) (and (pair? x) x)))
|
||||||
(else #f))
|
((assq 'library (cdr package))
|
||||||
;; TODO: longest common prefix
|
=> (lambda (x) (library-name (cdr x))))
|
||||||
(let ((lib (assq 'library (cdr package))))
|
((assq 'progam (cdr package))
|
||||||
(and lib (library-name lib))))))
|
=> (lambda (x) (program-name (cdr x))))
|
||||||
|
(else #f))))
|
||||||
|
|
||||||
(define (package-email pkg)
|
(define (package-email pkg)
|
||||||
(and (package? pkg)
|
(and (package? pkg)
|
||||||
|
@ -185,6 +186,9 @@
|
||||||
(define (package-libraries package)
|
(define (package-libraries package)
|
||||||
(and (package? package) (filter library? (cdr package))))
|
(and (package? package) (filter library? (cdr package))))
|
||||||
|
|
||||||
|
(define (package-programs package)
|
||||||
|
(and (package? package) (filter program? (cdr package))))
|
||||||
|
|
||||||
(define (package-provides? package name)
|
(define (package-provides? package name)
|
||||||
(and (pair? package)
|
(and (pair? package)
|
||||||
(eq? 'package (car package))
|
(eq? 'package (car package))
|
||||||
|
@ -320,3 +324,27 @@
|
||||||
(cons (car x) (map recurse (cdr x))))
|
(cons (car x) (map recurse (cdr x))))
|
||||||
(else x)))
|
(else x)))
|
||||||
(else x)))
|
(else x)))
|
||||||
|
|
||||||
|
;; programs
|
||||||
|
|
||||||
|
(define (program? x)
|
||||||
|
(and (pair? x) (eq? 'program (car x)) (every pair? (cdr x))))
|
||||||
|
|
||||||
|
(define (program-name prog)
|
||||||
|
(and (pair? prog)
|
||||||
|
(cond ((assoc-get (cdr prog) 'name eq?))
|
||||||
|
((assoc-get (cdr prog) 'path eq?)
|
||||||
|
=> (lambda (p) (list (string->symbol (path-strip-directory p)))))
|
||||||
|
(else #f))))
|
||||||
|
|
||||||
|
(define (get-program-file cfg prog)
|
||||||
|
(cond ((assoc-get prog 'path))
|
||||||
|
((assoc-get prog 'name)
|
||||||
|
=> (lambda (name) (library-name->path (last name))))
|
||||||
|
(else (error "program missing path: " prog))))
|
||||||
|
|
||||||
|
(define (program-install-name prog)
|
||||||
|
(or (assoc-get (cdr prog) 'install-name eq?)
|
||||||
|
(path-strip-extension
|
||||||
|
(path-strip-directory
|
||||||
|
(assoc-get (cdr prog) 'path eq?)))))
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
(define-library (chibi snow package)
|
(define-library (chibi snow package)
|
||||||
(export package? library?
|
(export package? library? program?
|
||||||
package-name package-email package-url package-version
|
package-name package-email package-url package-version
|
||||||
package-libraries package-provides? package-dependencies
|
package-libraries package-programs
|
||||||
|
package-provides? package-dependencies
|
||||||
package-installed-files package-author
|
package-installed-files package-author
|
||||||
package-digest-mismatches package-signature-mismatches
|
package-digest-mismatches package-signature-mismatches
|
||||||
package-digest-ok? package-signature-ok?
|
package-digest-ok? package-signature-ok?
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
library-url library-name parse-library-name library-name->path
|
library-url library-name parse-library-name library-name->path
|
||||||
library-analyze library-include-files library-dependencies
|
library-analyze library-include-files library-dependencies
|
||||||
library-rewrite-includes
|
library-rewrite-includes
|
||||||
|
get-program-file program-name program-install-name
|
||||||
invalid-package-reason valid-package?
|
invalid-package-reason valid-package?
|
||||||
invalid-library-reason valid-library?
|
invalid-library-reason valid-library?
|
||||||
repo-find-publisher lookup-digest rsa-identity=?
|
repo-find-publisher lookup-digest rsa-identity=?
|
||||||
|
|
|
@ -97,7 +97,8 @@
|
||||||
(define verify-spec
|
(define verify-spec
|
||||||
'())
|
'())
|
||||||
(define package-spec
|
(define package-spec
|
||||||
'((authors (list string))
|
'((programs (list existing-filename))
|
||||||
|
(authors (list string))
|
||||||
(maintainers (list string))
|
(maintainers (list string))
|
||||||
(recursive? boolean (#\r "recursive") "...")
|
(recursive? boolean (#\r "recursive") "...")
|
||||||
(version string)
|
(version string)
|
||||||
|
|
Loading…
Add table
Reference in a new issue