Transition to CHICKEN 5 - pee - Pee a password manager;Pee - because you have t… | |
git clone git://vernunftzentrum.de/pee.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 7c509247bca716e9bb56f855088a2db52a217f5d | |
parent d0591a7ea969614a00060b5f746b55f59123a236 | |
Author: Christian Kellermann <[email protected]> | |
Date: Thu, 4 Oct 2018 15:16:11 +0200 | |
Transition to CHICKEN 5 | |
Diffstat: | |
compile.sh | 59 ++----------------------------- | |
crypto-helper.scm | 5 +++-- | |
pee.scm | 12 ++++++------ | |
3 files changed, 11 insertions(+), 65 deletions(-) | |
--- | |
diff --git a/compile.sh b/compile.sh | |
@@ -4,71 +4,16 @@ set -e | |
#to debug change this | |
DEVNULL=/dev/null | |
-# order matters | |
-DEPS="\ | |
-iset \ | |
-regex \ | |
-make \ | |
-utf8 \ | |
-fmt \ | |
-matchable \ | |
-setup-helper \ | |
-miscmacros \ | |
-check-errors \ | |
-record-variants \ | |
-synch \ | |
-lookup-table \ | |
-string-utils \ | |
-blob-utils \ | |
-foreigners \ | |
-getopt-long \ | |
-stty \ | |
-tweetnacl \ | |
-" | |
- | |
echo "Getting version info from git" | |
echo -n '(define-constant commit-id "'\ | |
$(git show -q | grep ^commit| awk '{print $2 }') '")' > hash | |
echo -n '(define-constant program-version "' $(git tag | sort -nr | head -1) '… | |
- | |
-echo "Creating local repo" | |
-chicken-install -i ./repo > $DEVNULL | |
-export CHICKEN_REPOSITORY=$(pwd)/repo | |
-export CSC_OPTION="-r ./repo" | |
- | |
-echo -n "Downloading dependencies: " | |
-for d in $DEPS | |
-do | |
- echo -n "$d " | |
- chicken-install -r $d 2>&1 >$DEVNULL || (echo "Fetching $d has failed." &&… | |
- cd $d && (chicken-install) 2>&1 >$DEVNULL && echo -n "(inst), " && cd - > … | |
-done | |
-echo "done." | |
-echo | |
echo -n "Building static pee program... " | |
-cd fmt | |
-csc -unit fmt -emit-import-library fmt -uses ports,srfi-1,srfi-69,srfi-13,extr… | |
-cd .. | |
-cd matchable | |
-csc -unit matchable -emit-import-library matchable -c matchable.scm -o matchab… | |
-mv matchable.o matchable.import.scm ..; cd .. | |
-csc -unit to-hex -emit-import-library to-hex -c string-utils/to-hex.scm -o to-… | |
-csc -unit type-errors -J -c ./check-errors/type-errors.scm -o type-errors.o 2… | |
-csc -unit type-checks -uses type-errors -J -c ./check-errors/type-checks.scm -… | |
-csc -unit blob-hexadecimal -uses type-checks -uses to-hex -emit-import-library… | |
-csc -unit crypto-helper -uses blob-hexadecimal -emit-import-library crypto-hel… | |
-csc -unit foreigners -uses matchable -emit-import-library foreigners -emit-imp… | |
-csc -unit getopt-long -uses srfi-13 -uses srfi-14 -uses data-structures -uses … | |
-csc -unit tweetnacl -emit-import-library tweetnacl -c tweetnacl/tweetnacl.scm … | |
-csc -uses matchable -uses foreigners -c stty/stty.scm -emit-import-library stt… | |
-csc -uses srfi-1,srfi-4,srfi-13,srfi-14,utils,stty,crypto-helper,tweetnacl,get… | |
-csc -strip -static *.o ./tweetnacl/tweetnacl.impl.o -o pee 2>&1 >$DEVNULL | |
-echo "done." | |
+chicken-install | |
echo "Cleaning up." | |
-rm -r $DEPS repo | |
-rm -f *.o *.import.* pee.c | |
+rm -f *.so *.o *.import.* pee.c | |
echo "Build done." | |
diff --git a/crypto-helper.scm b/crypto-helper.scm | |
@@ -1,8 +1,9 @@ | |
(module crypto-helper (random-bytes hash-passphrase blake2s) | |
- (import chicken scheme foreign) | |
- (use blob-hexadecimal (srfi 4)) | |
+ (import (chicken base) scheme (chicken foreign)) | |
+ (import (chicken blob) blob-hexadecimal srfi-4) | |
(foreign-declare "#include \"blake2.h\"") | |
(foreign-declare "#include \"blake2-impl.h\"") | |
+ (foreign-declare "#include \"blake2s-ref.c\"") | |
(define-foreign-variable blake2s-outbytes integer "BLAKE2S_OUTBYTES") | |
diff --git a/pee.scm b/pee.scm | |
@@ -15,8 +15,8 @@ | |
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
(module pee (main) | |
-(import chicken scheme) | |
-(use (srfi 1 4 13 14) matchable posix tweetnacl utils crypto-helper getopt-lon… | |
+ (import (chicken base) scheme (chicken condition) (chicken bitwise) (c… | |
+(import srfi-1 srfi-4 srfi-13 srfi-14 crypto-helper fmt matchable tweetnacl ge… | |
(include "program-meta.scm") | |
@@ -158,7 +158,7 @@ | |
(sbox content nonce))) | |
(define (decrypt-file file passphrase) | |
- (let ((content (with-input-from-file file read-all))) | |
+ (let ((content (with-input-from-file file (lambda () (read-string #f))))) | |
(enc/dec-file content passphrase symmetric-unbox))) | |
(define (check-content content) | |
@@ -214,8 +214,8 @@ | |
(define (check-access f) | |
(and (file-exists? f) | |
- (file-read-access? f) | |
- (file-write-access? f))) | |
+ (file-readable? f) | |
+ (file-writable? f))) | |
(define options | |
`((init | |
@@ -507,5 +507,5 @@ | |
(exit 0))) | |
) | |
-(import pee) | |
+(import pee (chicken process-context)) | |
(main (cdr (argv))) |