Bug#1026568: python-distutils-extra: FTBFS: AssertionError: "diff -x foo.pot -x '*.pyc' -Nur /tmp/tmp[1578 chars]n+\n" != ''

2023-01-29 Thread Didier 'OdyX' Raboud
Control: tags -1 +pending

Le dimanche, 29 janvier 2023, 12.32:37 h CET Didier 'OdyX' Raboud a écrit :
> I've also pushed this to
> https://salsa.debian.org/python-team/packages/python-distutils-extra/-/merg
> e_requests/7 for review, but given the freeze and as I've tested building
> python-apt with that code and don't see any regressions, I'll upload a Team
> upload to DELAYED/5 later today.

Eh. With tumbleweed's "LGTM" on IRC, I just went ahead and uploaded this.

It looks like the autopkgtest might be failing, so I'll keep an eye on this if 
it fails or delays migration.


Regards,
OdyX

signature.asc
Description: This is a digitally signed message part.


Bug#1026568: python-distutils-extra: FTBFS: AssertionError: "diff -x foo.pot -x '*.pyc' -Nur /tmp/tmp[1578 chars]n+\n" != ''

2023-01-29 Thread Didier 'OdyX' Raboud
Control: tags -1 +patch -help

Ok. It turns out staying at a BSP helps finding the brain space to fix such 
things.

