summaryrefslogtreecommitdiffstats
path: root/patches/opkg-utils-r4747/0023-opkg.py-improve-test-so-it-prints-temporary-control-.patch
blob: 7bce3973c8f3adb97a3c4ec11235860624b71850 (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
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Thu, 29 Mar 2012 23:36:56 +0200
Subject: [PATCH] opkg.py: improve test so it prints temporary control file
 with long description and then reads it back

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 opkg.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/opkg.py b/opkg.py
index 2294160..27cbc2a 100644
--- a/opkg.py
+++ b/opkg.py
@@ -509,11 +509,21 @@ if __name__ == "__main__":
     package.set_architecture("arm")
     package.set_maintainer("Testing <testing@testing.testing>")
     package.set_depends("libc")
-    package.set_description("A test of the APIs.")
+    package.set_description("A test of the APIs. And very long descriptions so often used in oe-core\nfoo\n\n\nbar")
 
     print("<")
     sys.stdout.write(str(package))
     print(">")
+    f = open("/tmp/control", "w")
+    f.write(str(package))
+    f.close()
+
+    f = open("/tmp/control", "r")
+    package2 = Package()
+    package2.read_control(f)
+    print("<")
+    sys.stdout.write(str(package2))
+    print(">")
 
     package.write_package("/tmp")