On 14.03.24 21:38, Christoph Biedl wrote:
After getting some help in IRC, I guess the problem boils down to:

1. All architectures provide the t64 variant (libmagic1t64).
2. Some architectures no longer provide the old variant (libmagic1), for
    example armhf.
3. Therefore, the install dependency of python3-magic must be the t64 variant.

and derive the name of the shared library package from the
libmagic-dev package.

Now replacing one hardcoded binary library dependency with a different
one is not quite the brightest move as this will introduce work should
the libmagic ABI ever change (hasn't happened in 20 years but still).
So it was nicer to do this dynamically during build. That step however
is optional.

Do you have an idea, an existing solution how to do that?

So far I found two ways, and dislike both:

* Derive from apt-cache:

     override_dh_gencontrol:
         perl -MDebian::Debhelper::Dh_Lib -e \
             'addsubstvar ("python3-magic", "misc:Depends", $$ARGV[0])' \
             "$$(apt-cache show libmagic-dev | awk '($$1=="Depends:"){print $$2}' | 
head -n 1)"
         dh_gencontrol $@

Querying the apt database from inside a package build feels like a layer
violation.

* Abuse dpkg-shlibdeps:

     override_dh_gencontrol:
         dpkg-shlibdeps -e /usr/bin/file -Tdebian/python3-magic.substvars
         dh_gencontrol $@

(Some tweaks to debian/control needed as well.)

dep := $(shell dpkg-query '-f${Depends}' -W libmagic-dev | sed 's/.*\(libmagic[a-z0-9]*\).*/\1/')
echo "magic:Depends=$(dep)" >> debian/python3-magic.substvars

and add ${magic:Depends} to the control file.

This also introduces an install dependency on libc6, and my gut feeling
tells me this was the point to make python3-magic arch:any.

the approach above doesn't add the libc dependency.


So, is all this worth the efforts? FWIW, I maintain the libmagic
package as well, so being lazy now will just hurt me later.

     Christoph

Reply via email to