From efb13007cd17629da9e1100854f61cbeabefb459 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sun, 5 Nov 2017 16:34:10 -0700 Subject: [PATCH] Do not install an empty plugins.scm during an upgrade. Create it when the first plugin is installed and remove it only when removing (not upgrading!) the core package. --- debian/mit-scheme-pucked.prerm | 16 ++++++++++++++++ src/Makefile.in | 4 ---- src/ffi/build.scm | 19 ++++++++++++++++--- 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100755 debian/mit-scheme-pucked.prerm diff --git a/debian/mit-scheme-pucked.prerm b/debian/mit-scheme-pucked.prerm new file mode 100755 index 000000000..5ea7bc6d3 --- /dev/null +++ b/debian/mit-scheme-pucked.prerm @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +case "$1" in + remove) + ( echo "(parameterize ((param:suppress-loading-message? #t))" + echo " (load-option 'ffi)" + echo " ((access delete-plugin-list (->environment '(ffi build)))))" ) \ + | /usr/bin/mit-scheme-pucked --batch-mode + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/src/Makefile.in b/src/Makefile.in index 894c18d1f..cd00e7fc8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -795,10 +795,6 @@ install-auxdir-top: $(INSTALL_DATA) $(top_srcdir)/etc/optiondb.scm \ $(DESTDIR)$(AUXDIR)/.; \ else echo "$(DESTDIR)$(AUXDIR)/optiondb.scm already exists"; fi - @if ! test -e $(DESTDIR)$(AUXDIR)/plugins.scm; then \ - $(INSTALL_DATA) $(top_srcdir)/etc/plugins.scm \ - $(DESTDIR)$(AUXDIR)/.; \ - else echo "$(DESTDIR)$(AUXDIR)/plugins.scm already exists"; fi $(INSTALL_DATA) lib/*.com $(DESTDIR)$(AUXDIR)/. .PHONY: default-target all all-native all-liarc macosx-app diff --git a/src/ffi/build.scm b/src/ffi/build.scm index a0662e94f..a4c1ab002 100644 --- a/src/ffi/build.scm +++ b/src/ffi/build.scm @@ -60,9 +60,22 @@ USA. new)) (else (error "Unexpected plugin-list operation:" operation))))) - (begin - (warn "plugin list not found:" filename) - '())))) + (cond ((eq? operation 'add) + (let ((new (list plugin))) + (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)))))) + +(define (delete-plugin-list) + (let ((path (merge-pathnames "plugins.scm" + (system-library-directory-pathname)))) + (if (file-exists? path) (delete-file path)))) (define (update-optiondb plugins scmlibdir) (let ((filename (string scmlibdir"optiondb.scm"))) -- 2.25.1