From: Chris Hanson Date: Sat, 27 Oct 2018 00:38:05 +0000 (-0700) Subject: Change way that plugins are registered so that lib and doc are separate. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~138^2~3^2~2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=f16103802fca95bc9316e7dcf66044424374e2ff;p=mit-scheme.git Change way that plugins are registered so that lib and doc are separate. This is needed when building just the documentation, as for the release. --- diff --git a/src/blowfish/Makefile.am b/src/blowfish/Makefile.am index 1c48110db..12f666774 100644 --- a/src/blowfish/Makefile.am +++ b/src/blowfish/Makefile.am @@ -96,13 +96,13 @@ install-data-hook: ( echo '(add-plugin "blowfish" "@MIT_SCHEME_PROJECT@"'; \ echo ' ""'; \ echo ' "$(DESTDIR)$(scmlibdir)"'; \ - echo ' "$(DESTDIR)$(scmdocdir)")' ) \ + echo ' "")' ) \ | $(MIT_SCHEME_EXE) --batch-mode install-html: install-html-am ( echo '(add-plugin "blowfish" "@MIT_SCHEME_PROJECT@"'; \ echo ' ""'; \ - echo ' "$(DESTDIR)$(scmlibdir)"'; \ + echo ' ""'; \ echo ' "$(DESTDIR)$(scmdocdir)")' ) \ | $(MIT_SCHEME_EXE) --batch-mode diff --git a/src/ffi/build.scm b/src/ffi/build.scm index f108574a2..0cd8f6d6a 100644 --- a/src/ffi/build.scm +++ b/src/ffi/build.scm @@ -36,52 +36,19 @@ USA. (update-plugin 'remove name project infodir scmlibdir scmdocdir)) (define (update-plugin operation name project infodir scmlibdir scmdocdir) - (let ((scmlibdir (->namestring (pathname-as-directory scmlibdir))) - (infodir (and (not (string-null? infodir)) - (->namestring (pathname-as-directory infodir)))) - (scmdocdir (and (not (string-null? scmdocdir)) - (->namestring (pathname-as-directory scmdocdir))))) - (if (file-exists? (string scmlibdir"optiondb.scm")) - ;; NOT in dpkg-buildpackage's chroot - (let ((plugins - (let ((filename (string scmlibdir"plugins.scm"))) - (if (file-exists? filename) - (rewrite-file - filename - (lambda (in out) - (cond ((eq? operation 'add) - (let ((new (cons name - (delete! name (read in))))) - (write new out) - new)) - ((eq? operation 'remove) - (let ((new (delete! name (read in)))) - (write new out) - new)) - (else - (error "Unexpected plugin-list operation:" - operation))))) - (cond ((eq? operation 'add) - (let ((new (list name))) - (call-with-exclusive-output-file - filename - (lambda (out) (write new out))) - new)) - ((eq? operation 'remove) - (warn "plugin list not found:" filename) - '()) - (else - (error "Unexpected plugin-list operation:" - operation))))))) - (update-optiondb plugins scmlibdir) - (update-info-index project plugins infodir scmdocdir) - (update-html-index project plugins scmdocdir))))) + (let ((infodir (normal-dirname infodir)) + (scmlibdir (normal-dirname scmlibdir)) + (scmdocdir (normal-dirname scmdocdir))) + (if scmlibdir + (update-plugin-lib operation name project scmlibdir)) + (if scmdocdir + (update-plugin-doc operation name project infodir scmdocdir)))) (define (delete-plugin-list) ;; For the prerm script: delete the database of plugins (plugins.scm ;; file in the system library directory). - (let ((filename (string (->namestring (system-library-directory-pathname)) - "plugins.scm"))) + (let ((filename + (merge-pathnames "plugins.scm" (system-library-directory-pathname)))) (if (file-exists? filename) (delete-file filename)))) @@ -89,20 +56,68 @@ USA. ;; For the postinst script: re-initialize the optiondb, Info and ;; HTML indices using the list of currently installed plugins. (The ;; indices are presumed clobbered by the core upgrade.) - (let ((scmlibdir (->namestring (pathname-as-directory scmlibdir))) - (infodir (and (not (string-null? infodir)) - (->namestring (pathname-as-directory infodir)))) - (scmdocdir (and (not (string-null? scmdocdir)) - (->namestring (pathname-as-directory scmdocdir))))) - (let* ((pathname (string scmlibdir"plugins.scm")) - (plugins (if (file-exists? pathname) - (call-with-input-file pathname read) - '()))) - (if (not (null? plugins)) - (begin - (update-optiondb plugins scmlibdir) - (update-info-index project plugins infodir scmdocdir) - (update-html-index project plugins scmdocdir)))))) + (let ((infodir (normal-dirname infodir)) + (scmlibdir (normal-dirname scmlibdir)) + (scmdocdir (normal-dirname scmdocdir))) + (if scmlibdir + (update-optiondb (read-plugins-file scmlibdir) + scmlibdir)) + (if scmdocdir + (let ((plugins (read-plugins-file scmdocdir))) + (update-info-index project plugins infodir scmdocdir) + (update-html-index project plugins scmdocdir))))) + +(define (normal-dirname dirname) + (and dirname + (not (string-null? dirname)) + (->namestring (pathname-as-directory dirname)))) + +(define (update-plugin-lib operation name project scmlibdir) + (if (file-exists? (merge-pathnames "optiondb.scm" scmlibdir)) + ;; NOT in dpkg-buildpackage's chroot + (update-optiondb plugins + (update-plugins-file operation name scmlibdir) + scmlibdir))) + +(define (update-plugin-doc operation name project infodir scmdocdir) + (let ((plugins (update-plugins-file operation name scmdocdir))) + (update-info-index project plugins infodir scmdocdir) + (update-html-index project plugins scmdocdir))) + +(define (read-plugins-file dir) + (let ((filename (merge-pathnames "plugins.scm" dir))) + (if (file-exists? filename) + (call-with-input-file filename read) + '()))) + +(define (update-plugins-file operation name dir) + (let ((filename (merge-pathnames "plugins.scm" dir))) + (if (file-exists? filename) + (rewrite-file filename + (lambda (in out) + (case operation + ((add) + (let ((new (cons name (delete! name (read in))))) + (write new out) + new)) + ((remove) + (let ((new (delete! name (read in)))) + (write new out) + new)) + (else + (error "Unexpected plugin-list operation:" operation))))) + (case operation + ((add) + (let ((new (list name))) + (call-with-exclusive-output-file filename + (lambda (out) + (write new out))) + new)) + ((remove) + (warn "plugin list not found:" filename) + '()) + (else + (error "Unexpected plugin-list operation:" operation)))))) (define (update-optiondb plugins scmlibdir) (let ((filename (string scmlibdir"optiondb.scm"))) @@ -123,7 +138,7 @@ USA. (write-string "\"))\n" out)) (sort plugins string