From c660cccb8fb0fd2622e30e7ed6bd60575b03cf6f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 30 Apr 2017 22:05:33 -0700 Subject: [PATCH] ffi/build: Fix add/remove-plugin handling of compressed files. --- src/ffi/build.scm | 84 ++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/src/ffi/build.scm b/src/ffi/build.scm index d823c14d5..099d3fcf0 100644 --- a/src/ffi/build.scm +++ b/src/ffi/build.scm @@ -34,21 +34,21 @@ USA. (update-plugin 'remove name project infodir scmlibdir scmdocdir)) (define (update-plugin operation name project infodir scmlibdir scmdocdir) - (let ((scmlibdir (pathname-as-directory scmlibdir)) + (let ((scmlibdir (->namestring (pathname-as-directory scmlibdir))) (infodir (and (not (string-null? infodir)) - (pathname-as-directory infodir))) + (->namestring (pathname-as-directory infodir)))) (scmdocdir (and (not (string-null? scmdocdir)) - (pathname-as-directory scmdocdir)))) + (->namestring (pathname-as-directory scmdocdir))))) (let ((plugins (updated-plugin-list operation name scmlibdir))) (update-optiondb plugins scmlibdir) (update-info-index project plugins infodir scmdocdir) (update-html-index plugins scmdocdir)))) (define (updated-plugin-list operation plugin scmlibdir) - (let ((pathname (merge-pathnames "plugins.scm" scmlibdir))) - (if (file-exists? pathname) ;i.e. NOT in dpkg-buildpackage chroot + (let ((filename (string scmlibdir"/plugins.scm"))) + (if (file-exists? filename) ;i.e. NOT in dpkg-buildpackage chroot (rewrite-file - pathname + filename (lambda (in out) (cond ((eq? operation 'add) (let ((new (cons plugin (delete! plugin (read in))))) @@ -61,14 +61,14 @@ USA. (else (error "Unexpected plugin-list operation:" operation))))) (begin - (warn "plugin list not found:" pathname) + (warn "plugin list not found:" filename) '())))) (define (update-optiondb plugins scmlibdir) - (let ((pathname (merge-pathnames "optiondb.scm" scmlibdir))) - (if (file-exists? pathname) ;i.e. NOT in dpkg-buildpackage chroot + (let ((filename (string scmlibdir"/optiondb.scm"))) + (if (file-exists? filename) ;i.e. NOT in dpkg-buildpackage chroot (rewrite-file - pathname + filename (lambda (in out) (copy-to+line "(further-load-options" in out) (write-string (string ";;; DO NOT EDIT the remainder of this file." @@ -82,23 +82,21 @@ USA. (write-string name out) (write-string "\"))\n" out)) (sort plugins string\\(.*\\)" line))) (if (not regs) (loop) @@ -273,18 +269,18 @@ USA. ("bz2" "bzip2" . "bunzip2") ("Z" "compress" . "uncompress"))) -(define (file-exists-or-compressed? pathname) - (or (file-exists? pathname) - (let ((filename (->namestring pathname))) - (find (lambda (suffix.progs) - (file-exists? (string filename"."(car suffix.progs)))) - compressed-file-suffixes.progs)))) +(define (file-exists-or-compressed? filename) + (or (file-exists? filename) + (find-compressed-suffix.progs filename))) (define (compressed? filename) (and (not (file-exists? filename)) - (find (lambda (suffix.progs) - (file-exists? (string filename"."(car suffix.progs)))) - compressed-file-suffixes.progs))) + (find-compressed-suffix.progs filename))) + +(define (find-compressed-suffix.progs filename) + (find (lambda (suffix.progs) + (file-exists? (string filename"."(car suffix.progs)))) + compressed-file-suffixes.progs)) (define (un/compress-file program infile outfile) (let ((cmdline (string program" < '"infile"' > '"outfile"'"))) -- 2.25.1