ffi: Do not create plugins.scm inside dpkg-buildpackage's chroot.
authorMatt Birkholz <matt@birchwood-abbey.net>
Tue, 7 Nov 2017 00:53:37 +0000 (17:53 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Tue, 7 Nov 2017 00:53:37 +0000 (17:53 -0700)
Otherwise the nearly empty file will be included in the package and
unpacked during the installation, clobbering the existing list.

src/ffi/build.scm

index a4c1ab00269afe9bf0fc3c69ab6dde772c6f4df9..4eaef492327c86d19081d0437a4d9594e77140c3 100644 (file)
@@ -45,32 +45,34 @@ USA.
       (update-html-index plugins scmdocdir))))
 
 (define (updated-plugin-list operation plugin scmlibdir)
-  (let ((filename (string scmlibdir"plugins.scm")))
-    (if (file-exists? filename)         ;i.e. NOT in dpkg-buildpackage chroot
-       (rewrite-file
-        filename
-        (lambda (in out)
-          (cond ((eq? operation 'add)
-                 (let ((new (cons plugin (delete! plugin (read in)))))
-                   (write new out)
-                   new))
-                ((eq? operation 'remove)
-                 (let ((new (delete! plugin (read in))))
-                   (write new out)
-                   new))
-                (else
-                 (error "Unexpected plugin-list operation:" operation)))))
-       (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))))))
+  (if (let ((filename (string scmlibdir"optiondb.scm")))
+       (file-exists? filename)) ;i.e. NOT in dpkg-buildpackage chroot
+      (let ((filename (string scmlibdir"plugins.scm")))
+       (if (file-exists? filename)
+           (rewrite-file
+            filename
+            (lambda (in out)
+              (cond ((eq? operation 'add)
+                     (let ((new (cons plugin (delete! plugin (read in)))))
+                       (write new out)
+                       new))
+                    ((eq? operation 'remove)
+                     (let ((new (delete! plugin (read in))))
+                       (write new out)
+                       new))
+                    (else
+                     (error "Unexpected plugin-list operation:" operation)))))
+           (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"