Hi Lee,

On 2021/04/19 11:06 PM, Debian Bug Tracking System wrote:
> #983140: ansible: Does not detect correct python interpreter on bullseye 
> target
> 
> It has been closed by Debian FTP Masters <ftpmas...@ftp-master.debian.org> 
> (reply to Lee Garrett <deb...@rocketjump.eu>).

Glad to hear this will be fixed by this new version.

I was also working on a patch for 2.9.16 but I guess it's a bit late of
that :)

I'll attach it anyway for reference because I managed to have all unit
tests working by avoiding the user home directory. You might be
interested to have a look at that.

Thanks again for maintaining ansible!

Best,

-- 
Baptiste Beauplat - lyknode
diff -Nru ansible-2.9.16+dfsg/debian/changelog 
ansible-2.9.16+dfsg/debian/changelog
--- ansible-2.9.16+dfsg/debian/changelog        2021-01-06 11:56:22.000000000 
+0100
+++ ansible-2.9.16+dfsg/debian/changelog        2021-04-17 15:27:02.000000000 
+0200
@@ -1,3 +1,11 @@
+ansible (2.9.16+dfsg-1.2) bullseye; urgency=medium
+
+  * Non-maintainer upload.
+  * Use python3.9 as default interpreter (Closes: #983140)
+  * Add autopkgtest to run a working subset of ansible test suite
+
+ -- Baptiste Beauplat <lykn...@debian.org>  Sat, 17 Apr 2021 15:27:02 +0200
+
 ansible (2.9.16+dfsg-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru 
ansible-2.9.16+dfsg/debian/patches/0007-fix-interpreter-fallback.patch 
ansible-2.9.16+dfsg/debian/patches/0007-fix-interpreter-fallback.patch
--- ansible-2.9.16+dfsg/debian/patches/0007-fix-interpreter-fallback.patch      
1970-01-01 01:00:00.000000000 +0100
+++ ansible-2.9.16+dfsg/debian/patches/0007-fix-interpreter-fallback.patch      
2021-04-17 15:27:02.000000000 +0200
@@ -0,0 +1,33 @@
+Description: Fix python interpreter discovery (Closes: #983140)
+ On machines upgrade from buster to bullseye, the wrong interpreter will be
+ discovered and used, causing the playbook run to fail. Update the fallback 
list
+ so it correctly picks python3.9 on bullseye when both 3.9 and 3.7 are present,
+ which usually is the case on freshly upgrade machines.
+Origin: backport, 
https://github.com/ansible/ansible/commit/c986cbb9961bfaedf1a6ae7f0c2e34be26d9ab12
+Forwarded: not-needed
+Applied-Upstream: 
https://github.com/ansible/ansible/commit/c986cbb9961bfaedf1a6ae7f0c2e34be26d9ab12
+Reviewed-by: Lee Garrett <deb...@rocketjump.eu>
+Last-Update: 2021-03-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/lib/ansible/config/base.yml
++++ b/lib/ansible/config/base.yml
+@@ -1523,6 +1523,8 @@
+   name: Ordered list of Python interpreters to check for in discovery
+   default:
+   - /usr/bin/python
++  - python3.9
++  - python3.8
+   - python3.7
+   - python3.6
+   - python3.5
+--- a/test/lib/ansible_test/_internal/util.py
++++ b/test/lib/ansible_test/_internal/util.py
+@@ -110,6 +110,7 @@
+     '3.6',
+     '3.7',
+     '3.8',
++    '3.9',
+ )
+
+
diff -Nru ansible-2.9.16+dfsg/debian/patches/0008-fix-tests.patch 
ansible-2.9.16+dfsg/debian/patches/0008-fix-tests.patch
--- ansible-2.9.16+dfsg/debian/patches/0008-fix-tests.patch     1970-01-01 
01:00:00.000000000 +0100
+++ ansible-2.9.16+dfsg/debian/patches/0008-fix-tests.patch     2021-04-17 
15:27:02.000000000 +0200
@@ -0,0 +1,44 @@
+From: Baptiste Beauplat <lykn...@debian.org>
+Date: Mon, 19 Apr 2021 20:41:09 +0200
+Subject: Fix test suite
+
+* Mark two tests depending on pycrypto with the correct skipif
+* Inject remote_tmp configuration to point to /tmp to handle testbed without
+  HOME
+* Truncate output check on test_build_requirement_from_path_no_version due to 
an
+  issue with text wrapping
+--- a/test/units/parsing/vault/test_vault.py
++++ b/test/units/parsing/vault/test_vault.py
+@@ -528,6 +528,7 @@
+         b_key_pycrypto = self.vault_cipher._create_key_pycrypto(b_password, 
b_salt, key_length=32, iv_length=16)
+         self.assertEqual(b_key_cryptography, b_key_pycrypto)
+ 
++    @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason='Not testing 
cryptography known key as pycrypto is not installed')
+     def test_create_key_known_cryptography(self):
+         b_password = b'hunter42'
+ 
+@@ -555,6 +556,7 @@
+         self.assertEqual(b_key_3, b_key_4)
+         self.assertEqual(b_key_1, b_key_4)
+ 
++    @pytest.mark.skipif(not vault.HAS_PYCRYPTO, reason='Not testing pycrypto 
known key as pycrypto is not installed')
+     def test_create_key_known_pycrypto(self):
+         b_password = b'hunter42'
+ 
+--- /dev/null
++++ b/test/lib/ansible_test/_data/ansible.cfg
+@@ -0,0 +1,2 @@
++[defaults]
++remote_tmp = /tmp/ansible
+--- a/test/units/galaxy/test_collection_install.py
++++ b/test/units/galaxy/test_collection_install.py
+@@ -242,8 +242,7 @@
+     assert mock_display.call_count == 1
+ 
+     actual_warn = ' '.join(mock_display.mock_calls[0][1][0].split('\n'))
+-    expected_warn = "Collection at '%s' does not have a valid version set, 
falling back to '*'. Found version: ''" \
+-        % to_text(collection_artifact[0])
++    expected_warn = "does not have a valid version set, falling back to '*'. 
Found version: ''"
+     assert expected_warn in actual_warn
+ 
+ 
diff -Nru ansible-2.9.16+dfsg/debian/patches/series 
ansible-2.9.16+dfsg/debian/patches/series
--- ansible-2.9.16+dfsg/debian/patches/series   2020-05-09 19:48:14.000000000 
+0200
+++ ansible-2.9.16+dfsg/debian/patches/series   2021-04-17 15:27:02.000000000 
+0200
@@ -1,3 +1,5 @@
 0003-preserve-debian-dir.patch
 0005-use-py3.patch
 0006-remove-sphinx-notfound.patch
+0007-fix-interpreter-fallback.patch
+0008-fix-tests.patch
diff -Nru ansible-2.9.16+dfsg/debian/rules ansible-2.9.16+dfsg/debian/rules
--- ansible-2.9.16+dfsg/debian/rules    2020-09-09 13:20:28.000000000 +0200
+++ ansible-2.9.16+dfsg/debian/rules    2021-04-17 15:27:02.000000000 +0200
@@ -28,6 +28,6 @@
        dh_python3 --shebang=/usr/bin/python3
 
 execute_after_dh_auto_install:
-       find lib/ -name '.git*' -delete
-       find lib/ -name '.travis.yml' -delete
+       find debian/*/usr/lib/ -name '.git*' -delete
+       find debian/*/usr/lib/ -name '.travis.yml' -delete
 
diff -Nru ansible-2.9.16+dfsg/debian/tests/control 
ansible-2.9.16+dfsg/debian/tests/control
--- ansible-2.9.16+dfsg/debian/tests/control    1970-01-01 01:00:00.000000000 
+0100
+++ ansible-2.9.16+dfsg/debian/tests/control    2021-04-17 15:27:02.000000000 
+0200
@@ -0,0 +1,19 @@
+Tests: upstream-tests
+# Dependencies sourced from:
+# - test/lib/ansible_test/_data/requirements/units.txt
+# - test/units/requirements.txt
+Depends: @,
+         python3-boto3,
+         python3-cryptography,
+         python3-jinja2,
+         python3-mock,
+         python3-passlib,
+         python3-pexpect,
+         python3-pycryptodome,
+         python3-pytest,
+         python3-pytest-mock,
+         python3-pytest-xdist,
+         python3-pyvmomi,
+         python3-tz,
+         python3-winrm,
+         python3-yaml
diff -Nru ansible-2.9.16+dfsg/debian/tests/upstream-tests 
ansible-2.9.16+dfsg/debian/tests/upstream-tests
--- ansible-2.9.16+dfsg/debian/tests/upstream-tests     1970-01-01 
01:00:00.000000000 +0100
+++ ansible-2.9.16+dfsg/debian/tests/upstream-tests     2021-04-17 
15:27:02.000000000 +0200
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+
+for VERSION in $(py3versions -r 2>/dev/null); do
+    LANG=C.UTF-8 HOME="$(mktemp -d)" \
+        PYTHON_VERSION="${VERSION/python/}" \
+    make tests
+done

Attachment: signature.asc
Description: PGP signature

Reply via email to