summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-09-29 10:11:24 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-11 22:13:14 +0100
commitb2f2590e6c566d1ed4df87cf52279106497d584d (patch)
tree3e0b27e130a0f878f87b8843e9486411925e5a96 /meta
parent5783e717ee9f503d8e03992306a6b9ddfda6f73e (diff)
downloadpoky-b2f2590e6c566d1ed4df87cf52279106497d584d.tar.gz
Add Summary/Description support to packaging
[BUGID #281] Add the ability for the deb, ipk and rpm classes to use the new summary and description fields. The Description is wrapped around 75 characters to ensure a reasonably nice, presentable description. (Summary defaults to the description if Summary is not defined.) Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package_deb.bbclass14
-rw-r--r--meta/classes/package_ipk.bbclass11
-rw-r--r--meta/classes/package_rpm.bbclass16
3 files changed, 33 insertions, 8 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index eb4df5e704..8a9cdc071d 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -69,6 +69,7 @@ python do_package_deb_install () {
69 69
70python do_package_deb () { 70python do_package_deb () {
71 import re, copy 71 import re, copy
72 import textwrap
72 73
73 workdir = bb.data.getVar('WORKDIR', d, True) 74 workdir = bb.data.getVar('WORKDIR', d, True)
74 if not workdir: 75 if not workdir:
@@ -179,7 +180,18 @@ python do_package_deb () {
179 # check for required fields 180 # check for required fields
180 try: 181 try:
181 for (c, fs) in fields: 182 for (c, fs) in fields:
182 ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)))) 183 for f in fs:
184 if bb.data.getVar(f, localdata) is None:
185 raise KeyError(f)
186 # Special behavior for description...
187 if 'DESCRIPTION' in fs:
188 summary = bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or "."
189 description = bb.data.getVar('DESCRIPTION', localdata, True) or "."
190 description = textwrap.dedent(description).strip()
191 ctrlfile.write('Description: %s\n' % unicode(summary))
192 ctrlfile.write('%s\n' % unicode(textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' ')))
193 else:
194 ctrlfile.write(unicode(c % tuple(pullData(fs, localdata))))
183 except KeyError: 195 except KeyError:
184 import sys 196 import sys
185 (type, value, traceback) = sys.exc_info() 197 (type, value, traceback) = sys.exc_info()
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index 1758283f61..cac0453685 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -135,6 +135,7 @@ package_generate_archlist () {
135 135
136python do_package_ipk () { 136python do_package_ipk () {
137 import re, copy 137 import re, copy
138 import textwrap
138 139
139 workdir = bb.data.getVar('WORKDIR', d, True) 140 workdir = bb.data.getVar('WORKDIR', d, True)
140 outdir = bb.data.getVar('PKGWRITEDIRIPK', d, True) 141 outdir = bb.data.getVar('PKGWRITEDIRIPK', d, True)
@@ -227,7 +228,15 @@ python do_package_ipk () {
227 for f in fs: 228 for f in fs:
228 if bb.data.getVar(f, localdata) is None: 229 if bb.data.getVar(f, localdata) is None:
229 raise KeyError(f) 230 raise KeyError(f)
230 ctrlfile.write(c % tuple(pullData(fs, localdata))) 231 # Special behavior for description...
232 if 'DESCRIPTION' in fs:
233 summary = bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or "."
234 description = bb.data.getVar('DESCRIPTION', localdata, True) or "."
235 description = textwrap.dedent(description).strip()
236 ctrlfile.write('Description: %s\n' % summary)
237 ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))
238 else:
239 ctrlfile.write(c % tuple(pullData(fs, localdata)))
231 except KeyError: 240 except KeyError:
232 import sys 241 import sys
233 (type, value, traceback) = sys.exc_info() 242 (type, value, traceback) = sys.exc_info()
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 49468bbd5a..b31830f945 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -72,6 +72,8 @@ package_generate_rpm_conf () {
72} 72}
73 73
74python write_specfile () { 74python write_specfile () {
75 import textwrap
76
75 # We need to change '-' in a version field to '+' 77 # We need to change '-' in a version field to '+'
76 # This needs to be done BEFORE the mapping_rename_hook 78 # This needs to be done BEFORE the mapping_rename_hook
77 def translate_vers(varname, d): 79 def translate_vers(varname, d):
@@ -136,7 +138,7 @@ python write_specfile () {
136 138
137 # Construct the SPEC file... 139 # Construct the SPEC file...
138 srcname = bb.data.getVar('PN', d, True) 140 srcname = bb.data.getVar('PN', d, True)
139 srcsummary = (bb.data.getVar('SUMMARY', d, True) or ".") 141 srcsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".")
140 srcversion = bb.data.getVar('PV', d, True).replace('-', '+') 142 srcversion = bb.data.getVar('PV', d, True).replace('-', '+')
141 srcrelease = bb.data.getVar('PR', d, True) 143 srcrelease = bb.data.getVar('PR', d, True)
142 srcepoch = (bb.data.getVar('PE', d, True) or "") 144 srcepoch = (bb.data.getVar('PE', d, True) or "")
@@ -144,7 +146,7 @@ python write_specfile () {
144 srcsection = bb.data.getVar('SECTION', d, True) 146 srcsection = bb.data.getVar('SECTION', d, True)
145 srcmaintainer = bb.data.getVar('MAINTAINER', d, True) 147 srcmaintainer = bb.data.getVar('MAINTAINER', d, True)
146 srchomepage = bb.data.getVar('HOMEPAGE', d, True) 148 srchomepage = bb.data.getVar('HOMEPAGE', d, True)
147 srcdescription = bb.data.getVar('DESCRIPTION', d, True) 149 srcdescription = bb.data.getVar('DESCRIPTION', d, True) or "."
148 150
149 srcdepends = bb.data.getVar('DEPENDS', d, True) 151 srcdepends = bb.data.getVar('DEPENDS', d, True)
150 srcrdepends = [] 152 srcrdepends = []
@@ -191,13 +193,13 @@ python write_specfile () {
191 193
192 splitname = pkgname 194 splitname = pkgname
193 195
194 splitsummary = (bb.data.getVar('SUMMARY', d, True) or ".") 196 splitsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".")
195 splitversion = (bb.data.getVar('PV', localdata, True) or "").replace('-', '+') 197 splitversion = (bb.data.getVar('PV', localdata, True) or "").replace('-', '+')
196 splitrelease = (bb.data.getVar('PR', localdata, True) or "") 198 splitrelease = (bb.data.getVar('PR', localdata, True) or "")
197 splitepoch = (bb.data.getVar('PE', localdata, True) or "") 199 splitepoch = (bb.data.getVar('PE', localdata, True) or "")
198 splitlicense = (bb.data.getVar('LICENSE', localdata, True) or "") 200 splitlicense = (bb.data.getVar('LICENSE', localdata, True) or "")
199 splitsection = (bb.data.getVar('SECTION', localdata, True) or "") 201 splitsection = (bb.data.getVar('SECTION', localdata, True) or "")
200 splitdescription = (bb.data.getVar('DESCRIPTION', localdata, True) or "") 202 splitdescription = (bb.data.getVar('DESCRIPTION', localdata, True) or ".")
201 203
202 translate_vers('RDEPENDS', localdata) 204 translate_vers('RDEPENDS', localdata)
203 translate_vers('RRECOMMENDS', localdata) 205 translate_vers('RRECOMMENDS', localdata)
@@ -295,7 +297,8 @@ python write_specfile () {
295 spec_preamble_bottom.append('') 297 spec_preamble_bottom.append('')
296 298
297 spec_preamble_bottom.append('%%description -n %s' % splitname) 299 spec_preamble_bottom.append('%%description -n %s' % splitname)
298 spec_preamble_bottom.append('%s' % splitdescription) 300 dedent_text = textwrap.dedent(splitdescription).strip()
301 spec_preamble_bottom.append('%s' % textwrap.fill(dedent_text, width=75))
299 302
300 spec_preamble_bottom.append('') 303 spec_preamble_bottom.append('')
301 304
@@ -379,7 +382,8 @@ python write_specfile () {
379 spec_preamble_top.append('') 382 spec_preamble_top.append('')
380 383
381 spec_preamble_top.append('%description') 384 spec_preamble_top.append('%description')
382 spec_preamble_top.append('%s' % srcdescription) 385 dedent_text = textwrap.dedent(srcdescription).strip()
386 spec_preamble_top.append('%s' % textwrap.fill(dedent_text, width=75))
383 387
384 spec_preamble_top.append('') 388 spec_preamble_top.append('')
385 389