Merge ~paelzer/ubuntu/+source/crmsh:fix-python3.8-focal into ubuntu/+source/crmsh:ubuntu/focal-devel

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Andreas Hasenack
Approved revision: 8d067f609aff561de4dcd1a8507bdaf175cc5bd5
Merge reported by: Christian Ehrhardt 
Merged at revision: 8d067f609aff561de4dcd1a8507bdaf175cc5bd5
Proposed branch: ~paelzer/ubuntu/+source/crmsh:fix-python3.8-focal
Merge into: ubuntu/+source/crmsh:ubuntu/focal-devel
Diff against target: 112 lines (+78/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/scripts-python3.8-unittest-compatibility.patch (+68/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+378235@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I'll update with test results once ready.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Tests results seem ok
https://bileto.ubuntu.com/excuses/3903/focal.html

Using python3.8 and having the testsuite pass.

i386 always fails on bileto but isn't a real issue.

But I'm still slightly concernd as a local run was broken on
-------------------- >> begin captured stdout << ---------------------
ERROR: parse_time 2017-01-26T11:04:19.562885+08:00 12sp2-4 kernel:: ('Unknown string format:', '2017-01-26T11:04:19.562885+08:00 12sp2-4 kernel:')
INFO: autopkgtest# the log file is in the rfc5424 format

I'd appreciate if a reviewer could double check that.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I tested --apt-pocket=proposed=src:python3-defaults vs another run without locally.
They both fail the same way.

But since on the autopkgtest-infra all is fine I think we can go on with this.
I'd appreciate a review to one-by-one reduce the py3-explosion in proposed-migration :-)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

FWIW, I didn't see the parse_time error in my local dep8 run with your built packages and proposed enabled.

I noticed regression tests have their result ignored, a change introduced in 4.0.0~git20190108.3d56538-3 by debian:

./regression.sh -m buildbot || true

And indeed there are some failures. But let's leave it at that for now.

+1 on this branch.

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Yeah, our issue was on
  nosetests3 -w ./unittests -v 2>&1
which isn't || true

Thanks for the checks!

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/crmsh
 * [new tag] upload/4.2.0-2ubuntu1 -> upload/4.2.0-2ubuntu1

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading crmsh_4.2.0-2ubuntu1.dsc: done.
  Uploading crmsh_4.2.0-2ubuntu1.debian.tar.xz: done.
  Uploading crmsh_4.2.0-2ubuntu1_source.buildinfo: done.
  Uploading crmsh_4.2.0-2ubuntu1_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 33aeff2..ddbe74b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+crmsh (4.2.0-2ubuntu1) focal; urgency=medium
7+
8+ * d/p/scripts-python3.8-unittest-compatibility.patch: fix tests
9+ with python3.8 (LP: #1861270)
10+
11+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 29 Jan 2020 11:36:26 +0100
12+
13 crmsh (4.2.0-2) unstable; urgency=medium
14
15 * d/patches: fix tests failing in 2020
16diff --git a/debian/control b/debian/control
17index b415a15..8ae1bca 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,7 +1,8 @@
21 Source: crmsh
22 Section: admin
23 Priority: optional
24-Maintainer: Debian HA Maintainers <debian-ha-maintainers@lists.alioth.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Debian HA Maintainers <debian-ha-maintainers@lists.alioth.debian.org>
27 Uploaders:
28 Richard B Winters <rik@mmogp.com>,
29 Adrian Vondendriesch <adrian.vondendriesch@credativ.de>,
30diff --git a/debian/patches/scripts-python3.8-unittest-compatibility.patch b/debian/patches/scripts-python3.8-unittest-compatibility.patch
31new file mode 100644
32index 0000000..010ee2a
33--- /dev/null
34+++ b/debian/patches/scripts-python3.8-unittest-compatibility.patch
35@@ -0,0 +1,68 @@
36+From c6b15764786b3a28502070a35fd0f433d2aa3cbc Mon Sep 17 00:00:00 2001
37+From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
38+Date: Tue, 28 Jan 2020 13:23:59 +0200
39+Subject: [PATCH] scripts: python3.8 unittest compatibility
40+
41+When the unitetss are run with python 3.8 they break on changes in ast.
42+ File "/usr/lib/python3/dist-packages/crmsh/minieval.py", line 222, in _eval
43+ handler = self.nodes[type(node)]
44+ KeyError: <class '_ast.Constant'>
45+
46+This is due to [1] which states "Class ast.Constant is now used for all
47+constants. Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and
48+ast.Ellipsis are still available, but they will be removed in future
49+Python releases.".
50+Even thou this is just the deprecation it already triggers an error
51+in the tests of crmsh.
52+
53+[1]: https://docs.python.org/3/library/ast.html#ast.AST
54+
55+Fixes #518
56+
57+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
58+
59+Origin: upstream, https://github.com/ClusterLabs/crmsh/commit/c6b15764786b3a28502070a35fd0f433d2aa3cbc
60+Last-Update: 2020-01-29
61+
62+---
63+ crmsh/minieval.py | 14 ++++++++++++--
64+ 1 file changed, 12 insertions(+), 2 deletions(-)
65+
66+diff --git a/crmsh/minieval.py b/crmsh/minieval.py
67+index 4403d092..06e780c2 100644
68+--- a/crmsh/minieval.py
69++++ b/crmsh/minieval.py
70+@@ -200,10 +200,14 @@ class SimpleEval(object): # pylint: disable=too-few-public-methods
71+
72+ # py3k stuff:
73+ if hasattr(ast, 'NameConstant'):
74+- self.nodes[ast.NameConstant] = self._eval_nameconstant
75++ self.nodes[ast.NameConstant] = self._eval_constant
76+ elif isinstance(self.names, dict) and "None" not in self.names:
77+ self.names["None"] = None
78+
79++ # py3.8 uses ast.Constant instead of ast.Num, ast.Str, ast.NameConstant
80++ if hasattr(ast, 'Constant'):
81++ self.nodes[ast.Constant] = self._eval_constant
82++
83+ def evaluate(self, expr):
84+ """ evaluate an expresssion, using the operators, functions and
85+ names previously set up. """
86+@@ -239,7 +243,13 @@ class SimpleEval(object): # pylint: disable=too-few-public-methods
87+ return node.s
88+
89+ @staticmethod
90+- def _eval_nameconstant(node):
91++ def _eval_constant(node):
92++ if (hasattr(node.value, '__len__') and
93++ len(node.value) > MAX_STRING_LENGTH):
94++ raise IterableTooLong("Literal in statement is too long!"
95++ " ({0}, when {1} is max)"
96++ "".format(len(node.value),
97++ MAX_STRING_LENGTH))
98+ return node.value
99+
100+ def _eval_unaryop(self, node):
101+--
102+2.25.0
103+
104diff --git a/debian/patches/series b/debian/patches/series
105index 678549f..d25fab3 100644
106--- a/debian/patches/series
107+++ b/debian/patches/series
108@@ -10,3 +10,4 @@
109 0014-Fix-cluster-stop-start.patch
110 0015-Fix-testsuite-errors.patch
111 0016-Fix-python2-calls.patch
112+scripts-python3.8-unittest-compatibility.patch

Subscribers

People subscribed via source and target branches