[6/8] debian: Drop unintended files from location-python

Message ID 20210416130612.15959-7-valter.jansons@gmail.com
State Accepted
Commit d87c9c30671f2afbc6af01336498a94a16eb217d
Headers show
Series
  • debian: Mitigate bulk of Lintian issues
Related show

Commit Message

Valters Jansons April 16, 2021, 1:06 p.m. UTC
_location.la gets built and installed to site-packages/, however
an .la file is not expected to reside in the Python root. Additionally,
the dependency library listed does not have its respective .la file
installed. Further complicating the situation, dh-python moves the
site-packages/ files to dist-packages/ silently which then results in
a broken libdir left behind in the .la file.

The only reason the file is there is that it gets built inside the
source directory, which gets copied entirely to location-python package
as-is. Considering the situation, this commit ensures the .la files is
not packaged by deleting it from the package files subdirectory.

location-importer package pulls in two Python (.py) files from the
source directory. These files should not be included in the
location-python package as a result.

Resolves: lintian:
  unknown-file-in-python-module-directory,
  incorrect-libdir-in-la-file,
  non-empty-dependency_libs-in-la-file,
  binaries-have-file-conflict

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
---
 debian/rules | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Michael Tremer April 19, 2021, 1:14 p.m. UTC | #1
Hello,

> On 16 Apr 2021, at 14:06, Valters Jansons <valter.jansons@gmail.com> wrote:
> 
> _location.la gets built and installed to site-packages/, however
> an .la file is not expected to reside in the Python root. Additionally,
> the dependency library listed does not have its respective .la file
> installed. Further complicating the situation, dh-python moves the
> site-packages/ files to dist-packages/ silently which then results in
> a broken libdir left behind in the .la file.

Moving those files has indeed many bad consequences and I am not sure if Debian is doing something that is very logical.

However, I can live with simply deleting this file.

> The only reason the file is there is that it gets built inside the
> source directory, which gets copied entirely to location-python package
> as-is. Considering the situation, this commit ensures the .la files is
> not packaged by deleting it from the package files subdirectory.
> 
> location-importer package pulls in two Python (.py) files from the
> source directory. These files should not be included in the
> location-python package as a result.

And how do they go there when they are just being deleted here?

-Michael

> 
> Resolves: lintian:
>  unknown-file-in-python-module-directory,
>  incorrect-libdir-in-la-file,
>  non-empty-dependency_libs-in-la-file,
>  binaries-have-file-conflict
> 
> Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
> ---
> debian/rules | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/debian/rules b/debian/rules
> index 8893b7b..05b88fd 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -18,3 +18,11 @@ override_dh_perl:
> 
> override_dh_systemd_enable:
> 	dh_systemd_enable location-update.timer
> +
> +override_dh_install:
> +	dh_install
> +	# lintian: unknown-file-in-python-module-directory
> +	rm debian/location-python/usr/lib/python3*/site-packages/_location.la
> +	# linitan: binaries-have-file-conflict (d/location-importer.install)
> +	rm debian/location-python/usr/lib/python3*/site-packages/location/database.py
> +	rm debian/location-python/usr/lib/python3*/site-packages/location/importer.py
> -- 
> 2.31.1
>
Valters Jansons April 19, 2021, 1:56 p.m. UTC | #2
On Mon, Apr 19, 2021 at 4:14 PM Michael Tremer
<michael.tremer@ipfire.org> wrote:
> > The only reason the file is there is that it gets built inside the
> > source directory, which gets copied entirely to location-python package
> > as-is. Considering the situation, this commit ensures the .la files is
> > not packaged by deleting it from the package files subdirectory.
> >
> > location-importer package pulls in two Python (.py) files from the
> > source directory. These files should not be included in the
> > location-python package as a result.
>
> And how do they go there when they are just being deleted here?

dh_install copies files to separate subdirectories, from which
packages are constructed.

d/location-python.install specifies:
usr/lib/python3*/site-packages

d/location-importer.install specifies:
usr/lib/python3*/site-packages/location/database.py
usr/lib/python3*/site-packages/location/importer.py

As a result, those two particular .py files end up in both the
location-python and location-importer package subtrees. After
dh_install, before the next stage of packaging, we can get rid of the
two files from the location-python directory.

--Valters

Patch

diff --git a/debian/rules b/debian/rules
index 8893b7b..05b88fd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,3 +18,11 @@  override_dh_perl:
 
 override_dh_systemd_enable:
 	dh_systemd_enable location-update.timer
+
+override_dh_install:
+	dh_install
+	# lintian: unknown-file-in-python-module-directory
+	rm debian/location-python/usr/lib/python3*/site-packages/_location.la
+	# linitan: binaries-have-file-conflict (d/location-importer.install)
+	rm debian/location-python/usr/lib/python3*/site-packages/location/database.py
+	rm debian/location-python/usr/lib/python3*/site-packages/location/importer.py