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 chibi-scheme$(EXE) $(DESTDIR)$(BINDIR)/
$(INSTALL) -m0755 tools/chibi-ffi $(DESTDIR)$(BINDIR)/ $(INSTALL) -m0755 tools/chibi-ffi $(DESTDIR)$(BINDIR)/
$(INSTALL) -m0755 tools/chibi-doc $(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/char
$(MKDIR) $(DESTDIR)$(MODDIR)/scheme/time $(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 $(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/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/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/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/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/*.sld lib/scheme/*.scm $(DESTDIR)$(MODDIR)/scheme/
$(INSTALL) -m0644 lib/scheme/char/*.sld lib/scheme/char/*.scm $(DESTDIR)$(MODDIR)/scheme/char/ $(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-scheme-static$(EXE)
-$(RM) $(DESTDIR)$(BINDIR)/chibi-ffi -$(RM) $(DESTDIR)$(BINDIR)/chibi-ffi
-$(RM) $(DESTDIR)$(BINDIR)/chibi-doc -$(RM) $(DESTDIR)$(BINDIR)/chibi-doc
-$(RM) $(DESTDIR)$(BINDIR)/snow-chibi
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO) -$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO)
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION) -$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION)
-$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION_MAJOR) -$(RM) $(DESTDIR)$(SOLIBDIR)/libchibi-scheme$(SO).$(SOVERSION_MAJOR)

View file

@ -1,7 +1,6 @@
(define-library (snow commands) (define-library (chibi snow commands)
(export (export command/package
command/package
command/gen-key command/gen-key
command/reg-key command/reg-key
command/sign command/sign
@ -13,23 +12,20 @@
command/show command/show
command/status command/status
command/update command/update
command/upgrade command/upgrade)
die (import (scheme base)
installed-libraries)
(import (except (chibi) equal? write display)
(scheme base)
(scheme eval) (scheme eval)
(scheme write)
(scheme file) (scheme file)
(scheme process-context)
(scheme time) (scheme time)
(scheme write)
(srfi 1) (srfi 1)
(srfi 27) (srfi 27)
(srfi 33) (srfi 33)
(srfi 95) (srfi 95)
(srfi 98) (chibi snow interface)
(snow interface) (chibi snow package)
(snow package) (chibi snow utils)
(snow utils)
(chibi bytevector) (chibi bytevector)
(chibi config) (chibi config)
(chibi crypto md5) (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? (export warn info message die input input-number yes-or-no?
restore-history save-history) restore-history save-history)
(import (scheme base) (scheme char) (scheme read) (scheme write) (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? (export package? library?
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-provides? package-dependencies
@ -16,7 +16,7 @@
extract-rsa-private-key extract-rsa-public-key) extract-rsa-private-key extract-rsa-public-key)
(import (chibi) (import (chibi)
(srfi 1) (srfi 1)
(snow interface) (chibi snow interface)
(chibi config) (chibi config)
(chibi crypto md5) (chibi crypto md5)
(chibi crypto rsa) (chibi crypto rsa)

View file

@ -1,17 +1,13 @@
(define (file-sha256 file) ;;> Copies the file \var{from} to \var{to}.
;; openssl dgst -sha256 file
(let ((ls (string-split (process->string `("shasum" "-a" "256" ,file)))))
(and (pair? ls) (car ls))))
(define (copy-file src dst) (define (copy-file from to)
(system "cp" src dst)) (let ((in (open-binary-input-file from))
(out (open-binary-output-file to)))
(define (move-file src dst) (let lp ()
(system "mv" src dst)) (let ((n (read-u8 in)))
(cond ((eof-object? n) (close-input-port in) (close-output-port out))
;; TODO: check if the upstream has been modified (else (write-u8 n out) (lp)))))))
(define http-get-to-file/cached http-get-to-file)
(define (call-with-temp-file template proc) (define (call-with-temp-file template proc)
(let ((base (string-append (let ((base (string-append
@ -53,15 +49,5 @@
(lp (+ i 1))) (lp (+ i 1)))
((create-directory path #o700) ((create-directory path #o700)
(let ((res (proc path))) (let ((res (proc path)))
;;(delete-file-hierarchy path) (delete-file-hierarchy path)
res))))))) 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 ;; This code was written by Alex Shinn in 2013 and placed in the
;; Public Domain. All warranties are disclaimed. ;; Public Domain. All warranties are disclaimed.
(import (scheme base) (scheme char) (scheme read) (scheme write) (import (scheme base)
(scheme file) (scheme process-context) (srfi 1) (scheme process-context)
(snow commands) (snow library) (snow utils) (snow interface) (chibi snow commands)
(chibi app) (chibi config) (chibi match) (chibi string) (chibi snow interface)
(chibi pathname) (chibi filesystem) (chibi process)) (chibi app)
(chibi config)
(chibi pathname)
(chibi process))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;