[fixes for catalogs atsmyles@earthlink.net**20100126222018 1. changed version-name to version-number 2. removed library-base. the uri is always resolved when using catalog->libraries function. You can set a base when serializing a uri. ] hunk ./catalog.scm 6 -(define $library (make-rtd 'library '#((immutable name) (immutable versions) (immutable base) (immutable properties)))) -(define $version (make-rtd 'version '#((immutable name) (immutable requires) (immutable uri) (immutable properties)))) +(define $library (make-rtd 'library '#((immutable name) (immutable versions) (immutable properties)))) +(define $version (make-rtd 'version '#((immutable number) (immutable requires) (immutable uri) (immutable properties)))) hunk ./catalog.scm 14 -(define library-base (rtd-accessor $library 'base)) hunk ./catalog.scm 15 -(define version-name (rtd-accessor $version 'name)) +(define version-number (rtd-accessor $version 'number)) hunk ./catalog.scm 19 -;utility (should be part put in seperate file.) hunk ./catalog.scm 25 - ((result) (cdr result)) + (result (cdr result)) hunk ./catalog.scm 50 - (define (form->version form) + (define (form->version form base) hunk ./catalog.scm 58 - (make-version version requires uri properties) + (make-version version requires (if uri (path-expand uri base) "") properties) hunk ./catalog.scm 72 - (make-library name (map form->version versions) base properties))) + (make-library name (map (lambda (f) (form->version f base)) versions) properties))) hunk ./catalog.scm 105 - (if (version? (version-name version)) (append (list version) result))) + (if (version? (version-number version)) (append (list version) result))) hunk ./catalog.scm 111 -(define (serialize-library l) +(define (serialize-library l . base) + (define (last-index-of s c) + (let loop ((i (string-length s))) + (if (< i 0) #f + (if (char=? c (string-ref s i)) i (loop (- i 1)))))) + (define (relativize path base) + (let ((l1 (string-length path)) + (l2 (string-length base))) + (cond + ((zero? l2) path) + ((char=? (string-ref path 0) "/") path) + (else (string-append (substring base 0 (last-index-of base #\/)) path))))) + hunk ./catalog.scm 125 - `(,(version-name v) + `(,(version-number v) hunk ./catalog.scm 129 - ,(version-uri v) + ,(if (null? base) (version-uri v) (relativize (version-uri v) (car base))) hunk ./catalog.scm 135 - ,(library-base l) + ,@base hunk ./catalog.scm 141 - (if (pair? requirement) + (cond + ((null? requirement) #t) + ((pair? requirement) hunk ./catalog.scm 150 - (not (satisfied? (cadr requirement))))) - (memq requirement features))) + (not (satisfied? (cadr requirement)))) + ;otherwise it is the same as and + (else (all-satisfied? requirement)))) + ;we assume that requirement is a single symbol + (else (memq requirement features)))) hunk ./catalog.scm 182 - (car (filter (lambda (v) (and (version-reference v) (satisfies-requirements? (version-requires v) features))) (library-versions library))) -#f))) + (car (filter (lambda (v) + (and (version-reference v) (satisfies-requirements? (version-requires v) features))) (library-versions library))) + #f))) hunk ./primitives.scm 220 - (let ((in-file (path-expand (version-uri version) (library-base library))) - (out-file (library->filename (library-name library) (version-name version) bin)) + (let ((in-file (version-uri version)) + (out-file (library->filename (library-name library) (version-number version) bin)) hunk ./primitives.scm 225 - (make-version (version-name version) (cons 'gambit-binary (version-requires version)) out-file (append '((dynlib #t)) (version-properties version))))) + (make-version (version-number version) (cons 'gambit-binary (version-requires version)) out-file (append '((dynlib #t)) (version-properties version))))) hunk ./primitives.scm 228 - (make-library (library-name library) (append compiled-versions (library-versions library)) (library-base library) (library-properties library)))) (catalog->libraries base-dir catalog))))) + (make-library (library-name library) (append compiled-versions (library-versions library)) (library-properties library)))) (catalog->libraries base-dir catalog))))) hunk ./runtime.scm 82 - ((version) (ex:run-r6rs-sequence (ex:read-library version))) + ((version? version) (ex:run-r6rs-sequence (ex:read-library version)))