Package: whipper / 0.10.0-5

0007_ruaml_yaml.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From: Martin Weinelt <[email protected]>
Subject: Use custom YAML subclass to be compatible with ruamel_yaml>=0.17
Origin: upstream, https://github.com/whipper-team/whipper/commit/e0942417a1c267781a8b676789730457dcb2e6fa
Bug: https://github.com/whipper-team/whipper/issues/605
Bug-Debian: http://bugs.debian.org/1067620
Index: whipper/whipper/common/yaml.py
===================================================================
--- /dev/null
    whipper/whipper/common/yaml.py
@@ -0,0  1,18 @@
 from ruamel.yaml import YAML as ruamel_YAML
 from ruamel.yaml.compat import StringIO
 
 # https://yaml.readthedocs.io/en/latest/example.html#output-of-dump-as-a-string
 class YAML(ruamel_YAML):
     def __init__(self, *args, **kwargs):
         super().__init__()
         self.width = 4000
         self.default_flow_style = False
 
     def dump(self, data, stream=None, **kw):
         inefficient = False
         if stream is None:
             inefficient = True
             stream = StringIO()
         ruamel_YAML.dump(self, data, stream, **kw)
         if inefficient:
             return stream.getvalue()
Index: whipper/whipper/result/logger.py
===================================================================
--- whipper.orig/whipper/result/logger.py
    whipper/whipper/result/logger.py
@@ -1,12  1,12 @@
 import time
 import hashlib
 import re
-import ruamel.yaml as yaml
 from ruamel.yaml.comments import CommentedMap as OrderedDict
 
 import whipper
 
 from whipper.common import common
 from whipper.common.yaml import YAML
 from whipper.result import result
 
 
@@ -148,11  148,12 @@ class WhipperLogger(result.Logger):
         data["EOF"] = "End of status report"
         riplog["Conclusive status report"] = data
 
         yaml = YAML(
             typ="rt",
             pure=True
         )
         riplog = yaml.dump(
-            riplog,
-            default_flow_style=False,
-            width=4000,
-            Dumper=yaml.RoundTripDumper
             riplog
         )
         # Add a newline after the "Log creation date" line
         riplog = re.sub(
Index: whipper/whipper/test/test_result_logger.py
===================================================================
--- whipper.orig/whipper/test/test_result_logger.py
    whipper/whipper/test/test_result_logger.py
@@ -3,8  3,8 @@ import hashlib
 import os
 import re
 import unittest
-import ruamel.yaml
 
 from whipper.common.yaml import YAML
 from whipper.result.result import TrackResult, RipResult
 from whipper.result.logger import WhipperLogger
 
@@ -162,16  162,14 @@ class LoggerTestCase(unittest.TestCase):
             ))
         )
 
-        yaml = ruamel.yaml.YAML()
         yaml = YAML(
             typ='rt',
             pure=True
         )
         parsedLog = yaml.load(actual)
         self.assertEqual(
             actual,
-            ruamel.yaml.dump(
-                parsedLog,
-                default_flow_style=False,
-                width=4000,
-                Dumper=ruamel.yaml.RoundTripDumper
-            )
             yaml.dump(parsedLog)
         )
         log_body = "\n".join(actualLines[:-1]).encode()
         self.assertEqual(