Hi Sean,

Sean Whitton <[email protected]> writes:

> Xiyue Deng [02/Jul  6:15pm -07] wrote:
>> I have identified a case that this dependency handling is required for
>> correctly byte compiling transitive dependency on packages that need to
>> be newer than the built-in ones. When working on magit 4.6.0, which
>> requires transient 0.13 and compat 31.0, both of which are built-in
>> packages but the version required is higher than the ones bundled in
>> Emacs 30.2 and hence external newer packages are required. With dh-elpa
>> 2.1.9, the compilation of magit fails (full log attached). The first few
>> lines look like below:
>>
>> ,----
>> | Checking /usr/share/emacs/site-lisp/elpa/magit-4.6.0...
>> | Compiling /usr/share/emacs/site-lisp/elpa/magit-4.6.0/git-commit.el...
>> |
>> | In toplevel form:
>> | git-commit.el:103:11: Error: Symbol’s function definition is void: 
>> static-when
>> | Compiling /usr/share/emacs/site-lisp/elpa/magit-4.6.0/git-rebase.el...
>> |
>> | In toplevel form:
>> | git-rebase.el:75:11: Error: transient--init-suffix-key is already defined 
>> as something else than a generic function
>> | ...
>> `----
>>
>> This strongly suggests that the bundled older version of compat is
>> in-use which does not provide `static-when' yet.
>>
>> Initially I suspected that the command to do the byte compiling may be
>> at fault, more specifically the use of "--quick" may cause it to ignore
>> the external packages, but ruled it out after some experiments. I have
>> confirmed that using dh-elpa with the simplified dependency handling
>> magit 4.6.0 will succeed to byte compile.
>>
>> It would be good to have this reviewed and approved soon. Maybe we can
>> make an experimental upload soonish for testing?
>
> I'm not sure where it is.  Could you just post patches?

It's on the `built-in-addon-handling' branch[1], which is rebased on the
integration test branch. I have also attached the patches here.

As magit's autopkgtest is affected by this issue, you can check the
autopkgtest log on Salsa CI at [2].

[1] 
https://salsa.debian.org/emacsen-team/dh-elpa/-/commits/built-in-addon-handling?ref_type=heads
[2] https://salsa.debian.org/emacsen-team/magit/-/jobs/9890715

-- 
Regards,
Xiyue Deng
From c54371e6f84a018c33e415674e2382fd834e2a6f Mon Sep 17 00:00:00 2001
From: Xiyue Deng <[email protected]>
Date: Wed, 10 Jun 2026 21:38:11 -0700
Subject: [PATCH 1/2] Drop special handling of built-in packages

---
 dh-elpa.el | 43 ++++++++++---------------------------------
 1 file changed, 10 insertions(+), 33 deletions(-)

diff --git a/dh-elpa.el b/dh-elpa.el
index 6e24e88..ab39dd2 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -169,39 +169,16 @@ such a case."
     str))
 
 (defun dhelpa-filter-deps-for-debian (deps)
-  "Filter a list of package.el deps DEPS for Debian.
-
-Remove packages that are maintained outside of the elpa-*
-namespace in Debian, plus Emacs itself.
-
-Also remove built-in packages, except those built-in packages
-that are also packaged separately in Debian.
-
-These are packaged separately for two reasons:
-
-- it allows us to provide newer versions than those in Emacs core
-
-- it permits use of addons with older versions of Emacs, for
-  which the dependency is not yet a built-in package.
-
-A shortcoming is that for built-in packages, the Lisp in our elpa-*
-packages always takes precedence, such that if we upload a new release of
-Emacs with a version of one of these packages that's newer than the one we
-have separately packaged, the older code will be loaded, leading to
-hard-to-diagnose incompatibilities.
-
-For the time being the upshot is that after uploading a new Emacs release
-to sid, we also need to ensure everything listed here is up-to-date with
-upstream in sid, too."
-  (let ((non-elpa '(emacs))
-        (packaged-separately '(let-alist transient org)))
-    (cl-remove-if (lambda (dep)
-		    (let ((pkg (car dep)))
-                      (or (memq pkg non-elpa)
-                          (and
-                           (package-built-in-p pkg)
-                           (not (memq pkg packaged-separately))))))
-                  deps)))
+  "Filter a list of package.el DEPS for Debian.
+
+This function used to have special handling for buit-in packages.  Since
+version 1:30.1+1-7, emacs-common provides all built-in packages using
+elpa-<package> convention, which makes such special handling no longer
+necessary.  Currently only `emacs' is filtered out."
+  (cl-remove-if (lambda (dep)
+		  (let ((pkg (car dep)))
+                    (or (string= pkg "emacs"))))
+                  deps))
 
 (defun dhelpa-filter-pkg-desc (desc)
   "Filter the dependencies of package description DESC for Debian."
-- 
2.53.0

From 2ca8be99595fa6ea5c2d7999b84eafa12fdd7524 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <[email protected]>
Date: Wed, 10 Jun 2026 21:48:32 -0700
Subject: [PATCH 2/2] Update test cases

---
 .../complex-addons/expected/debian/.debhelper/elpa/foo.desc     | 2 +-
 .../dh_elpa/complex-addons/expected/debian/elpa-foo.substvars   | 2 +-
 .../usr/share/emacs/site-lisp/elpa-src/foo-1.3/foo-pkg.el       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/data/dh_elpa/complex-addons/expected/debian/.debhelper/elpa/foo.desc b/t/data/dh_elpa/complex-addons/expected/debian/.debhelper/elpa/foo.desc
index 03bea2a..9dbdc80 100644
--- a/t/data/dh_elpa/complex-addons/expected/debian/.debhelper/elpa/foo.desc
+++ b/t/data/dh_elpa/complex-addons/expected/debian/.debhelper/elpa/foo.desc
@@ -1,3 +1,3 @@
 ELPA-Name: foo
 ELPA-Version: 1.3
-ELPA-Requires: elpa-magit (>= 4.3.0), elpa-transient (>= 0.7)
+ELPA-Requires: elpa-cl-lib (>= 0.1), elpa-magit (>= 4.3.0), elpa-transient (>= 0.7)
diff --git a/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo.substvars b/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo.substvars
index 796e6ab..a9b8090 100644
--- a/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo.substvars
+++ b/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo.substvars
@@ -1,2 +1,2 @@
-elpa:Depends=elpa-magit (>= 4.3.0), elpa-transient (>= 0.7)
+elpa:Depends=elpa-cl-lib (>= 0.1), elpa-magit (>= 4.3.0), elpa-transient (>= 0.7)
 misc:Depends=dh-elpa-helper, emacsen-common
diff --git a/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo/usr/share/emacs/site-lisp/elpa-src/foo-1.3/foo-pkg.el b/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo/usr/share/emacs/site-lisp/elpa-src/foo-1.3/foo-pkg.el
index b8b5183..b39aa5c 100644
--- a/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo/usr/share/emacs/site-lisp/elpa-src/foo-1.3/foo-pkg.el
+++ b/t/data/dh_elpa/complex-addons/expected/debian/elpa-foo/usr/share/emacs/site-lisp/elpa-src/foo-1.3/foo-pkg.el
@@ -1,2 +1,2 @@
 ;;; Generated package description from foo.el  -*- no-byte-compile: t -*-
-(define-package "foo" "1.3" "test of dh-elpa" '((magit "4.3.0") (transient "0.7")))
+(define-package "foo" "1.3" "test of dh-elpa" '((cl-lib "0.1") (magit "4.3.0") (transient "0.7")))
-- 
2.53.0

Attachment: signature.asc
Description: PGP signature

Reply via email to