Do not install an empty plugins.scm during an upgrade.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sun, 5 Nov 2017 23:34:10 +0000 (16:34 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sun, 5 Nov 2017 23:34:10 +0000 (16:34 -0700)
Create it when the first plugin is installed and remove it only when
removing (not upgrading!) the core package.

debian/mit-scheme-pucked.prerm [new file with mode: 0755]
src/Makefile.in
src/ffi/build.scm

diff --git a/debian/mit-scheme-pucked.prerm b/debian/mit-scheme-pucked.prerm
new file mode 100755 (executable)
index 0000000..5ea7bc6
--- /dev/null
@@ -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
index 894c18d1f5173c72ea377141dac663104fff3271..cd00e7fc8b86eed2d16054667926b46539e9f848 100644 (file)
@@ -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
index a0662e94f9049791e4abd9e2447f4090b652fcb4..a4c1ab00269afe9bf0fc3c69ab6dde772c6f4df9 100644 (file)
@@ -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")))