summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-09 15:00:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-10 11:51:19 +0000
commitc8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch)
tree5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/package.bbclass
parent5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff)
downloadpoky-c8dee9b92dfd545852ecac8dc2adfc95ac02e957.tar.gz
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` (From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass232
1 files changed, 116 insertions, 116 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 0e1d8dbfc4..d01275f33a 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -88,9 +88,9 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
88 if newdeps: 88 if newdeps:
89 extra_depends = " ".join(newdeps) 89 extra_depends = " ".join(newdeps)
90 90
91 dvar = bb.data.getVar('PKGD', d, True) 91 dvar = d.getVar('PKGD', True)
92 92
93 packages = bb.data.getVar('PACKAGES', d, True).split() 93 packages = d.getVar('PACKAGES', True).split()
94 94
95 if postinst: 95 if postinst:
96 postinst = '#!/bin/sh\n' + postinst + '\n' 96 postinst = '#!/bin/sh\n' + postinst + '\n'
@@ -136,7 +136,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
136 packages = [pkg] + packages 136 packages = [pkg] + packages
137 else: 137 else:
138 packages.append(pkg) 138 packages.append(pkg)
139 oldfiles = bb.data.getVar('FILES_' + pkg, d, True) 139 oldfiles = d.getVar('FILES_' + pkg, True)
140 if not oldfiles: 140 if not oldfiles:
141 the_files = [os.path.join(root, o)] 141 the_files = [os.path.join(root, o)]
142 if aux_files_pattern: 142 if aux_files_pattern:
@@ -153,17 +153,17 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
153 the_files.append(aux_files_pattern_verbatim % m.group(1)) 153 the_files.append(aux_files_pattern_verbatim % m.group(1))
154 bb.data.setVar('FILES_' + pkg, " ".join(the_files), d) 154 bb.data.setVar('FILES_' + pkg, " ".join(the_files), d)
155 if extra_depends != '': 155 if extra_depends != '':
156 the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, True) 156 the_depends = d.getVar('RDEPENDS_' + pkg, True)
157 if the_depends: 157 if the_depends:
158 the_depends = '%s %s' % (the_depends, extra_depends) 158 the_depends = '%s %s' % (the_depends, extra_depends)
159 else: 159 else:
160 the_depends = extra_depends 160 the_depends = extra_depends
161 bb.data.setVar('RDEPENDS_' + pkg, the_depends, d) 161 d.setVar('RDEPENDS_' + pkg, the_depends)
162 bb.data.setVar('DESCRIPTION_' + pkg, description % on, d) 162 d.setVar('DESCRIPTION_' + pkg, description % on)
163 if postinst: 163 if postinst:
164 bb.data.setVar('pkg_postinst_' + pkg, postinst, d) 164 d.setVar('pkg_postinst_' + pkg, postinst)
165 if postrm: 165 if postrm:
166 bb.data.setVar('pkg_postrm_' + pkg, postrm, d) 166 d.setVar('pkg_postrm_' + pkg, postrm)
167 else: 167 else:
168 bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d) 168 bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d)
169 if callable(hook): 169 if callable(hook):
@@ -174,13 +174,13 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
174PACKAGE_DEPENDS += "file-native" 174PACKAGE_DEPENDS += "file-native"
175 175
176python () { 176python () {
177 if bb.data.getVar('PACKAGES', d, True) != '': 177 if d.getVar('PACKAGES', True) != '':
178 deps = bb.data.getVarFlag('do_package', 'depends', d) or "" 178 deps = d.getVarFlag('do_package', 'depends') or ""
179 for dep in (bb.data.getVar('PACKAGE_DEPENDS', d, True) or "").split(): 179 for dep in (d.getVar('PACKAGE_DEPENDS', True) or "").split():
180 deps += " %s:do_populate_sysroot" % dep 180 deps += " %s:do_populate_sysroot" % dep
181 bb.data.setVarFlag('do_package', 'depends', deps, d) 181 d.setVarFlag('do_package', 'depends', deps)
182 182
183 deps = (bb.data.getVarFlag('do_package', 'deptask', d) or "").split() 183 deps = (d.getVarFlag('do_package', 'deptask') or "").split()
184 # shlibs requires any DEPENDS to have already packaged for the *.list files 184 # shlibs requires any DEPENDS to have already packaged for the *.list files
185 deps.append("do_package") 185 deps.append("do_package")
186 bb.data.setVarFlag('do_package', 'deptask', " ".join(deps), d) 186 bb.data.setVarFlag('do_package', 'deptask', " ".join(deps), d)
@@ -198,9 +198,9 @@ def splitfile(file, debugfile, debugsrcdir, d):
198 198
199 import commands, stat 199 import commands, stat
200 200
201 dvar = bb.data.getVar('PKGD', d, True) 201 dvar = d.getVar('PKGD', True)
202 pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) 202 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
203 objcopy = bb.data.getVar("OBJCOPY", d, True) 203 objcopy = d.getVar("OBJCOPY", True)
204 debugedit = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit", d) 204 debugedit = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit", d)
205 workdir = bb.data.expand("${WORKDIR}", d) 205 workdir = bb.data.expand("${WORKDIR}", d)
206 workparentdir = os.path.dirname(workdir) 206 workparentdir = os.path.dirname(workdir)
@@ -240,10 +240,10 @@ def splitfile2(debugsrcdir, d):
240 240
241 import commands, stat 241 import commands, stat
242 242
243 dvar = bb.data.getVar('PKGD', d, True) 243 dvar = d.getVar('PKGD', True)
244 pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) 244 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
245 strip = bb.data.getVar("STRIP", d, True) 245 strip = d.getVar("STRIP", True)
246 objcopy = bb.data.getVar("OBJCOPY", d, True) 246 objcopy = d.getVar("OBJCOPY", True)
247 debugedit = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit", d) 247 debugedit = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit", d)
248 workdir = bb.data.expand("${WORKDIR}", d) 248 workdir = bb.data.expand("${WORKDIR}", d)
249 workparentdir = os.path.dirname(workdir) 249 workparentdir = os.path.dirname(workdir)
@@ -279,8 +279,8 @@ def runstrip(file, elftype, d):
279 279
280 import commands, stat 280 import commands, stat
281 281
282 pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) 282 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
283 strip = bb.data.getVar("STRIP", d, True) 283 strip = d.getVar("STRIP", True)
284 284
285 # Handle kernel modules specifically - .debug directories here are pointless 285 # Handle kernel modules specifically - .debug directories here are pointless
286 if file.find("/lib/modules/") != -1 and file.endswith(".ko"): 286 if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -329,10 +329,10 @@ def get_package_mapping (pkg, d):
329 return pkg 329 return pkg
330 330
331def runtime_mapping_rename (varname, d): 331def runtime_mapping_rename (varname, d):
332 #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, True))) 332 #bb.note("%s before: %s" % (varname, d.getVar(varname, True)))
333 333
334 new_depends = [] 334 new_depends = []
335 deps = bb.utils.explode_dep_versions(bb.data.getVar(varname, d, True) or "") 335 deps = bb.utils.explode_dep_versions(d.getVar(varname, True) or "")
336 for depend in deps: 336 for depend in deps:
337 # Have to be careful with any version component of the depend 337 # Have to be careful with any version component of the depend
338 new_depend = get_package_mapping(depend, d) 338 new_depend = get_package_mapping(depend, d)
@@ -343,7 +343,7 @@ def runtime_mapping_rename (varname, d):
343 343
344 bb.data.setVar(varname, " ".join(new_depends) or None, d) 344 bb.data.setVar(varname, " ".join(new_depends) or None, d)
345 345
346 #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, True))) 346 #bb.note("%s after: %s" % (varname, d.getVar(varname, True)))
347 347
348# 348#
349# Package functions suitable for inclusion in PACKAGEFUNCS 349# Package functions suitable for inclusion in PACKAGEFUNCS
@@ -359,19 +359,19 @@ python package_get_auto_pr() {
359} 359}
360 360
361python package_do_split_locales() { 361python package_do_split_locales() {
362 if (bb.data.getVar('PACKAGE_NO_LOCALE', d, True) == '1'): 362 if (d.getVar('PACKAGE_NO_LOCALE', True) == '1'):
363 bb.debug(1, "package requested not splitting locales") 363 bb.debug(1, "package requested not splitting locales")
364 return 364 return
365 365
366 packages = (bb.data.getVar('PACKAGES', d, True) or "").split() 366 packages = (d.getVar('PACKAGES', True) or "").split()
367 367
368 datadir = bb.data.getVar('datadir', d, True) 368 datadir = d.getVar('datadir', True)
369 if not datadir: 369 if not datadir:
370 bb.note("datadir not defined") 370 bb.note("datadir not defined")
371 return 371 return
372 372
373 dvar = bb.data.getVar('PKGD', d, True) 373 dvar = d.getVar('PKGD', True)
374 pn = bb.data.getVar('PN', d, True) 374 pn = d.getVar('PN', True)
375 375
376 if pn + '-locale' in packages: 376 if pn + '-locale' in packages:
377 packages.remove(pn + '-locale') 377 packages.remove(pn + '-locale')
@@ -392,9 +392,9 @@ python package_do_split_locales() {
392 if mainpkg.find('-dev'): 392 if mainpkg.find('-dev'):
393 mainpkg = mainpkg.replace('-dev', '') 393 mainpkg = mainpkg.replace('-dev', '')
394 394
395 summary = bb.data.getVar('SUMMARY', d, True) or pn 395 summary = d.getVar('SUMMARY', True) or pn
396 description = bb.data.getVar('DESCRIPTION', d, True) or "" 396 description = d.getVar('DESCRIPTION', True) or ""
397 locale_section = bb.data.getVar('LOCALE_SECTION', d, True) 397 locale_section = d.getVar('LOCALE_SECTION', True)
398 for l in locales: 398 for l in locales:
399 ln = legitimize_package_name(l) 399 ln = legitimize_package_name(l)
400 pkg = pn + '-locale-' + ln 400 pkg = pn + '-locale-' + ln
@@ -405,7 +405,7 @@ python package_do_split_locales() {
405 bb.data.setVar('SUMMARY_' + pkg, '%s - %s translations' % (summary, l), d) 405 bb.data.setVar('SUMMARY_' + pkg, '%s - %s translations' % (summary, l), d)
406 bb.data.setVar('DESCRIPTION_' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l), d) 406 bb.data.setVar('DESCRIPTION_' + pkg, '%s This package contains language translation files for the %s locale.' % (description, l), d)
407 if locale_section: 407 if locale_section:
408 bb.data.setVar('SECTION_' + pkg, locale_section, d) 408 d.setVar('SECTION_' + pkg, locale_section)
409 409
410 bb.data.setVar('PACKAGES', ' '.join(packages), d) 410 bb.data.setVar('PACKAGES', ' '.join(packages), d)
411 411
@@ -415,14 +415,14 @@ python package_do_split_locales() {
415 # glibc-localedata-translit* won't install as a dependency 415 # glibc-localedata-translit* won't install as a dependency
416 # for some other package which breaks meta-toolchain 416 # for some other package which breaks meta-toolchain
417 # Probably breaks since virtual-locale- isn't provided anywhere 417 # Probably breaks since virtual-locale- isn't provided anywhere
418 #rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, True) or bb.data.getVar('RDEPENDS', d, True) or "").split() 418 #rdep = (d.getVar('RDEPENDS_%s' % mainpkg, True) or d.getVar('RDEPENDS', True) or "").split()
419 #rdep.append('%s-locale*' % pn) 419 #rdep.append('%s-locale*' % pn)
420 #bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d) 420 #bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d)
421} 421}
422 422
423python perform_packagecopy () { 423python perform_packagecopy () {
424 dest = bb.data.getVar('D', d, True) 424 dest = d.getVar('D', True)
425 dvar = bb.data.getVar('PKGD', d, True) 425 dvar = d.getVar('PKGD', True)
426 426
427 bb.mkdirhier(dvar) 427 bb.mkdirhier(dvar)
428 428
@@ -549,16 +549,16 @@ python fixup_perms () {
549 # paths are resolved via BBPATH 549 # paths are resolved via BBPATH
550 def get_fs_perms_list(d): 550 def get_fs_perms_list(d):
551 str = "" 551 str = ""
552 fs_perms_tables = bb.data.getVar('FILESYSTEM_PERMS_TABLES', d, True) 552 fs_perms_tables = d.getVar('FILESYSTEM_PERMS_TABLES', True)
553 if not fs_perms_tables: 553 if not fs_perms_tables:
554 fs_perms_tables = 'files/fs-perms.txt' 554 fs_perms_tables = 'files/fs-perms.txt'
555 for conf_file in fs_perms_tables.split(): 555 for conf_file in fs_perms_tables.split():
556 str += " %s" % bb.which(bb.data.getVar('BBPATH', d, True), conf_file) 556 str += " %s" % bb.which(d.getVar('BBPATH', True), conf_file)
557 return str 557 return str
558 558
559 559
560 560
561 dvar = bb.data.getVar('PKGD', d, True) 561 dvar = d.getVar('PKGD', True)
562 562
563 fs_perms_table = {} 563 fs_perms_table = {}
564 564
@@ -586,7 +586,7 @@ python fixup_perms () {
586 'oldincludedir' ] 586 'oldincludedir' ]
587 587
588 for path in target_path_vars: 588 for path in target_path_vars:
589 dir = bb.data.getVar(path, d, True) or "" 589 dir = d.getVar(path, True) or ""
590 if dir == "": 590 if dir == "":
591 continue 591 continue
592 fs_perms_table[dir] = fs_perms_entry(bb.data.expand("%s 0755 root root false - - -" % (dir), d)) 592 fs_perms_table[dir] = fs_perms_entry(bb.data.expand("%s 0755 root root false - - -" % (dir), d))
@@ -664,11 +664,11 @@ python fixup_perms () {
664python split_and_strip_files () { 664python split_and_strip_files () {
665 import commands, stat, errno 665 import commands, stat, errno
666 666
667 dvar = bb.data.getVar('PKGD', d, True) 667 dvar = d.getVar('PKGD', True)
668 pn = bb.data.getVar('PN', d, True) 668 pn = d.getVar('PN', True)
669 669
670 # We default to '.debug' style 670 # We default to '.debug' style
671 if bb.data.getVar('PACKAGE_DEBUG_SPLIT_STYLE', d, True) == 'debug-file-directory': 671 if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE', True) == 'debug-file-directory':
672 # Single debug-file-directory style debug info 672 # Single debug-file-directory style debug info
673 debugappend = ".debug" 673 debugappend = ".debug"
674 debugdir = "" 674 debugdir = ""
@@ -691,7 +691,7 @@ python split_and_strip_files () {
691 # 8 - shared library 691 # 8 - shared library
692 def isELF(path): 692 def isELF(path):
693 type = 0 693 type = 0
694 pathprefix = "export PATH=%s; " % bb.data.getVar('PATH', d, True) 694 pathprefix = "export PATH=%s; " % d.getVar('PATH', True)
695 ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, path)) 695 ret, result = commands.getstatusoutput("%sfile '%s'" % (pathprefix, path))
696 696
697 if ret: 697 if ret:
@@ -715,8 +715,8 @@ python split_and_strip_files () {
715 # 715 #
716 file_list = {} 716 file_list = {}
717 file_links = {} 717 file_links = {}
718 if (bb.data.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT', d, True) != '1') and \ 718 if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT', True) != '1') and \
719 (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): 719 (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
720 for root, dirs, files in os.walk(dvar): 720 for root, dirs, files in os.walk(dvar):
721 for f in files: 721 for f in files:
722 file = os.path.join(root, f) 722 file = os.path.join(root, f)
@@ -764,7 +764,7 @@ python split_and_strip_files () {
764 # 764 #
765 # First lets process debug splitting 765 # First lets process debug splitting
766 # 766 #
767 if (bb.data.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT', d, True) != '1'): 767 if (d.getVar('INHIBIT_PACKAGE_DEBUG_SPLIT', True) != '1'):
768 for file in file_list: 768 for file in file_list:
769 src = file[len(dvar):] 769 src = file[len(dvar):]
770 dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend 770 dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
@@ -842,7 +842,7 @@ python split_and_strip_files () {
842 # 842 #
843 # Now lets go back over things and strip them 843 # Now lets go back over things and strip them
844 # 844 #
845 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, True) != '1'): 845 if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
846 for file in file_list: 846 for file in file_list:
847 if file_list[file].startswith("ELF: "): 847 if file_list[file].startswith("ELF: "):
848 elf_file = int(file_list[file][5:]) 848 elf_file = int(file_list[file][5:])
@@ -856,11 +856,11 @@ python split_and_strip_files () {
856python populate_packages () { 856python populate_packages () {
857 import glob, stat, errno, re 857 import glob, stat, errno, re
858 858
859 workdir = bb.data.getVar('WORKDIR', d, True) 859 workdir = d.getVar('WORKDIR', True)
860 outdir = bb.data.getVar('DEPLOY_DIR', d, True) 860 outdir = d.getVar('DEPLOY_DIR', True)
861 dvar = bb.data.getVar('PKGD', d, True) 861 dvar = d.getVar('PKGD', True)
862 packages = bb.data.getVar('PACKAGES', d, True) 862 packages = d.getVar('PACKAGES', True)
863 pn = bb.data.getVar('PN', d, True) 863 pn = d.getVar('PN', True)
864 864
865 bb.mkdirhier(outdir) 865 bb.mkdirhier(outdir)
866 os.chdir(dvar) 866 os.chdir(dvar)
@@ -877,7 +877,7 @@ python populate_packages () {
877 else: 877 else:
878 package_list.append(pkg) 878 package_list.append(pkg)
879 879
880 pkgdest = bb.data.getVar('PKGDEST', d, True) 880 pkgdest = d.getVar('PKGDEST', True)
881 os.system('rm -rf %s' % pkgdest) 881 os.system('rm -rf %s' % pkgdest)
882 882
883 seen = [] 883 seen = []
@@ -887,14 +887,14 @@ python populate_packages () {
887 root = os.path.join(pkgdest, pkg) 887 root = os.path.join(pkgdest, pkg)
888 bb.mkdirhier(root) 888 bb.mkdirhier(root)
889 889
890 bb.data.setVar('PKG', pkg, localdata) 890 localdata.setVar('PKG', pkg)
891 overrides = bb.data.getVar('OVERRIDES', localdata, True) 891 overrides = localdata.getVar('OVERRIDES', True)
892 if not overrides: 892 if not overrides:
893 raise bb.build.FuncFailed('OVERRIDES not defined') 893 raise bb.build.FuncFailed('OVERRIDES not defined')
894 bb.data.setVar('OVERRIDES', overrides + ':' + pkg, localdata) 894 localdata.setVar('OVERRIDES', overrides + ':' + pkg)
895 bb.data.update_data(localdata) 895 bb.data.update_data(localdata)
896 896
897 filesvar = bb.data.getVar('FILES', localdata, True) or "" 897 filesvar = localdata.getVar('FILES', True) or ""
898 files = filesvar.split() 898 files = filesvar.split()
899 file_links = {} 899 file_links = {}
900 for file in files: 900 for file in files:
@@ -973,9 +973,9 @@ python populate_packages () {
973 bb.build.exec_func("package_name_hook", d) 973 bb.build.exec_func("package_name_hook", d)
974 974
975 for pkg in package_list: 975 for pkg in package_list:
976 pkgname = bb.data.getVar('PKG_%s' % pkg, d, True) 976 pkgname = d.getVar('PKG_%s' % pkg, True)
977 if pkgname is None: 977 if pkgname is None:
978 bb.data.setVar('PKG_%s' % pkg, pkg, d) 978 d.setVar('PKG_%s' % pkg, pkg)
979 979
980 dangling_links = {} 980 dangling_links = {}
981 pkg_files = {} 981 pkg_files = {}
@@ -999,7 +999,7 @@ python populate_packages () {
999 dangling_links[pkg].append(os.path.normpath(target)) 999 dangling_links[pkg].append(os.path.normpath(target))
1000 1000
1001 for pkg in package_list: 1001 for pkg in package_list:
1002 rdepends = bb.utils.explode_dep_versions(bb.data.getVar('RDEPENDS_' + pkg, d, True) or bb.data.getVar('RDEPENDS', d, True) or "") 1002 rdepends = bb.utils.explode_dep_versions(d.getVar('RDEPENDS_' + pkg, True) or d.getVar('RDEPENDS', True) or "")
1003 1003
1004 for l in dangling_links[pkg]: 1004 for l in dangling_links[pkg]:
1005 found = False 1005 found = False
@@ -1040,9 +1040,9 @@ python emit_pkgdata() {
1040 f.write('%s: %s\n' % (var, encode(val))) 1040 f.write('%s: %s\n' % (var, encode(val)))
1041 return 1041 return
1042 1042
1043 packages = bb.data.getVar('PACKAGES', d, True) 1043 packages = d.getVar('PACKAGES', True)
1044 pkgdest = bb.data.getVar('PKGDEST', d, 1) 1044 pkgdest = d.getVar('PKGDEST', 1)
1045 pkgdatadir = bb.data.getVar('PKGDESTWORK', d, True) 1045 pkgdatadir = d.getVar('PKGDESTWORK', True)
1046 1046
1047 # Take shared lock since we're only reading, not writing 1047 # Take shared lock since we're only reading, not writing
1048 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d), True) 1048 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d), True)
@@ -1052,7 +1052,7 @@ python emit_pkgdata() {
1052 f.write("PACKAGES: %s\n" % packages) 1052 f.write("PACKAGES: %s\n" % packages)
1053 f.close() 1053 f.close()
1054 1054
1055 workdir = bb.data.getVar('WORKDIR', d, True) 1055 workdir = d.getVar('WORKDIR', True)
1056 1056
1057 for pkg in packages.split(): 1057 for pkg in packages.split():
1058 subdata_file = pkgdatadir + "/runtime/%s" % pkg 1058 subdata_file = pkgdatadir + "/runtime/%s" % pkg
@@ -1080,19 +1080,19 @@ python emit_pkgdata() {
1080 write_if_exists(sf, pkg, 'pkg_preinst') 1080 write_if_exists(sf, pkg, 'pkg_preinst')
1081 write_if_exists(sf, pkg, 'pkg_prerm') 1081 write_if_exists(sf, pkg, 'pkg_prerm')
1082 write_if_exists(sf, pkg, 'FILERPROVIDESFLIST') 1082 write_if_exists(sf, pkg, 'FILERPROVIDESFLIST')
1083 for dfile in (bb.data.getVar('FILERPROVIDESFLIST_' + pkg, d, True) or "").split(): 1083 for dfile in (d.getVar('FILERPROVIDESFLIST_' + pkg, True) or "").split():
1084 write_if_exists(sf, pkg, 'FILERPROVIDES_' + dfile) 1084 write_if_exists(sf, pkg, 'FILERPROVIDES_' + dfile)
1085 1085
1086 write_if_exists(sf, pkg, 'FILERDEPENDSFLIST') 1086 write_if_exists(sf, pkg, 'FILERDEPENDSFLIST')
1087 for dfile in (bb.data.getVar('FILERDEPENDSFLIST_' + pkg, d, True) or "").split(): 1087 for dfile in (d.getVar('FILERDEPENDSFLIST_' + pkg, True) or "").split():
1088 write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile) 1088 write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile)
1089 1089
1090 sf.close() 1090 sf.close()
1091 1091
1092 1092
1093 allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) 1093 allow_empty = d.getVar('ALLOW_EMPTY_%s' % pkg, True)
1094 if not allow_empty: 1094 if not allow_empty:
1095 allow_empty = bb.data.getVar('ALLOW_EMPTY', d, True) 1095 allow_empty = d.getVar('ALLOW_EMPTY', True)
1096 root = "%s/%s" % (pkgdest, pkg) 1096 root = "%s/%s" % (pkgdest, pkg)
1097 os.chdir(root) 1097 os.chdir(root)
1098 g = glob('*') 1098 g = glob('*')
@@ -1123,8 +1123,8 @@ RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/bin/rpmdeps"
1123python package_do_filedeps() { 1123python package_do_filedeps() {
1124 import os, re 1124 import os, re
1125 1125
1126 pkgdest = bb.data.getVar('PKGDEST', d, True) 1126 pkgdest = d.getVar('PKGDEST', True)
1127 packages = bb.data.getVar('PACKAGES', d, True) 1127 packages = d.getVar('PACKAGES', True)
1128 1128
1129 rpmdeps = bb.data.expand("${RPMDEPS}", d) 1129 rpmdeps = bb.data.expand("${RPMDEPS}", d)
1130 r = re.compile(r'[<>=]+ +[^ ]*') 1130 r = re.compile(r'[<>=]+ +[^ ]*')
@@ -1189,7 +1189,7 @@ SHLIBSWORKDIR = "${WORKDIR}/shlibs"
1189python package_do_shlibs() { 1189python package_do_shlibs() {
1190 import re 1190 import re
1191 1191
1192 exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0) 1192 exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', 0)
1193 if exclude_shlibs: 1193 if exclude_shlibs:
1194 bb.note("not generating shlibs") 1194 bb.note("not generating shlibs")
1195 return 1195 return
@@ -1197,27 +1197,27 @@ python package_do_shlibs() {
1197 lib_re = re.compile("^.*\.so") 1197 lib_re = re.compile("^.*\.so")
1198 libdir_re = re.compile(".*/lib$") 1198 libdir_re = re.compile(".*/lib$")
1199 1199
1200 packages = bb.data.getVar('PACKAGES', d, True) 1200 packages = d.getVar('PACKAGES', True)
1201 targetos = bb.data.getVar('TARGET_OS', d, True) 1201 targetos = d.getVar('TARGET_OS', True)
1202 1202
1203 workdir = bb.data.getVar('WORKDIR', d, True) 1203 workdir = d.getVar('WORKDIR', True)
1204 1204
1205 ver = bb.data.getVar('PKGV', d, True) 1205 ver = d.getVar('PKGV', True)
1206 if not ver: 1206 if not ver:
1207 bb.error("PKGV not defined") 1207 bb.error("PKGV not defined")
1208 return 1208 return
1209 1209
1210 pkgdest = bb.data.getVar('PKGDEST', d, True) 1210 pkgdest = d.getVar('PKGDEST', True)
1211 1211
1212 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) 1212 shlibs_dir = d.getVar('SHLIBSDIR', True)
1213 shlibswork_dir = bb.data.getVar('SHLIBSWORKDIR', d, True) 1213 shlibswork_dir = d.getVar('SHLIBSWORKDIR', True)
1214 1214
1215 # Take shared lock since we're only reading, not writing 1215 # Take shared lock since we're only reading, not writing
1216 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d)) 1216 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d))
1217 1217
1218 def linux_so(root, path, file): 1218 def linux_so(root, path, file):
1219 cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + os.path.join(root, file) + " 2>/dev/null" 1219 cmd = d.getVar('OBJDUMP', True) + " -p " + os.path.join(root, file) + " 2>/dev/null"
1220 cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, True), cmd) 1220 cmd = "PATH=\"%s\" %s" % (d.getVar('PATH', True), cmd)
1221 fd = os.popen(cmd) 1221 fd = os.popen(cmd)
1222 lines = fd.readlines() 1222 lines = fd.readlines()
1223 fd.close() 1223 fd.close()
@@ -1264,7 +1264,7 @@ python package_do_shlibs() {
1264 if not combo in sonames: 1264 if not combo in sonames:
1265 sonames.append(combo) 1265 sonames.append(combo)
1266 if file.endswith('.dylib') or file.endswith('.so'): 1266 if file.endswith('.dylib') or file.endswith('.so'):
1267 lafile = fullpath.replace(os.path.join(pkgdest, pkg), bb.data.getVar('PKGD', d, True)) 1267 lafile = fullpath.replace(os.path.join(pkgdest, pkg), d.getVar('PKGD', True))
1268 # Drop suffix 1268 # Drop suffix
1269 lafile = lafile.rsplit(".",1)[0] 1269 lafile = lafile.rsplit(".",1)[0]
1270 lapath = os.path.dirname(lafile) 1270 lapath = os.path.dirname(lafile)
@@ -1299,26 +1299,26 @@ python package_do_shlibs() {
1299 needed[pkg].append(name) 1299 needed[pkg].append(name)
1300 #bb.note("Adding %s for %s" % (name, pkg)) 1300 #bb.note("Adding %s for %s" % (name, pkg))
1301 1301
1302 if bb.data.getVar('PACKAGE_SNAP_LIB_SYMLINKS', d, True) == "1": 1302 if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS', True) == "1":
1303 snap_symlinks = True 1303 snap_symlinks = True
1304 else: 1304 else:
1305 snap_symlinks = False 1305 snap_symlinks = False
1306 1306
1307 if (bb.data.getVar('USE_LDCONFIG', d, True) or "1") == "1": 1307 if (d.getVar('USE_LDCONFIG', True) or "1") == "1":
1308 use_ldconfig = True 1308 use_ldconfig = True
1309 else: 1309 else:
1310 use_ldconfig = False 1310 use_ldconfig = False
1311 1311
1312 needed = {} 1312 needed = {}
1313 shlib_provider = {} 1313 shlib_provider = {}
1314 private_libs = bb.data.getVar('PRIVATE_LIBS', d, True) 1314 private_libs = d.getVar('PRIVATE_LIBS', True)
1315 for pkg in packages.split(): 1315 for pkg in packages.split():
1316 needs_ldconfig = False 1316 needs_ldconfig = False
1317 bb.debug(2, "calculating shlib provides for %s" % pkg) 1317 bb.debug(2, "calculating shlib provides for %s" % pkg)
1318 1318
1319 pkgver = bb.data.getVar('PKGV_' + pkg, d, True) 1319 pkgver = d.getVar('PKGV_' + pkg, True)
1320 if not pkgver: 1320 if not pkgver:
1321 pkgver = bb.data.getVar('PV_' + pkg, d, True) 1321 pkgver = d.getVar('PV_' + pkg, True)
1322 if not pkgver: 1322 if not pkgver:
1323 pkgver = ver 1323 pkgver = ver
1324 1324
@@ -1352,11 +1352,11 @@ python package_do_shlibs() {
1352 fd.close() 1352 fd.close()
1353 if needs_ldconfig and use_ldconfig: 1353 if needs_ldconfig and use_ldconfig:
1354 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) 1354 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
1355 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) 1355 postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True)
1356 if not postinst: 1356 if not postinst:
1357 postinst = '#!/bin/sh\n' 1357 postinst = '#!/bin/sh\n'
1358 postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) 1358 postinst += d.getVar('ldconfig_postinst_fragment', True)
1359 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) 1359 d.setVar('pkg_postinst_%s' % pkg, postinst)
1360 1360
1361 list_re = re.compile('^(.*)\.list$') 1361 list_re = re.compile('^(.*)\.list$')
1362 for dir in [shlibs_dir]: 1362 for dir in [shlibs_dir]:
@@ -1380,7 +1380,7 @@ python package_do_shlibs() {
1380 1380
1381 bb.utils.unlockfile(lf) 1381 bb.utils.unlockfile(lf)
1382 1382
1383 assumed_libs = bb.data.getVar('ASSUME_SHLIBS', d, True) 1383 assumed_libs = d.getVar('ASSUME_SHLIBS', True)
1384 if assumed_libs: 1384 if assumed_libs:
1385 for e in assumed_libs.split(): 1385 for e in assumed_libs.split():
1386 l, dep_pkg = e.split(":") 1386 l, dep_pkg = e.split(":")
@@ -1424,12 +1424,12 @@ python package_do_shlibs() {
1424python package_do_pkgconfig () { 1424python package_do_pkgconfig () {
1425 import re 1425 import re
1426 1426
1427 packages = bb.data.getVar('PACKAGES', d, True) 1427 packages = d.getVar('PACKAGES', True)
1428 workdir = bb.data.getVar('WORKDIR', d, True) 1428 workdir = d.getVar('WORKDIR', True)
1429 pkgdest = bb.data.getVar('PKGDEST', d, True) 1429 pkgdest = d.getVar('PKGDEST', True)
1430 1430
1431 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) 1431 shlibs_dir = d.getVar('SHLIBSDIR', True)
1432 shlibswork_dir = bb.data.getVar('SHLIBSWORKDIR', d, True) 1432 shlibswork_dir = d.getVar('SHLIBSWORKDIR', True)
1433 1433
1434 pc_re = re.compile('(.*)\.pc$') 1434 pc_re = re.compile('(.*)\.pc$')
1435 var_re = re.compile('(.*)=(.*)') 1435 var_re = re.compile('(.*)=(.*)')
@@ -1515,9 +1515,9 @@ python package_do_pkgconfig () {
1515} 1515}
1516 1516
1517python read_shlibdeps () { 1517python read_shlibdeps () {
1518 packages = bb.data.getVar('PACKAGES', d, True).split() 1518 packages = d.getVar('PACKAGES', True).split()
1519 for pkg in packages: 1519 for pkg in packages:
1520 rdepends = bb.utils.explode_dep_versions(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") 1520 rdepends = bb.utils.explode_dep_versions(d.getVar('RDEPENDS_' + pkg, 0) or d.getVar('RDEPENDS', 0) or "")
1521 1521
1522 for extension in ".shlibdeps", ".pcdeps", ".clilibdeps": 1522 for extension in ".shlibdeps", ".pcdeps", ".clilibdeps":
1523 depsfile = bb.data.expand("${PKGDEST}/" + pkg + extension, d) 1523 depsfile = bb.data.expand("${PKGDEST}/" + pkg + extension, d)
@@ -1544,14 +1544,14 @@ python package_depchains() {
1544 package. 1544 package.
1545 """ 1545 """
1546 1546
1547 packages = bb.data.getVar('PACKAGES', d, True) 1547 packages = d.getVar('PACKAGES', True)
1548 postfixes = (bb.data.getVar('DEPCHAIN_POST', d, True) or '').split() 1548 postfixes = (d.getVar('DEPCHAIN_POST', True) or '').split()
1549 prefixes = (bb.data.getVar('DEPCHAIN_PRE', d, True) or '').split() 1549 prefixes = (d.getVar('DEPCHAIN_PRE', True) or '').split()
1550 1550
1551 def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d): 1551 def pkg_adddeprrecs(pkg, base, suffix, getname, depends, d):
1552 1552
1553 #bb.note('depends for %s is %s' % (base, depends)) 1553 #bb.note('depends for %s is %s' % (base, depends))
1554 rreclist = bb.utils.explode_dep_versions(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") 1554 rreclist = bb.utils.explode_dep_versions(d.getVar('RRECOMMENDS_' + pkg, True) or d.getVar('RRECOMMENDS', True) or "")
1555 1555
1556 for depend in depends: 1556 for depend in depends:
1557 if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'): 1557 if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'):
@@ -1572,7 +1572,7 @@ python package_depchains() {
1572 def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d): 1572 def pkg_addrrecs(pkg, base, suffix, getname, rdepends, d):
1573 1573
1574 #bb.note('rdepends for %s is %s' % (base, rdepends)) 1574 #bb.note('rdepends for %s is %s' % (base, rdepends))
1575 rreclist = bb.utils.explode_dep_versions(bb.data.getVar('RRECOMMENDS_' + pkg, d, True) or bb.data.getVar('RRECOMMENDS', d, True) or "") 1575 rreclist = bb.utils.explode_dep_versions(d.getVar('RRECOMMENDS_' + pkg, True) or d.getVar('RRECOMMENDS', True) or "")
1576 1576
1577 for depend in rdepends: 1577 for depend in rdepends:
1578 if depend.find('virtual-locale-') != -1: 1578 if depend.find('virtual-locale-') != -1:
@@ -1596,15 +1596,15 @@ python package_depchains() {
1596 list.append(dep) 1596 list.append(dep)
1597 1597
1598 depends = [] 1598 depends = []
1599 for dep in bb.utils.explode_deps(bb.data.getVar('DEPENDS', d, True) or ""): 1599 for dep in bb.utils.explode_deps(d.getVar('DEPENDS', True) or ""):
1600 add_dep(depends, dep) 1600 add_dep(depends, dep)
1601 1601
1602 rdepends = [] 1602 rdepends = []
1603 for dep in bb.utils.explode_deps(bb.data.getVar('RDEPENDS', d, True) or ""): 1603 for dep in bb.utils.explode_deps(d.getVar('RDEPENDS', True) or ""):
1604 add_dep(rdepends, dep) 1604 add_dep(rdepends, dep)
1605 1605
1606 for pkg in packages.split(): 1606 for pkg in packages.split():
1607 for dep in bb.utils.explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, True) or ""): 1607 for dep in bb.utils.explode_deps(d.getVar('RDEPENDS_' + pkg, True) or ""):
1608 add_dep(rdepends, dep) 1608 add_dep(rdepends, dep)
1609 1609
1610 #bb.note('rdepends is %s' % rdepends) 1610 #bb.note('rdepends is %s' % rdepends)
@@ -1630,7 +1630,7 @@ python package_depchains() {
1630 1630
1631 for suffix in pkgs: 1631 for suffix in pkgs:
1632 for pkg in pkgs[suffix]: 1632 for pkg in pkgs[suffix]:
1633 if bb.data.getVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs', d): 1633 if d.getVarFlag('RRECOMMENDS_' + pkg, 'nodeprrecs'):
1634 continue 1634 continue
1635 (base, func) = pkgs[suffix][pkg] 1635 (base, func) = pkgs[suffix][pkg]
1636 if suffix == "-dev": 1636 if suffix == "-dev":
@@ -1639,7 +1639,7 @@ python package_depchains() {
1639 pkg_addrrecs(pkg, base, suffix, func, rdepends, d) 1639 pkg_addrrecs(pkg, base, suffix, func, rdepends, d)
1640 else: 1640 else:
1641 rdeps = [] 1641 rdeps = []
1642 for dep in bb.utils.explode_deps(bb.data.getVar('RDEPENDS_' + base, d, True) or bb.data.getVar('RDEPENDS', d, True) or ""): 1642 for dep in bb.utils.explode_deps(d.getVar('RDEPENDS_' + base, True) or d.getVar('RDEPENDS', True) or ""):
1643 add_dep(rdeps, dep) 1643 add_dep(rdeps, dep)
1644 pkg_addrrecs(pkg, base, suffix, func, rdeps, d) 1644 pkg_addrrecs(pkg, base, suffix, func, rdeps, d)
1645} 1645}
@@ -1679,22 +1679,22 @@ python do_package () {
1679 # as any change to rpmdeps requires this to be rerun. 1679 # as any change to rpmdeps requires this to be rerun.
1680 # PACKAGE_BBCLASS_VERSION = "1" 1680 # PACKAGE_BBCLASS_VERSION = "1"
1681 1681
1682 packages = (bb.data.getVar('PACKAGES', d, True) or "").split() 1682 packages = (d.getVar('PACKAGES', True) or "").split()
1683 if len(packages) < 1: 1683 if len(packages) < 1:
1684 bb.debug(1, "No packages to build, skipping do_package") 1684 bb.debug(1, "No packages to build, skipping do_package")
1685 return 1685 return
1686 1686
1687 workdir = bb.data.getVar('WORKDIR', d, True) 1687 workdir = d.getVar('WORKDIR', True)
1688 outdir = bb.data.getVar('DEPLOY_DIR', d, True) 1688 outdir = d.getVar('DEPLOY_DIR', True)
1689 dest = bb.data.getVar('D', d, True) 1689 dest = d.getVar('D', True)
1690 dvar = bb.data.getVar('PKGD', d, True) 1690 dvar = d.getVar('PKGD', True)
1691 pn = bb.data.getVar('PN', d, True) 1691 pn = d.getVar('PN', True)
1692 1692
1693 if not workdir or not outdir or not dest or not dvar or not pn or not packages: 1693 if not workdir or not outdir or not dest or not dvar or not pn or not packages:
1694 bb.error("WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package") 1694 bb.error("WORKDIR, DEPLOY_DIR, D, PN and PKGD all must be defined, unable to package")
1695 return 1695 return
1696 1696
1697 for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): 1697 for f in (d.getVar('PACKAGEFUNCS', True) or '').split():
1698 bb.build.exec_func(f, d) 1698 bb.build.exec_func(f, d)
1699} 1699}
1700 1700