aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba-4.1.12/0001-waf-sanitize-and-fix-added-cross-answer.patch
blob: 69668c088a01a305b725903c2b5593c07e068c4f (plain)
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
From 1b32c7d7f148bcf2598799b21dfa3ba1ed824d32 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <urisimchoni@gmail.com>
Date: Mon, 18 May 2015 21:12:06 +0300
Subject: [PATCH 1/7] waf: sanitize and fix added cross answer

When configuring samba for cross-compilation using the cross-answers
method, the function add_answer receives the standard output and exit code
of a configuration test and updates the cross-answers file accordingly.

This patch sanitizes the standard output to conform to the cross-answers
file format - one line of output. It also adds a missing newline.

(Note - at this point add_answer is only ever called with empty output
but this change is significant for the reminder of this patchset)

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Upstream-Status: Backport

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
 buildtools/wafsamba/samba_cross.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
index 3838e34..fc1d78e 100644
--- a/buildtools/wafsamba/samba_cross.py
+++ b/buildtools/wafsamba/samba_cross.py
@@ -19,6 +19,16 @@ def add_answer(ca_file, msg, answer):
     except:
         Logs.error("Unable to open cross-answers file %s" % ca_file)
         sys.exit(1)
+    (retcode, retstring) = answer
+    # if retstring is more than one line then we probably
+    # don't care about its actual content (the tests should
+    # yield one-line output in order to comply with the cross-answer
+    # format)
+    retstring = retstring.strip()
+    if len(retstring.split('\n')) > 1:
+        retstring = ''
+    answer = (retcode, retstring)
+
     if answer == ANSWER_OK:
         f.write('%s: OK\n' % msg)
     elif answer == ANSWER_UNKNOWN:
@@ -26,8 +36,7 @@ def add_answer(ca_file, msg, answer):
     elif answer == ANSWER_FAIL:
         f.write('%s: FAIL\n' % msg)
     else:
-        (retcode, retstring) = answer
-        f.write('%s: (%d, "%s")' % (msg, retcode, retstring))
+        f.write('%s: (%d, "%s")\n' % (msg, retcode, retstring))
     f.close()
 
 
-- 
1.9.1