Transition to CHICKEN 5 - pee - Pee a password manager;Pee - because you have to...
 (HTM) git clone git://vernunftzentrum.de/pee.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 7c509247bca716e9bb56f855088a2db52a217f5d
 (DIR) parent d0591a7ea969614a00060b5f746b55f59123a236
 (HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
       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(-)
       ---
 (DIR) 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) '")' > tag
        
       -
       -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." && exit 1)
       -    cd $d && (chicken-install) 2>&1 >$DEVNULL && echo -n "(inst), " && cd - > $DEVNULL
       -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,extras,data-structures -c fmt-chicken.scm -o fmt.o && mv fmt.o fmt.import.scm .. 2>&1 >$DEVNULL
       -cd ..
       -cd matchable
       -csc -unit matchable -emit-import-library matchable -c matchable.scm -o matchable.o 2>&1 >$DEVNULL
       -mv matchable.o matchable.import.scm ..; cd ..
       -csc -unit to-hex -emit-import-library to-hex -c string-utils/to-hex.scm -o to-hex.o 2>&1 >$DEVNULL
       -csc -unit type-errors -J -c ./check-errors/type-errors.scm  -o type-errors.o 2>&1 >$DEVNULL
       -csc -unit type-checks -uses type-errors -J -c ./check-errors/type-checks.scm -o type-checks.o 2>&1 >$DEVNULL
       -csc -unit blob-hexadecimal -uses type-checks -uses to-hex -emit-import-library blob-hexadecimal -c blob-utils/blob-hexadecimal.scm   -o blob-hexadecimal.o 2>&1 >$DEVNULL
       -csc -unit crypto-helper -uses blob-hexadecimal -emit-import-library crypto-helper -c crypto-helper.scm -c blake2s-ref.c -o crypto-helper.o -C --std=c99 2>&1 >$DEVNULL
       -csc -unit foreigners -uses matchable -emit-import-library foreigners -emit-import-library renaming -c foreigners/foreigners.scm -o foreigners.o 2>&1 >$DEVNULL
       -csc -unit getopt-long -uses srfi-13 -uses srfi-14 -uses data-structures -uses matchable -Jc getopt-long/getopt-long.scm -o getopt-long.o 2>&1 >$DEVNULL
       -csc -unit tweetnacl -emit-import-library tweetnacl -c tweetnacl/tweetnacl.scm -c tweetnacl/tweetnacl.impl.c -C -I./tweetnacl -o tweetnacl.o 2>&1 >$DEVNULL
       -csc -uses matchable -uses foreigners -c stty/stty.scm -emit-import-library stty -unit stty -o stty.o 2>&1 >$DEVNULL
       -csc -uses srfi-1,srfi-4,srfi-13,srfi-14,utils,stty,crypto-helper,tweetnacl,getopt-long,fmt,matchable -c pee.scm -o pee-unit.o 2>&1 >$DEVNULL
       -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."
 (DIR) 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")
        
 (DIR) 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-long stty files data-structures irregex files fmt ports extras)
       +        (import (chicken base) scheme (chicken condition) (chicken bitwise) (chicken io) (chicken port) (chicken random) (chicken format) (chicken string) (chicken file) (chicken pretty-print) (chicken irregex) (chicken time) (chicken pathname) (chicken process-context) (chicken sort) (chicken time posix))
       +(import srfi-1 srfi-4 srfi-13 srfi-14 crypto-helper fmt matchable tweetnacl getopt-long stty)
        
        (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)))