diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2013-06-19 01:25:38 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-07-10 09:42:02 +0100 |
commit | 477b2c9860c6076197cccf02650d6e0fee829290 (patch) | |
tree | 5d2fc5d952935d1b3e6bdc291813627f2c8ca09e | |
parent | 29e81064c09b4caf367f8e7a71be1c8f28b5c731 (diff) | |
download | poky-477b2c9860c6076197cccf02650d6e0fee829290.tar.gz |
package_rpm.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]
(From OE-Core rev: 503b6370080fcbcd99305eac846c6dfbdd07c5df)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package_rpm.bbclass | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index c654cdb5e8..fa928ce042 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
@@ -534,7 +534,6 @@ def write_rpm_perfiledata(srcname, d): | |||
534 | 534 | ||
535 | 535 | ||
536 | python write_specfile () { | 536 | python write_specfile () { |
537 | import textwrap | ||
538 | import oe.packagedata | 537 | import oe.packagedata |
539 | 538 | ||
540 | # append information for logs and patches to %prep | 539 | # append information for logs and patches to %prep |
@@ -668,6 +667,19 @@ python write_specfile () { | |||
668 | deps.append(depends) | 667 | deps.append(depends) |
669 | return " ".join(deps) | 668 | return " ".join(deps) |
670 | 669 | ||
670 | def append_description(spec_preamble, text): | ||
671 | """ | ||
672 | Add the description to the spec file. | ||
673 | """ | ||
674 | import textwrap | ||
675 | dedent_text = textwrap.dedent(text).strip() | ||
676 | # Bitbake saves "\n" as "\\n" | ||
677 | if '\\n' in dedent_text: | ||
678 | for t in dedent_text.split('\\n'): | ||
679 | spec_preamble.append(t.strip()) | ||
680 | else: | ||
681 | spec_preamble.append('%s' % textwrap.fill(dedent_text, width=75)) | ||
682 | |||
671 | packages = d.getVar('PACKAGES', True) | 683 | packages = d.getVar('PACKAGES', True) |
672 | if not packages or packages == '': | 684 | if not packages or packages == '': |
673 | bb.debug(1, "No packages; nothing to do") | 685 | bb.debug(1, "No packages; nothing to do") |
@@ -868,8 +880,7 @@ python write_specfile () { | |||
868 | spec_preamble_bottom.append('') | 880 | spec_preamble_bottom.append('') |
869 | 881 | ||
870 | spec_preamble_bottom.append('%%description -n %s' % splitname) | 882 | spec_preamble_bottom.append('%%description -n %s' % splitname) |
871 | dedent_text = textwrap.dedent(splitdescription).strip() | 883 | append_description(spec_preamble_bottom, splitdescription) |
872 | spec_preamble_bottom.append('%s' % textwrap.fill(dedent_text, width=75)) | ||
873 | 884 | ||
874 | spec_preamble_bottom.append('') | 885 | spec_preamble_bottom.append('') |
875 | 886 | ||
@@ -975,8 +986,7 @@ python write_specfile () { | |||
975 | spec_preamble_top.append('') | 986 | spec_preamble_top.append('') |
976 | 987 | ||
977 | spec_preamble_top.append('%description') | 988 | spec_preamble_top.append('%description') |
978 | dedent_text = textwrap.dedent(srcdescription).strip() | 989 | append_description(spec_preamble_top, srcdescription) |
979 | spec_preamble_top.append('%s' % textwrap.fill(dedent_text, width=75)) | ||
980 | 990 | ||
981 | spec_preamble_top.append('') | 991 | spec_preamble_top.append('') |
982 | 992 | ||