Le dimanche, 29 janvier 2023, 00.01:26 h CET Didier 'OdyX' Raboud a écrit :
> The crux of the issue is that python3-setuptools from 54.0.0
> (https://setuptools.pypa.io/en/latest/history.html#v54-0-0) does _not_ build
> the .egg-info as single file, but _only_ as directory [0].
> 
> This has the direct consequence that all tests fail for either of these
> reasons:
> * the .egg-info is not a file, and cannot be compared with the expected
> version
> * the .egg-info directory is not cleaned in clean() , hence the snapshot-vs-
> result directory comparison is always going to flag the .egg-info directory
> as resulting cruft.

Here comes a patch to fix 1 issue in the code itself, and fix all the tests to 
match that new reality.

I've also pushed this to 
https://salsa.debian.org/python-team/packages/python-distutils-extra/-/merge_requests/7
 for review, but given the freeze and as 
I've tested building python-apt with that code and don't see any regressions, 
I'll upload a Team upload to DELAYED/5 later today.

Best,

OdyXdiff --git a/DistUtilsExtra/auto.py b/DistUtilsExtra/auto.py
index 7b3cce1..6376c5e 100644
--- a/DistUtilsExtra/auto.py
+++ b/DistUtilsExtra/auto.py
@@ -85,6 +85,9 @@ def setup(**attrs):
 for d in ignore_dirs:
 if f.startswith(d + os.path.sep):
 src.remove(f)
+# Also remove files from the .egg-info directory
+if '.egg-info/' in f:
+src.remove(f)
 
 __cmdclass(attrs)
 __modules(attrs, src)
diff --git a/debian/changelog b/debian/changelog
index 6147f2f..7209f57 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-distutils-extra (2.47.1) UNRELEASED; urgency=medium
+
+  * Adapt tests to distutils 54+; fixes FTBFS (Closes: #1026568)
+
+ -- Didier Raboud   Sun, 29 Jan 2023 12:05:51 +0100
+
 python-distutils-extra (2.47) unstable; urgency=medium
 
   * Team upload.
diff --git a/test/auto.py b/test/auto.py
index 61286d1..17bb81a 100755
--- a/test/auto.py
+++ b/test/auto.py
@@ -51,6 +51,17 @@ setup(
 self.snapshot = None
 self.install_tree = None
 
+def assert_egg_info_directory_is_present_and_well(self):
+'''Check that no .egg-info file is present, that an egg_info directory is present and that it contains the expected files'''
+
+f = self.installed_files()
+# All files are in an .egg-info directory; no .egg-info file is created
+self.assertFalse(any([_.endswith('.egg-info') for _ in f ]))
+# There are 4 files in said directory
+self.assertEqual(len(f), 4)
+# Check that the four exist
+self.assertTrue(all([any([_.endswith(c) for c in ['PKG-INFO', 'SOURCES.txt', 'dependency_links.txt', 'top_level.txt']]) for _ in f]))
+
 #
 # actual tests come here
 #
@@ -63,10 +74,7 @@ setup(
 self.assertEqual(s, 0)
 self.assertNotIn('following files are not recognized', o)
 
-f = self.installed_files()
-# just installs the .egg_info
-self.assertEqual(len(f), 1)
-self.assertTrue(f[0].endswith('.egg-info'))
+self.assert_egg_info_directory_is_present_and_well()
 
 def test_vcs(self):
 '''Ignores revision control files'''
@@ -81,10 +89,7 @@ setup(
 self.assertEqual(s, 0)
 self.assertNotIn('following files are not recognized', o)
 
-f = self.installed_files()
-# just installs the .egg_info
-self.assertEqual(len(f), 1)
-self.assertTrue(f[0].endswith('.egg-info'))
+self.assert_egg_info_directory_is_present_and_well()
 
 def test_modules(self):
 '''Python modules'''
@@ -157,7 +162,7 @@ Exec=/usr/bin/foo-gtk
 self.assertIn('\n  stuff/super.service\n', o)
 
 f = self.installed_files()
-self.assertEqual(len(f), 4) # 3 D-BUS files plus .egg-info
+self.assertEqual(len(f), 7) # 3 D-BUS files plus 4 files in egg-info directory
 self.assertIn('/etc/dbus-1/system.d/com.example.foo.conf', f)
 self.assertIn('/usr/share/dbus-1/system-services/com.example.foo.service', f)
 self.assertIn('/usr/share/dbus-1/services/com.example.foo.gui.service', f)
@@ -178,7 +183,7 @@ Exec=/usr/bin/foo-gtk
 self.assertEqual(s, 0)
 
 f = self.installed_files()
-self.assertEqual(len(f), 3) # 2 schema files plus .egg-info
+self.assertEqual(len(f), 6) # 2 schema files plus 4 files in .egg-info directory
 self.assertIn('/usr/share/glib-2.0/schemas/org.test.myapp.gschema.xml', f)
 self.assertNotIn('gschemas.compiled', '\n'.join(f))
 
@@ -201,7 +206,7 @@ def add_info(report):
 self.assertNotIn('following files are not recognized', o)
 
 f = self.installed_files()
-self.assertEqual(len(f), 3, f) # 2 hook files plus .egg-info
+self.assertEqual(len(f), 6, f) # 2 hook files plus 4 

Bug#1026568: python-distutils-extra: FTBFS: AssertionError: "diff -x foo.pot -x '*.pyc' -Nur /tmp/tmp[1578 chars]n+\n" != ''

2023-01-28 Thread Didier 'OdyX' Raboud
Control: tags -1 +confirmed +help

Hello there from the St-Cergue BSP where I've taken a look at this RC bug.

I can confirm this still FTBFS, and doesn't in stable, so let's check why.

The crux of the issue is that python3-setuptools from 54.0.0
(https://setuptools.pypa.io/en/latest/history.html#v54-0-0) does _not_ build 
the .egg-info as single file, but _only_ as directory [0].

This has the direct consequence that all tests fail for either of these 
reasons:
* the .egg-info is not a file, and cannot be compared with the expected 
version
* the .egg-info directory is not cleaned in clean() , hence the snapshot-vs-
result directory comparison is always going to flag the .egg-info directory as 
resulting cruft.

I've trimmed down the report below with an example result, which clearly shows 
the above two things.

Btw, from the FTBFS build directory, the fastest way to reproduce this is to 
run:

 LC_ALL=C LANGUAGE= LANG=C PYTHONPATH=. python3.10 test/auto.py -v -k empty -f


So. python-distutils-extra is broken by src:setuptools which is not going to 
revert this. python3-distutils-extra has 34 reverse Build-Depends, including 
python-apt, which makes it a "key package". Even if the B-D from python-apt 
can be amended, I also identify unattended-upgrades, software-properties and 
command-not-found. It looks like this won't be easy to remove from testing; we 
need to fix it.

Suggestions on the angle to use to tackle this welcome!

Best,

OdyX


[0] Also, distutils is deprecated "soon", so all this should get nuked post-
bookworm, but that's a discussion for another time.

Le mardi, 20 décembre 2022, 18.23:15 h CET Lucas Nussbaum a écrit :
> Source: python-distutils-extra
> Version: 2.47
> Severity: serious
> Justification: FTBFS
> Tags: bookworm sid ftbfs
> User: lu...@debian.org
> Usertags: ftbfs-20221220 ftbfs-bookworm
> 
> Hi,
> 
> During a rebuild of all packages in sid, your package failed to build
> on amd64.
> 
> Relevant part (hopefully):
> > make[1]: Entering directory '/<>'
> > # run tests with all supported python 2 and 3 versions
> > set -e; for python in `py3versions -s`; do \
> > 
> >   echo "-- Running tests with $python "; \
> >   LC_ALL=C LANGUAGE= LANG=C PYTHONPATH=. $python test/auto.py -v; \
> > 
> > done
> > -- Running tests with python3.11 
> > (...)
> > test_empty (__main__.T.test_empty)
> > empty source tree (just setup.py) ... FAIL
> > test_empty (__main__.T.test_empty)
> > empty source tree (just setup.py) ... FAIL

(...)

> > ==
> > FAIL: test_empty (__main__.T.test_empty)
> > empty source tree (just setup.py)
> > --
> > 
> > Traceback (most recent call last):
> >   File "/<>/test/auto.py", line 68, in test_empty
> >   
> > self.assertEqual(len(f), 1)
> > 
> > AssertionError: 4 != 1
> > 
> > ==
> > FAIL: test_empty (__main__.T.test_empty)
> > empty source tree (just setup.py)
> > --
> > 
> > Traceback (most recent call last):
> >   File "/<>/test/auto.py", line 43, in tearDown
> >   
> > self.assertEqual(cruft, '', 'no cruft after cleaning:\n' + cruft)
> > 
> > AssertionError: "diff -x foo.pot -x '*.pyc' -Nur /tmp/tmp[1578 chars]n+\n"
> > != '' - diff -x foo.pot -x '*.pyc' -Nur
> > /tmp/tmp56zs21t4/s/foo.egg-info/PKG-INFO
> > /tmp/tmp15hh51oe/foo.egg-info/PKG-INFO - ---
> > /tmp/tmp56zs21t4/s/foo.egg-info/PKG-INFO1970-01-01 
00:00:00.0
> > + - +++ /tmp/tmp15hh51oe/foo.egg-info/PKG-INFO  2022-12-20
> > 09:38:33.086490908 + - @@ -0,0 +1,8 @@
> > - +Metadata-Version: 2.1
> > - +Name: foo
> > - +Version: 0.1
> > - +Summary: Test suite package
> > - +Home-page: https://foo.example.com
> > - +Author: Martin Pitt
> > - +Author-email: martin.p...@example.com
> > - +License: GPL v2 or later
> > - diff -x foo.pot -x '*.pyc' -Nur
> > /tmp/tmp56zs21t4/s/foo.egg-info/SOURCES.txt
> > /tmp/tmp15hh51oe/foo.egg-info/SOURCES.txt - ---
> > /tmp/tmp56zs21t4/s/foo.egg-info/SOURCES.txt 1970-01-01 
00:00:00.0
> > + - +++ /tmp/tmp15hh51oe/foo.egg-info/SOURCES.txt   2022-12-20
> > 09:38:33.090490943 + - @@ -0,0 +1,5 @@
> > - +setup.py
> > - +foo.egg-info/PKG-INFO
> > - +foo.egg-info/SOURCES.txt
> > - +foo.egg-info/dependency_links.txt
> > - +foo.egg-info/top_level.txt
> > - \ No newline at end of file
> > - diff -x foo.pot -x '*.pyc' -Nur
> > /tmp/tmp56zs21t4/s/foo.egg-info/dependency_links.txt
> > /tmp/tmp15hh51oe/foo.egg-info/dependency_links.txt - ---
> > /tmp/tmp56zs21t4/s/foo.egg-info/dependency_links.txt1970-01-01
> > 00:00:00.0 + - +++
> > /tmp/tmp15hh51oe/foo.egg-info/dependency_links.txt  2022-12-20
> > 09:38:33.086490908 + - @@ -0,0 +1 @@
> > - +
> > - diff -x foo.pot -x '*.pyc' -Nur
> > 

Bug#1026568: python-distutils-extra: FTBFS: AssertionError: "diff -x foo.pot -x '*.pyc' -Nur /tmp/tmp[1578 chars]n+\n" != ''

2022-12-20 Thread Lucas Nussbaum
Source: python-distutils-extra
Version: 2.47
Severity: serious
Justification: FTBFS
Tags: bookworm sid ftbfs
User: lu...@debian.org
Usertags: ftbfs-20221220 ftbfs-bookworm

Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.


Relevant part (hopefully):
> make[1]: Entering directory '/<>'
> # run tests with all supported python 2 and 3 versions
> set -e; for python in `py3versions -s`; do \
>   echo "-- Running tests with $python "; \
>   LC_ALL=C LANGUAGE= LANG=C PYTHONPATH=. $python test/auto.py -v; \
> done
> -- Running tests with python3.11 
> test_apport_hook (__main__.T.test_apport_hook)
> Apport hooks ... FAIL
> test_apport_hook (__main__.T.test_apport_hook)
> Apport hooks ... FAIL
> test_binary_files (__main__.T.test_binary_files)
> Binary files are ignored ... FAIL
> test_binary_files (__main__.T.test_binary_files)
> Binary files are ignored ... FAIL
> test_data (__main__.T.test_data)
> Auxiliary files in data/ ... FAIL
> test_data (__main__.T.test_data)
> Auxiliary files in data/ ... FAIL
> test_dbus (__main__.T.test_dbus)
> D-BUS configuration and service files ... FAIL
> test_dbus (__main__.T.test_dbus)
> D-BUS configuration and service files ... FAIL
> test_desktop (__main__.T.test_desktop)
> *.desktop.in files ... FAIL
> test_desktop (__main__.T.test_desktop)
> *.desktop.in files ... FAIL
> test_empty (__main__.T.test_empty)
> empty source tree (just setup.py) ... FAIL
> test_empty (__main__.T.test_empty)
> empty source tree (just setup.py) ... FAIL
> test_etc (__main__.T.test_etc)
> etc/* ... FAIL
> test_etc (__main__.T.test_etc)
> etc/* ... FAIL
> test_gsettings (__main__.T.test_gsettings)
> GSettings schema files ... FAIL
> test_gsettings (__main__.T.test_gsettings)
> GSettings schema files ... FAIL
> test_help_docbook (__main__.T.test_help_docbook)
> Docbook XML help ... FAIL
> test_help_docbook (__main__.T.test_help_docbook)
> Docbook XML help ... FAIL
> test_help_mallard (__main__.T.test_help_mallard)
> Mallard XML help ... FAIL
> test_help_mallard (__main__.T.test_help_mallard)
> Mallard XML help ... FAIL
> test_icons (__main__.T.test_icons)
> data/icons/ ... FAIL
> test_icons (__main__.T.test_icons)
> data/icons/ ... FAIL
> test_manpages (__main__.T.test_manpages)
> manpages ... FAIL
> test_manpages (__main__.T.test_manpages)
> manpages ... FAIL
> test_modules (__main__.T.test_modules)
> Python modules ... FAIL
> test_packages (__main__.T.test_packages)
> Python packages ... FAIL
> test_po (__main__.T.test_po)
> gettext *.po files ... FAIL
> test_po (__main__.T.test_po)
> gettext *.po files ... FAIL
> test_policykit (__main__.T.test_policykit)
> *.policy.in PolicyKit files ... FAIL
> test_policykit (__main__.T.test_policykit)
> *.policy.in PolicyKit files ... FAIL
> test_pot_auto (__main__.T.test_pot_auto)
> PO template creation with automatic POTFILES.in ... ok
> test_pot_auto_explicit (__main__.T.test_pot_auto_explicit)
> PO template creation with automatic POTFILES.in and explicit scripts ... ok
> test_pot_manual (__main__.T.test_pot_manual)
> PO template creation with manual POTFILES.in ... ok
> test_requires_provides (__main__.T.test_requires_provides)
> automatic requires/provides ... :673: 
> ImportWarning: DynamicImporter.exec_module() not found; falling back to 
> load_module()
> FAIL
> test_requires_provides (__main__.T.test_requires_provides)
> automatic requires/provides ... FAIL
> test_scripts (__main__.T.test_scripts)
> scripts ... FAIL
> test_scripts (__main__.T.test_scripts)
> scripts ... FAIL
> test_sdist (__main__.T.test_sdist)
> default MANIFEST ... ok
> test_standard_files (__main__.T.test_standard_files)
> Standard files (MANIFEST.in, COPYING, etc.) ... FAIL
> test_standard_files (__main__.T.test_standard_files)
> Standard files (MANIFEST.in, COPYING, etc.) ... FAIL
> test_ui (__main__.T.test_ui)
> GtkBuilder/Qt *.ui ... FAIL
> test_ui (__main__.T.test_ui)
> GtkBuilder/Qt *.ui ... FAIL
> test_utf8_filenames (__main__.T.test_utf8_filenames)
> UTF-8 file names ... FAIL
> test_utf8_filenames (__main__.T.test_utf8_filenames)
> UTF-8 file names ... FAIL
> test_vcs (__main__.T.test_vcs)
> Ignores revision control files ... FAIL
> test_vcs (__main__.T.test_vcs)
> Ignores revision control files ... FAIL
> 
> ==
> FAIL: test_apport_hook (__main__.T.test_apport_hook)
> Apport hooks
> --
> Traceback (most recent call last):
>   File "/<>/test/auto.py", line 204, in test_apport_hook
> self.assertEqual(len(f), 3, f) # 2 hook files plus .egg-info
> ^^
> AssertionError: 6 != 3 : ['/usr/local/share/apport/package-hooks/foo.py', 
> '/usr/local/share/apport/package-hooks/source_foo.py', 
> '/usr/local/lib/python3.11/dist-packages/foo-0.1-py3.11.egg-info/dependency_links.txt',
>  
>