diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2013-06-19 01:25:38 -0400 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2013-07-09 08:04:09 -0700 |
commit | 568e303ef4447a9ddb7fb6370166d012a4375dab (patch) | |
tree | 9f2d2edd60a8071baf7ed805ea6495800454f9b3 | |
parent | dff04de2de8bb159fd6912e29794eadd75d5d92a (diff) | |
download | openembedded-core-568e303ef4447a9ddb7fb6370166d012a4375dab.tar.gz openembedded-core-568e303ef4447a9ddb7fb6370166d012a4375dab.tar.bz2 openembedded-core-568e303ef4447a9ddb7fb6370166d012a4375dab.zip |
package_deb.bbclass: make DESCRIPTION support newline
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>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
-rw-r--r-- | meta/classes/package_deb.bbclass | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 949432e32d..663f6461c8 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass @@ -279,10 +279,20 @@ 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=' '))) + if '\\n' in description: + # Manually indent + for t in description.split('\\n'): + # We don't limit the width when manually indent, but we do + # need the textwrap.fill() to set the initial_indent and + # subsequent_indent, so set a large width + ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '))) + else: + # Auto indent + ctrlfile.write('%s\n' % unicode(textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))) + else: ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)))) except KeyError: |