summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-08-31 20:05:10 -0500
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-02 10:01:22 +0100
commit4b611b66743a5ec220aef34d796af63029bb5fd9 (patch)
tree8421704dc7366b6e76bf1b1eee6c2172b1a953f8
parent379ba0e9d73a96f72982070a71532e035878fee0 (diff)
downloadpoky-4b611b66743a5ec220aef34d796af63029bb5fd9.tar.gz
package_rpm: Enable debian style tags
Enable debian style tags including suggests, enhances, recommends Note, these are not yet used by the dependency resolver. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--meta/classes/package_rpm.bbclass107
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.1.10.bb3
2 files changed, 60 insertions, 50 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 89e8fe891a..3f0a8af72c 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -92,11 +92,18 @@ python write_specfile () {
92 92
93 # We need to change the style the dependency from BB to RPM 93 # We need to change the style the dependency from BB to RPM
94 # This needs to happen AFTER the mapping_rename_hook 94 # This needs to happen AFTER the mapping_rename_hook
95 def translate_deps(varname, d): 95 def print_deps(variable, tag, array, d):
96 depends = bb.data.getVar('RPM' + varname, d, True) or bb.data.getVar(varname, d, True) or "" 96 depends = variable
97 depends = depends.replace('(', '') 97 if depends:
98 depends = depends.replace(')', '') 98 depends_dict = bb.utils.explode_dep_versions(depends)
99 bb.data.setVar('RPM' + varname, depends, d) 99 for dep in depends_dict:
100 ver = depends_dict[dep]
101 if dep and ver:
102 ver = ver.replace('(', '')
103 ver = ver.replace(')', '')
104 array.append("%s: %s %s" % (tag, dep, ver))
105 else:
106 array.append("%s: %s" % (tag, dep))
100 107
101 def walk_files(walkpath, target, conffiles): 108 def walk_files(walkpath, target, conffiles):
102 import os 109 import os
@@ -137,8 +144,7 @@ python write_specfile () {
137 srchomepage = bb.data.getVar('HOMEPAGE', d, True) 144 srchomepage = bb.data.getVar('HOMEPAGE', d, True)
138 srcdescription = bb.data.getVar('DESCRIPTION', d, True) 145 srcdescription = bb.data.getVar('DESCRIPTION', d, True)
139 146
140 translate_deps('DEPENDS', d) 147 srcdepends = bb.data.getVar('DEPENDS', d, True)
141 srcdepends = bb.data.getVar('RPMDEPENDS', d, True)
142 srcrdepends = [] 148 srcrdepends = []
143 srcrrecommends = [] 149 srcrrecommends = []
144 srcrsuggests = [] 150 srcrsuggests = []
@@ -201,19 +207,12 @@ python write_specfile () {
201 # Map the dependencies into their final form 207 # Map the dependencies into their final form
202 bb.build.exec_func("mapping_rename_hook", localdata) 208 bb.build.exec_func("mapping_rename_hook", localdata)
203 209
204 translate_deps('RDEPENDS', localdata) 210 splitrdepends = bb.data.getVar('RDEPENDS', localdata, True) or ""
205 translate_deps('RRECOMMENDS', localdata) 211 splitrrecommends = bb.data.getVar('RRECOMMENDS', localdata, True) or ""
206 translate_deps('RSUGGESTS', localdata) 212 splitrsuggests = bb.data.getVar('RSUGGESTS', localdata, True) or ""
207 translate_deps('RPROVIDES', localdata) 213 splitrprovides = bb.data.getVar('RPROVIDES', localdata, True) or ""
208 translate_deps('RREPLACES', localdata) 214 splitrreplaces = bb.data.getVar('RREPLACES', localdata, True) or ""
209 translate_deps('RCONFLICTS', localdata) 215 splitrconflicts = bb.data.getVar('RCONFLICTS', localdata, True) or ""
210
211 splitrdepends = bb.data.getVar('RPMRDEPENDS', localdata, True)
212 splitrrecommends = bb.data.getVar('RPMRRECOMMENDS', localdata, True)
213 splitrsuggests = bb.data.getVar('RPMRSUGGESTS', localdata, True)
214 splitrprovides = bb.data.getVar('RPMRPROVIDES', localdata, True)
215 splitrreplaces = bb.data.getVar('RPMRREPLACES', localdata, True)
216 splitrconflicts = bb.data.getVar('RPMRCONFLICTS', localdata, True)
217 splitrobsoletes = [] 216 splitrobsoletes = []
218 217
219 # Gather special src/first package data 218 # Gather special src/first package data
@@ -269,21 +268,25 @@ python write_specfile () {
269 else: 268 else:
270 splitrobsoletes = dep 269 splitrobsoletes = dep
271 270
272 if splitrdepends and splitrdepends.strip() != "": 271 print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
273 spec_preamble_bottom.append('Requires: %s' % splitrdepends) 272 print_deps(splitrrecommends, "Recommends", spec_preamble_bottom, d)
274 #if splitrrecommends and splitrrecommends.strip() != "": 273 print_deps(splitrsuggests, "Suggests", spec_preamble_bottom, d)
275 # spec_preamble_bottom.append('#Recommends: %s' % splitrrecommends) 274 print_deps(splitrprovides, "Provides", spec_preamble_bottom, d)
276 #if splitrsuggests and splitrsuggests.strip() != "": 275 print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
277 # spec_preamble_bottom.append('#Suggests: %s' % splitrsuggests) 276
278 if splitrprovides and splitrprovides.strip() != "": 277 # conflicts can not be in a provide! We will need to filter it.
279 spec_preamble_bottom.append('Provides: %s' % splitrprovides) 278 if splitrconflicts:
280 if splitrobsoletes and splitrobsoletes.strip() != "": 279 depends_dict = bb.utils.explode_dep_versions(splitrconflicts)
281 spec_preamble_bottom.append('Obsoletes: %s' % splitrobsoletes) 280 newdeps_dict = {}
282 if splitrconflicts and splitrconflicts.strip() != "": 281 for dep in depends_dict:
283 for dep in splitrconflicts.split(','):
284 # A conflict can NOT be in the provide or an internal conflict happens!
285 if dep not in splitrprovides: 282 if dep not in splitrprovides:
286 spec_preamble_bottom.append('Conflicts: %s' % dep) 283 newdeps_dict[dep] = depends_dict[dep]
284 if newdeps_dict:
285 splitrconflicts = bb.utils.join_deps(newdeps_dict)
286 else:
287 splitrconflicts = ""
288
289 print_deps(splitrconflicts, "Conflicts", spec_preamble_bottom, d)
287 290
288 spec_preamble_bottom.append('') 291 spec_preamble_bottom.append('')
289 292
@@ -345,23 +348,27 @@ python write_specfile () {
345 srcrobsoletes = srcrobsoletes + ", " + dep 348 srcrobsoletes = srcrobsoletes + ", " + dep
346 else: 349 else:
347 srcrobsoletes = dep 350 srcrobsoletes = dep
348 if srcdepends and srcdepends.strip() != "": 351
349 spec_preamble_top.append('BuildRequires: %s' % srcdepends) 352 print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
350 if srcrdepends and srcrdepends.strip() != "": 353 print_deps(srcrdepends, "Requires", spec_preamble_top, d)
351 spec_preamble_top.append('Requires: %s' % srcrdepends) 354 print_deps(srcrrecommends, "Recommends", spec_preamble_top, d)
352 #if srcrrecommends and srcrrecommends.strip() != "": 355 print_deps(srcrsuggests, "Suggests", spec_preamble_top, d)
353 # spec_preamble_top.append('#Recommends: %s' % srcrrecommends) 356 print_deps(srcrprovides, "Provides", spec_preamble_top, d)
354 #if srcrsuggests and srcrsuggests.strip() != "": 357 print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
355 # spec_preamble_top.append('#Suggests: %s' % srcrsuggests) 358
356 if srcrprovides and srcrprovides.strip() != "": 359 # conflicts can not be in a provide! We will need to filter it.
357 spec_preamble_top.append('Provides: %s' % srcrprovides) 360 if srcrconflicts:
358 if srcrobsoletes and srcrobsoletes.strip() != "": 361 depends_dict = bb.utils.explode_dep_versions(srcrconflicts)
359 spec_preamble_top.append('Obsoletes: %s' % srcrobsoletes) 362 newdeps_dict = {}
360 if srcrconflicts and srcrconflicts.strip() != "": 363 for dep in depends_dict:
361 for dep in srcrconflicts.split(','):
362 # A conflict can NOT be in the provide or an internal conflict happens!
363 if dep not in srcrprovides: 364 if dep not in srcrprovides:
364 spec_preamble_bottom.append('Conflicts: %s' % dep) 365 newdeps_dict[dep] = depends_dict[dep]
366 if newdeps_dict:
367 srcrconflicts = bb.utils.join_deps(newdeps_dict)
368 else:
369 srcrconflicts = ""
370
371 print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d)
365 372
366 spec_preamble_top.append('') 373 spec_preamble_top.append('')
367 374
diff --git a/meta/recipes-devtools/rpm/rpm_5.1.10.bb b/meta/recipes-devtools/rpm/rpm_5.1.10.bb
index d75e48f416..d4b5a91668 100644
--- a/meta/recipes-devtools/rpm/rpm_5.1.10.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.1.10.bb
@@ -116,6 +116,9 @@ do_install_append() {
116 sed -i -e 's,perl.prov,${HOST_SYS}-perl.prov,' ${D}/${libdir}/rpm/macros 116 sed -i -e 's,perl.prov,${HOST_SYS}-perl.prov,' ${D}/${libdir}/rpm/macros
117 sed -i -e 's,perl.req,${HOST_SYS}-perl.req,' ${D}/${libdir}/rpm/macros 117 sed -i -e 's,perl.req,${HOST_SYS}-perl.req,' ${D}/${libdir}/rpm/macros
118 118
119 # Enable Debian style arbitrary tags...
120 sed -i -e 's,%_arbitrary_tags[^_].*,%_arbitrary_tags %{_arbitrary_tags_debian},' ${D}/${libdir}/rpm/macros
121
119 install -m 0755 ${WORKDIR}/perfile_rpmdeps.sh ${D}/${libdir}/rpm/perfile_rpmdeps.sh 122 install -m 0755 ${WORKDIR}/perfile_rpmdeps.sh ${D}/${libdir}/rpm/perfile_rpmdeps.sh
120 123
121 mv ${D}/${libdir}/python$PYTHONVER/rpm/${HOST_SYS}-__init__.py \ 124 mv ${D}/${libdir}/python$PYTHONVER/rpm/${HOST_SYS}-__init__.py \