Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -57,10 +57,11 @@ mofiles/portlogger.o : mofiles/dbmod.o mofiles/dbfile.o : \ mofiles/debugprint.o mofiles/commonmod.o +mofiles/commonmod.o : mofiles/debugprint.o configf.o : commonmod.import.o mofiles/dbfile.o : mofiles/debugprint.o mofiles/rmtmod.o mofiles/dbmod.o : mofiles/dbfile.o mofiles/commonmod.o mofiles/debugprint.o db.o : mofiles/dbmod.o mofiles/dbfile.o mofiles/debugprint.o : mofiles/mtargs.o Index: commonmod.scm ================================================================== --- commonmod.scm +++ commonmod.scm @@ -64,10 +64,11 @@ chicken.condition chicken.file chicken.file.posix chicken.io chicken.pathname + chicken.port chicken.process chicken.process-context chicken.process-context.posix chicken.sort chicken.string @@ -83,10 +84,12 @@ srfi-1 srfi-18 srfi-69 typed-records system-information + + debugprint ))) ;;====================================================================== ;; CONTENTS ;; Index: dbfile.scm ================================================================== --- dbfile.scm +++ dbfile.scm @@ -24,13 +24,16 @@ (declare (uses debugprint)) (declare (uses commonmod)) (module dbfile * - - (import scheme - chicken +(import scheme) + +(cond-expand + (chicken-4 + + (import chicken data-structures extras matchable (prefix sqlite3 sqlite3:) @@ -45,11 +48,54 @@ hostinfo commonmod debugprint ) + ) + (chicken-5 + (import (prefix sqlite3 sqlite3:) + ;; data-structures + ;; extras + ;; files + ;; posix + ;; posix-extras + chicken.base + chicken.condition + chicken.file + chicken.file.posix + chicken.format + chicken.io + chicken.pathname + chicken.port + chicken.process + chicken.process-context + chicken.process-context.posix + chicken.sort + chicken.string + chicken.time + chicken.time.posix + + matchable + md5 + message-digest + pathname-expand + regex + regex-case + srfi-1 + srfi-18 + srfi-69 + typed-records + stack + system-information + commonmod + debugprint + ) + (define file-write-access? file-writable?) + (define file-move move-file) + )) + ;; parameters ;; (define dbfile:testsuite-name (make-parameter #f)) (define keep-age-param (make-parameter 10)) ;; qif file age, if over move to attic Index: dbmod.scm ================================================================== --- dbmod.scm +++ dbmod.scm @@ -25,29 +25,48 @@ (declare (uses debugprint)) (module dbmod * -(import scheme - chicken - data-structures - extras - files +(import scheme) + +(cond-expand + (chicken-4 + (import chicken + data-structures + extras + files + + posix + + )) + (chicken-5 + (import chicken.base + chicken.condition + chicken.file + chicken.pathname + chicken.process + chicken.sort + chicken.string + chicken.time + + ) + (define file-read-access? file-readable?) + (define file-copy copy-file) + )) - format +(import format (prefix sqlite3 sqlite3:) matchable - posix typed-records srfi-1 srfi-18 srfi-69 commonmod dbfile - debugprint - ) + debugprint) ;; NOTE: This returns only the name "1.db", "main.db", not the path ;; (define (dbmod:run-id->dbfname run-id) (conc (dbfile:run-id->dbnum run-id)".db")) Index: portlogger.scm ================================================================== --- portlogger.scm +++ portlogger.scm @@ -23,15 +23,47 @@ (declare (uses dbmod)) (module portlogger * -(import scheme chicken data-structures) -(import srfi-1 posix srfi-69 hostinfo dot-locking z3 - (srfi 18) extras s11n) +(import scheme) + +(cond-expand + (chicken-4 + (import chicken data-structures) + (import posix + ;; hostinfo + ;; dot-locking + extras + ) + + (import (prefix sqlite3 sqlite3:)) + (import debugprint dbmod) + ) + (chicken-5 + (import chicken.base + chicken.condition + chicken.file + chicken.pathname + chicken.process-context.posix + chicken.process + chicken.sort + chicken.string + chicken.time + chicken.random + + system-information + ) + (define file-write-access? file-writable?) + (define random pseudo-random-integer) + )) + +(import srfi-1 srfi-69 z3 + (srfi 18) s11n) (import (prefix sqlite3 sqlite3:)) (import debugprint dbmod) + ;; lsof -i (define (portlogger:open-db fname) (let* ((avail (tasks:wait-on-journal fname 5 remove: #t)) ;; wait up to about 10 seconds for the journal to go away (exists (file-exists? fname))