Package: dh-elpa
Version: 2.0.17
Severity: normal
X-Debbugs-Cc: none, Xiyue Deng <manp...@gmail.com>

During autopkgtest, dh_elpa_test will rename the non-test source files
so as to ensure we are running the test using the Emacs add-on modules
from the installed package instead of from the source directories.  The
way that dh_elpa_test currently works is to only keep files that have a
test case defined in it.  However, this doesn't take utilities and
artifacts, which are usually defined under test directories, under
consideration, and without those the tests are broken as well.

Therefore I'd like to propose retaining all files under test directories
from being renamed in autopkgtest.  I have been testing a fix in [1]
which seems to work in common cases.  I have also attached the patches
at the end of the email as well.  Please review and comment.  TIA!

[1] 
https://salsa.debian.org/manphiz/dh-elpa/-/compare/master...retain-test-files-in-autopkgtest?from_project_id=18920

-- System Information:
Debian Release: 12.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-20-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dh-elpa depends on:
ii  debhelper               13.11.4
ii  emacs                   1:29.3+1-2~bpo12+0manphiz1
ii  emacs-gtk [emacs]       1:29.3+1-2~bpo12+0manphiz1
ii  libarray-utils-perl     0.5-3
ii  libconfig-tiny-perl     2.28-2
ii  libdebian-source-perl   0.122
ii  libdpkg-perl            1.21.22
ii  libfile-find-rule-perl  0.34-3
ii  libtext-glob-perl       0.11-3
ii  perl                    5.36.0-7+deb12u1

dh-elpa recommends no packages.

dh-elpa suggests no packages.

-- no debconf information
>From 48514b41927f8601c6e1af7ebcf49c4af9a16b54 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Fri, 19 Apr 2024 14:14:31 -0700
Subject: [PATCH 1/2] Exclude test directories from renaming in autopkgtest by
 default

* Files under test directories may also include utilities that are
used in tests but don't have any test in them.  It makes sense to keep
them by default during autopkgtest to make it work out-of-the-box.
---
 dh_elpa_test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dh_elpa_test b/dh_elpa_test
index 14e31dd..b9f1152 100755
--- a/dh_elpa_test
+++ b/dh_elpa_test
@@ -271,7 +271,9 @@ if ($autopkgtest) {
     my $rule = File::Find::Rule->new;
     $rule
       ->or(File::Find::Rule
-           ->name('.pc', 'debian', '.git')
+           ->name('.pc', 'debian', '.git', # exclude non-source directories
+                  'test', 'tests', # exclude test directories
+           )
            ->directory->prune->discard,
            File::Find::Rule->new);
     $rule
-- 
2.39.2

>From eb4f407d6c1541fda298dcfe8bcaee1fdebd5677 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manp...@gmail.com>
Date: Fri, 19 Apr 2024 14:24:40 -0700
Subject: [PATCH 2/2] Add more comments to describe the purpose of renaming
 source files

---
 dh_elpa_test | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dh_elpa_test b/dh_elpa_test
index b9f1152..c0e99e0 100755
--- a/dh_elpa_test
+++ b/dh_elpa_test
@@ -268,6 +268,10 @@ if ($autopkgtest) {
         exit 0;
     }
 
+    # Compile a list of files to be renamed during autopkgtest.  This usually
+    # renames source *.el file outside the test directories so that during
+    # autopkgtest we are testing the installed package instead of relying on
+    # source files from the source directory.
     my $rule = File::Find::Rule->new;
     $rule
       ->or(File::Find::Rule
-- 
2.39.2

Reply via email to