Patchwork [3/3] package_deb.bbclass: make DESCRIPTION support newline

login
register
mail settings
Submitter Robert Yang
Date June 19, 2013, 9 a.m.
Message ID <05537d671f3bf2aacf400d50d4bdfb5f251446f5.1371621343.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/51981/
State New
Headers show

Comments

Robert Yang - June 19, 2013, 9 a.m.
The recipe's DESCRIPTION is wrapped automatically by textwrap, make it
support newline ("\n") to let the user can wrap it manually, e.g.:

DESCRIPTION = "Foo1\nFoo2"

In the past, it would be:
Foo1\nFoo2

Now:
Foo1
Foo2

[YOCTO #4348]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/package_deb.bbclass |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 949432e..74b7d25 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -279,10 +279,11 @@  python do_package_deb () {
                 # Special behavior for description...
                 if 'DESCRIPTION' in fs:
                      summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
+                     ctrlfile.write('Description: %s\n' % unicode(summary))
                      description = localdata.getVar('DESCRIPTION', True) or "."
                      description = textwrap.dedent(description).strip()
-                     ctrlfile.write('Description: %s\n' % unicode(summary))
-                     ctrlfile.write('%s\n' % unicode(textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' ')))
+                     for t in description.split('\\n'):
+                         ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=74, initial_indent=' ', subsequent_indent=' ')))
                 else:
                      ctrlfile.write(unicode(c % tuple(pullData(fs, localdata))))
         except KeyError: