Hi Sean,

Sean Whitton <spwhit...@spwhitton.name> writes:

> Hello,
>
> Sorry to keep asking for these minor changes, but it does help me
> understand the change better.
>
> Why can't you just use debian/install to install the .nosearch?  Are you
> trying to avoid creating an empty .nosearch in the source package, or is
> there some other reason?

Actually that's pretty much it.  And now I realize there is a downside
of using a custom command to create those empty files during install: I
forgot to implement the clean-up logic.  So to make things simple I now
just put those two files in the source and install them using d/install
in [1].  Please see updated full diff in [2] and attached.

[1] 
https://salsa.debian.org/manphiz/dh-elpa/-/commit/7e2bad6bf74d91f9cd876a4620796fe4eb5f3514
[2] 
https://salsa.debian.org/manphiz/dh-elpa/-/compare/master...nested-directory-support?from_project_id=18920

-- 
Xiyue Deng
From 7e2bad6bf74d91f9cd876a4620796fe4eb5f3514 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Thu, 4 Jul 2024 02:16:52 -0700
Subject: [PATCH 1/4] Don't recursively add elpa path to match package.el
 behavior

* Add .nosearch to `/usr/share/emacs/site-lisp/elpa{,-src}' using
triggers in dh-elpa, which will disable subdirs.el from processing
those directories.
---
 debian/install     | 2 ++
 elpa-src/.nosearch | 0
 elpa/.nosearch     | 0
 3 files changed, 2 insertions(+)
 create mode 100644 elpa-src/.nosearch
 create mode 100644 elpa/.nosearch

diff --git a/debian/install b/debian/install
index d6e2470..64fc1fc 100644
--- a/debian/install
+++ b/debian/install
@@ -2,3 +2,5 @@ elpa.pm usr/share/perl5/Debian/Debhelper/Sequence
 emacsen-common usr/share/debhelper/dh_elpa
 autoscripts/prerm-elpa usr/share/debhelper/autoscripts
 usr/bin
+elpa/.nosearch usr/share/emacs/site-lisp/elpa
+elpa-src/.nosearch usr/share/emacs/site-lisp/elpa-src
diff --git a/elpa-src/.nosearch b/elpa-src/.nosearch
new file mode 100644
index 0000000..e69de29
diff --git a/elpa/.nosearch b/elpa/.nosearch
new file mode 100644
index 0000000..e69de29
-- 
2.39.2

From b8e71ae56587bbc8ba069b66a882fd7862c25c0a Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Mon, 15 Apr 2024 13:03:16 -0700
Subject: [PATCH 2/4] Byte compile recursively during install to handle nested
 directories

* This handles addons that have source files under nested directories
in ELPA install directories.
---
 helper/install | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/helper/install b/helper/install
index 39db695..eb68ef5 100755
--- a/helper/install
+++ b/helper/install
@@ -58,7 +58,8 @@ echo "install/${ELPA_DIR}: byte-compiling for ${FLAVOR}"
  ${FLAVOR} --quick --batch -l package \
            --eval "(setq package-user-dir \"/nonexistent\")" \
            --eval "(add-to-list 'package-directory-list \"$src_dir\")" \
-           -f package-initialize -f batch-byte-compile ./*.el > Install.log 2>&1
+           -f package-initialize \
+           --eval "(byte-recompile-directory \".\" 0)" > Install.log 2>&1
  if test $? -ne 0
  then
    cat Install.log
-- 
2.39.2

From e68c5e9d4b6cf0509afc402b71464c6dda273fdb Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Wed, 17 Apr 2024 14:06:42 -0700
Subject: [PATCH 3/4] Create symlink from elpa-src to elpa recursively

* Instead of using `ln -s', use `cp -rs' so that directories are
handled recursively.
* In remove we use `rmdir --ignore-fail-on-non-empty' so this was
handled automatically as well.
---
 helper/install | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/helper/install b/helper/install
index eb68ef5..8d748c8 100755
--- a/helper/install
+++ b/helper/install
@@ -50,7 +50,7 @@ echo "install/${ELPA_DIR}: byte-compiling for ${FLAVOR}"
 # policy).  This makes complation easy, and also allows find-function
 # and find-library to work properly.  Also link all other top level
 # files and directories into the flavor directory
-(cd "${elc_dir}" && ln -sf "${el_dir}"* .)
+(cd "${elc_dir}" && cp -rsf "${el_dir}"* .)
 
 # Byte compile them
 (cd "${elc_dir}"
-- 
2.39.2

From 0a57ca5d4456ed1a41f0646e2ae4ac9fa486a8b8 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Wed, 17 Apr 2024 14:17:41 -0700
Subject: [PATCH 4/4] Update d/changelog

---
 debian/changelog | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c6211de..4b91ec7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,12 @@ dh-elpa (2.1.2) UNRELEASED; urgency=medium
   * dh_elpa_test: Don't rename files under test/, tests/ (Closes:
     #1069326).
   * Use `pretty' stack frame style in buttercup for full back trace.
+  * Add support for nested directory in elpa installation (Closes:
+    #1069210).
+    - Don't recursively add elpa path to match package.el behavior.
+    - Byte compile recursively during install to handle nested
+      directories.
+    - Create symlink from elpa-src to elpa recursively.
 
   [ Aymeric Agon-Rambosson ]
   * Get Package-Requires with lm-header-multiline (some upstream
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to