Bug#985459: dh-elpa: install error when root user has packages under /root/.emacs.d/elpa
Package: dh-elpa-helper
Version: 2.0.8
Severity: normal
Dear Maintainer,
I got this cryptic error when I installed elpa-company on a machine
where the root user had elpa packages already installed under
/root/.emacs.d/elpa:
Setting up elpa-company (0.9.13-2) ...
Install emacsen-common for emacs
emacsen-common: Handling install of emacsen flavor emacs
Install elpa-company for emacs
install/company-0.9.13: Handling install of emacsen flavor emacs
install/company-0.9.13: byte-compiling for emacs
In toplevel form:
async-tests.el:22:1:Error: Cannot open load file: No such file or directory, company-tests
[... snip many similar errors ...]
In toplevel form:
template-tests.el:22:1:Error: Cannot open load file: No such file or directory, company-tests
In toplevel form:
transformers-tests.el:22:1:Error: Cannot open load file: No such file or directory, company-tests
ERROR: install script from elpa-company package failed
dpkg: error processing package elpa-company (--configure):
installed elpa-company package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
elpa-company
E: Sub-process /usr/bin/dpkg returned an error code (1)
The problem seems to be that it picks up the root user's local company
package from package-user-dir in preference to the Debian package in
package-directory-list.
The patch below overrides package-user-dir to point at the Debian elpa
source directory. Not sure if there's a better way to fix this but it
resolves the problem for me and seems more robust.
Index: dh-elpa-2.0.8/helper/install
===================================================================
--- dh-elpa-2.0.8.orig/helper/install
+++ dh-elpa-2.0.8/helper/install
@@ -51,6 +51,7 @@ echo install/${ELPA_DIR}: byte-compiling
(cd ${elc_dir}
set +e
${FLAVOR} --quick --batch -l package \
+ --eval "(setq package-user-dir \"$src_dir\")" \
--eval "(add-to-list 'package-directory-list \"$src_dir\")" \
-f package-initialize -f batch-byte-compile *.el > Install.log 2>&1
if test $? -ne 0
-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-3-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-- no debconf information
Reply to: