]> code.ossystems Code Review - openembedded-core.git/commitdiff
package_ipk.bbclass: make DESCRIPTION support newline
authorRobert Yang <liezhi.yang@windriver.com>
Wed, 19 Jun 2013 05:25:38 +0000 (01:25 -0400)
committerSaul Wold <sgw@linux.intel.com>
Tue, 9 Jul 2013 15:04:09 +0000 (08:04 -0700)
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>
meta/classes/package_ipk.bbclass

index 55628e4a51f2e9650ae605539ea1e7b91b629281..33058797e3708e4c0ea727ae8e3a17c5218fd08b 100644 (file)
@@ -304,10 +304,19 @@ python do_package_ipk () {
                 # Special behavior for description...
                 if 'DESCRIPTION' in fs:
                     summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
+                    ctrlfile.write('Description: %s\n' % summary)
                     description = localdata.getVar('DESCRIPTION', True) or "."
                     description = textwrap.dedent(description).strip()
-                    ctrlfile.write('Description: %s\n' % summary)
-                    ctrlfile.write('%s\n' % 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' % textwrap.fill(t.strip(), width=100000, initial_indent=' ', subsequent_indent=' '))
+                    else:
+                        # Auto indent
+                        ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))
                 else:
                     ctrlfile.write(c % tuple(pullData(fs, localdata)))
         except KeyError: