Moving chibi snow libraries under chibi namespace.

This commit is contained in:
Alex Shinn 2014-06-11 20:42:34 +09:00
parent c4c85a5e19
commit fac93ffa4c
11 changed files with 56 additions and 68 deletions

View file

@ -270,7 +270,8 @@ install: all
$(INSTALL) -m0755 chibi-scheme$(EXE) $(DESTDIR)$(BINDIR)/
$(INSTALL) -m0755 tools/chibi-ffi $(DESTDIR)$(BINDIR)/
$(INSTALL) -m0755 tools/chibi-doc $(DESTDIR)$(BINDIR)/
$(MKDIR) $(DESTDIR)$(MODDIR)/chibi/char-set $(DESTDIR)$(MODDIR)/chibi/crypto $(DESTDIR)$(MODDIR)/chibi/io $(DESTDIR)$(MODDIR)/chibi/iset $(DESTDIR)$(MODDIR)/chibi/loop $(DESTDIR)$(MODDIR)/chibi/match $(DESTDIR)$(MODDIR)/chibi/math $(DESTDIR)$(MODDIR)/chibi/monad $(DESTDIR)$(MODDIR)/chibi/net $(DESTDIR)$(MODDIR)/chibi/optimize $(DESTDIR)$(MODDIR)/chibi/parse $(DESTDIR)$(MODDIR)/chibi/show $(DESTDIR)$(MODDIR)/chibi/term
$(INSTALL) -m0755 tools/snow-chibi $(DESTDIR)$(BINDIR)/
$(MKDIR) $(DESTDIR)$(MODDIR)/chibi/char-set $(DESTDIR)$(MODDIR)/chibi/crypto $(DESTDIR)$(MODDIR)/chibi/io $(DESTDIR)$(MODDIR)/chibi/iset $(DESTDIR)$(MODDIR)/chibi/loop $(DESTDIR)$(MODDIR)/chibi/match $(DESTDIR)$(MODDIR)/chibi/math $(DESTDIR)$(MODDIR)/chibi/monad $(DESTDIR)$(MODDIR)/chibi/net $(DESTDIR)$(MODDIR)/chibi/optimize $(DESTDIR)$(MODDIR)/chibi/parse $(DESTDIR)$(MODDIR)/chibi/show $(DESTDIR)$(MODDIR)/chibi/snow $(DESTDIR)$(MODDIR)/chibi/term
$(MKDIR) $(DESTDIR)$(MODDIR)/scheme/char
$(MKDIR) $(DESTDIR)$(MODDIR)/scheme/time
$(MKDIR) $(DESTDIR)$(MODDIR)/srfi/1 $(DESTDIR)$(MODDIR)/srfi/18 $(DESTDIR)$(MODDIR)/srfi/27 $(DESTDIR)$(MODDIR)/srfi/33 $(DESTDIR)$(MODDIR)/srfi/39 $(DESTDIR)$(MODDIR)/srfi/69 $(DESTDIR)$(MODDIR)/srfi/95 $(DESTDIR)$(MODDIR)/srfi/99 $(DESTDIR)$(MODDIR)/srfi/99/records
@ -288,6 +289,7 @@ install: all
$(INSTALL) -m0644 lib/chibi/optimize/*.sld lib/chibi/optimize/*.scm $(DESTDIR)$(MODDIR)/chibi/optimize/
$(INSTALL) -m0644 lib/chibi/parse/*.sld lib/chibi/parse/*.scm $(DESTDIR)$(MODDIR)/chibi/parse/
$(INSTALL) -m0644 lib/chibi/show/*.sld lib/chibi/show/*.scm $(DESTDIR)$(MODDIR)/chibi/show/
$(INSTALL) -m0644 lib/chibi/snow/*.sld lib/chibi/snow/*.scm $(DESTDIR)$(MODDIR)/chibi/snow/
$(INSTALL) -m0644 lib/chibi/term/*.sld lib/chibi/term/*.scm $(DESTDIR)$(MODDIR)/chibi/term/
$(INSTALL) -m0644 lib/scheme/*.sld lib/scheme/*.scm $(DESTDIR)$(MODDIR)/scheme/
$(INSTALL) -m0644 lib/scheme/char/*.sld lib/scheme/char/*.scm $(DESTDIR)$(MODDIR)/scheme/char/
@ -338,6 +340,7 @@ uninstall:
-$(RM) $(DESTDIR)$(BINDIR)/chibi-scheme-static$(EXE)
-$(RM) $(DESTDIR)$(BINDIR)/chibi-ffi
-$(RM) $(DESTDIR)$(BINDIR)/chibi-doc
-$(RM) $(DESTDIR)$(BINDIR)/snow-chibi
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO)
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION)
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION_MAJOR)

View file

@ -1,35 +1,31 @@
(define-library (snow commands)
(export
command/package
command/gen-key
command/reg-key
command/sign
command/verify
command/upload
command/install
command/remove
command/search
command/show
command/status
command/update
command/upgrade
die
installed-libraries)
(import (except (chibi) equal? write display)
(scheme base)
(define-library (chibi snow commands)
(export command/package
command/gen-key
command/reg-key
command/sign
command/verify
command/upload
command/install
command/remove
command/search
command/show
command/status
command/update
command/upgrade)
(import (scheme base)
(scheme eval)
(scheme write)
(scheme file)
(scheme process-context)
(scheme time)
(scheme write)
(srfi 1)
(srfi 27)
(srfi 33)
(srfi 95)
(srfi 98)
(snow interface)
(snow package)
(snow utils)
(chibi snow interface)
(chibi snow package)
(chibi snow utils)
(chibi bytevector)
(chibi config)
(chibi crypto md5)

View file

@ -1,5 +1,5 @@
(define-library (snow interface)
(define-library (chibi snow interface)
(export warn info message die input input-number yes-or-no?
restore-history save-history)
(import (scheme base) (scheme char) (scheme read) (scheme write)

View file

@ -1,5 +1,5 @@
(define-library (snow package)
(define-library (chibi snow package)
(export package? library?
package-name package-email package-url package-version
package-libraries package-provides? package-dependencies
@ -16,7 +16,7 @@
extract-rsa-private-key extract-rsa-public-key)
(import (chibi)
(srfi 1)
(snow interface)
(chibi snow interface)
(chibi config)
(chibi crypto md5)
(chibi crypto rsa)

View file

@ -1,17 +1,13 @@
(define (file-sha256 file)
;; openssl dgst -sha256 file
(let ((ls (string-split (process->string `("shasum" "-a" "256" ,file)))))
(and (pair? ls) (car ls))))
;;> Copies the file \var{from} to \var{to}.
(define (copy-file src dst)
(system "cp" src dst))
(define (move-file src dst)
(system "mv" src dst))
;; TODO: check if the upstream has been modified
(define http-get-to-file/cached http-get-to-file)
(define (copy-file from to)
(let ((in (open-binary-input-file from))
(out (open-binary-output-file to)))
(let lp ()
(let ((n (read-u8 in)))
(cond ((eof-object? n) (close-input-port in) (close-output-port out))
(else (write-u8 n out) (lp)))))))
(define (call-with-temp-file template proc)
(let ((base (string-append
@ -53,15 +49,5 @@
(lp (+ i 1)))
((create-directory path #o700)
(let ((res (proc path)))
;;(delete-file-hierarchy path)
(delete-file-hierarchy path)
res)))))))
(define (system-from-dir dir . cmd)
;; alternately fork+cd+exec, or run a subshell with cd
(with-directory dir (lambda () (apply system cmd))))
(define (gzip-file src)
(system "gzip" "-c" src))
(define (gunzip-file src)
(system "gzip" "-d" "-c" src))

12
lib/chibi/snow/utils.sld Normal file
View file

@ -0,0 +1,12 @@
(define-library (chibi snow utils)
(export copy-file call-with-temp-file call-with-temp-dir)
(import (scheme base)
(scheme file)
(scheme time)
(srfi 33)
(chibi filesystem)
(chibi pathname)
(chibi process)
(chibi snow interface))
(include "utils.scm"))

View file

@ -1,12 +0,0 @@
(define-library (snow utils)
(export copy-file move-file http-get-to-file/cached
call-with-temp-file call-with-temp-dir create-directory*
path-strip-leading-parents
file-sha256)
(import (scheme base) (scheme char) (scheme write) (scheme time)
(snow interface)
(srfi 1) (srfi 33)
(chibi string) (chibi pathname) (chibi uri)
(chibi filesystem) (chibi process) (chibi net http))
(include "utils.scm"))

View file

@ -3,11 +3,14 @@
;; This code was written by Alex Shinn in 2013 and placed in the
;; Public Domain. All warranties are disclaimed.
(import (scheme base) (scheme char) (scheme read) (scheme write)
(scheme file) (scheme process-context) (srfi 1)
(snow commands) (snow library) (snow utils) (snow interface)
(chibi app) (chibi config) (chibi match) (chibi string)
(chibi pathname) (chibi filesystem) (chibi process))
(import (scheme base)
(scheme process-context)
(chibi snow commands)
(chibi snow interface)
(chibi app)
(chibi config)
(chibi pathname)
(chibi process))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;