summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_ipk.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_ipk.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_ipk.bbclass')
-rw-r--r--meta/classes/package_ipk.bbclass82
1 files changed, 41 insertions, 41 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass
index d41b40d2c5..df608fc0e3 100644
--- a/meta/classes/package_ipk.bbclass
+++ b/meta/classes/package_ipk.bbclass
@@ -11,16 +11,16 @@ PKGWRITEDIRIPK = "${WORKDIR}/deploy-ipks"
11OPKGBUILDCMD ??= "opkg-build" 11OPKGBUILDCMD ??= "opkg-build"
12 12
13python package_ipk_fn () { 13python package_ipk_fn () {
14 bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) 14 bb.data.setVar('PKGFN', d.getVar('PKG'), d)
15} 15}
16 16
17python package_ipk_install () { 17python package_ipk_install () {
18 pkg = bb.data.getVar('PKG', d, 1) 18 pkg = d.getVar('PKG', 1)
19 pkgfn = bb.data.getVar('PKGFN', d, 1) 19 pkgfn = d.getVar('PKGFN', 1)
20 rootfs = bb.data.getVar('IMAGE_ROOTFS', d, 1) 20 rootfs = d.getVar('IMAGE_ROOTFS', 1)
21 ipkdir = bb.data.getVar('DEPLOY_DIR_IPK', d, 1) 21 ipkdir = d.getVar('DEPLOY_DIR_IPK', 1)
22 stagingdir = bb.data.getVar('STAGING_DIR', d, 1) 22 stagingdir = d.getVar('STAGING_DIR', 1)
23 tmpdir = bb.data.getVar('TMPDIR', d, 1) 23 tmpdir = d.getVar('TMPDIR', 1)
24 24
25 if None in (pkg,pkgfn,rootfs): 25 if None in (pkg,pkgfn,rootfs):
26 raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)") 26 raise bb.build.FuncFailed("missing variables (one or more of PKG, PKGFN, IMAGEROOTFS)")
@@ -36,7 +36,7 @@ python package_ipk_install () {
36 # Generate ipk.conf if it or the stamp doesnt exist 36 # Generate ipk.conf if it or the stamp doesnt exist
37 conffile = os.path.join(stagingdir,"ipkg.conf") 37 conffile = os.path.join(stagingdir,"ipkg.conf")
38 if not os.access(conffile, os.R_OK): 38 if not os.access(conffile, os.R_OK):
39 ipkg_archs = bb.data.getVar('PACKAGE_ARCHS',d) 39 ipkg_archs = d.getVar('PACKAGE_ARCHS')
40 if ipkg_archs is None: 40 if ipkg_archs is None:
41 bb.error("PACKAGE_ARCHS missing") 41 bb.error("PACKAGE_ARCHS missing")
42 raise FuncFailed 42 raise FuncFailed
@@ -259,15 +259,15 @@ python do_package_ipk () {
259 import re, copy 259 import re, copy
260 import textwrap 260 import textwrap
261 261
262 workdir = bb.data.getVar('WORKDIR', d, True) 262 workdir = d.getVar('WORKDIR', True)
263 outdir = bb.data.getVar('PKGWRITEDIRIPK', d, True) 263 outdir = d.getVar('PKGWRITEDIRIPK', True)
264 tmpdir = bb.data.getVar('TMPDIR', d, True) 264 tmpdir = d.getVar('TMPDIR', True)
265 pkgdest = bb.data.getVar('PKGDEST', d, True) 265 pkgdest = d.getVar('PKGDEST', True)
266 if not workdir or not outdir or not tmpdir: 266 if not workdir or not outdir or not tmpdir:
267 bb.error("Variables incorrectly set, unable to package") 267 bb.error("Variables incorrectly set, unable to package")
268 return 268 return
269 269
270 packages = bb.data.getVar('PACKAGES', d, True) 270 packages = d.getVar('PACKAGES', True)
271 if not packages or packages == '': 271 if not packages or packages == '':
272 bb.debug(1, "No packages; nothing to do") 272 bb.debug(1, "No packages; nothing to do")
273 return 273 return
@@ -283,18 +283,18 @@ python do_package_ipk () {
283 283
284 lf = bb.utils.lockfile(root + ".lock") 284 lf = bb.utils.lockfile(root + ".lock")
285 285
286 bb.data.setVar('ROOT', '', localdata) 286 localdata.setVar('ROOT', '')
287 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 287 localdata.setVar('ROOT_%s' % pkg, root)
288 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) 288 pkgname = localdata.getVar('PKG_%s' % pkg, 1)
289 if not pkgname: 289 if not pkgname:
290 pkgname = pkg 290 pkgname = pkg
291 bb.data.setVar('PKG', pkgname, localdata) 291 localdata.setVar('PKG', pkgname)
292 292
293 bb.data.setVar('OVERRIDES', pkg, localdata) 293 localdata.setVar('OVERRIDES', pkg)
294 294
295 bb.data.update_data(localdata) 295 bb.data.update_data(localdata)
296 basedir = os.path.join(os.path.dirname(root)) 296 basedir = os.path.join(os.path.dirname(root))
297 arch = bb.data.getVar('PACKAGE_ARCH', localdata, 1) 297 arch = localdata.getVar('PACKAGE_ARCH', 1)
298 pkgoutdir = "%s/%s" % (outdir, arch) 298 pkgoutdir = "%s/%s" % (outdir, arch)
299 bb.mkdirhier(pkgoutdir) 299 bb.mkdirhier(pkgoutdir)
300 os.chdir(root) 300 os.chdir(root)
@@ -305,8 +305,8 @@ python do_package_ipk () {
305 del g[g.index('./CONTROL')] 305 del g[g.index('./CONTROL')]
306 except ValueError: 306 except ValueError:
307 pass 307 pass
308 if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": 308 if not g and localdata.getVar('ALLOW_EMPTY') != "1":
309 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PKGV', localdata, 1), bb.data.getVar('PKGR', localdata, 1))) 309 bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', 1), localdata.getVar('PKGR', 1)))
310 bb.utils.unlockfile(lf) 310 bb.utils.unlockfile(lf)
311 continue 311 continue
312 312
@@ -319,7 +319,7 @@ python do_package_ipk () {
319 raise bb.build.FuncFailed("unable to open control file for writing.") 319 raise bb.build.FuncFailed("unable to open control file for writing.")
320 320
321 fields = [] 321 fields = []
322 pe = bb.data.getVar('PKGE', d, 1) 322 pe = d.getVar('PKGE', 1)
323 if pe and int(pe) > 0: 323 if pe and int(pe) > 0:
324 fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) 324 fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']])
325 else: 325 else:
@@ -336,7 +336,7 @@ python do_package_ipk () {
336 def pullData(l, d): 336 def pullData(l, d):
337 l2 = [] 337 l2 = []
338 for i in l: 338 for i in l:
339 l2.append(bb.data.getVar(i, d, 1)) 339 l2.append(d.getVar(i, 1))
340 return l2 340 return l2
341 341
342 ctrlfile.write("Package: %s\n" % pkgname) 342 ctrlfile.write("Package: %s\n" % pkgname)
@@ -344,12 +344,12 @@ python do_package_ipk () {
344 try: 344 try:
345 for (c, fs) in fields: 345 for (c, fs) in fields:
346 for f in fs: 346 for f in fs:
347 if bb.data.getVar(f, localdata) is None: 347 if localdata.getVar(f) is None:
348 raise KeyError(f) 348 raise KeyError(f)
349 # Special behavior for description... 349 # Special behavior for description...
350 if 'DESCRIPTION' in fs: 350 if 'DESCRIPTION' in fs:
351 summary = bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or "." 351 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
352 description = bb.data.getVar('DESCRIPTION', localdata, True) or "." 352 description = localdata.getVar('DESCRIPTION', True) or "."
353 description = textwrap.dedent(description).strip() 353 description = textwrap.dedent(description).strip()
354 ctrlfile.write('Description: %s\n' % summary) 354 ctrlfile.write('Description: %s\n' % summary)
355 ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' ')) 355 ctrlfile.write('%s\n' % textwrap.fill(description, width=74, initial_indent=' ', subsequent_indent=' '))
@@ -365,12 +365,12 @@ python do_package_ipk () {
365 365
366 bb.build.exec_func("mapping_rename_hook", localdata) 366 bb.build.exec_func("mapping_rename_hook", localdata)
367 367
368 rdepends = bb.utils.explode_dep_versions(bb.data.getVar("RDEPENDS", localdata, 1) or "") 368 rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", 1) or "")
369 rrecommends = bb.utils.explode_dep_versions(bb.data.getVar("RRECOMMENDS", localdata, 1) or "") 369 rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", 1) or "")
370 rsuggests = bb.utils.explode_dep_versions(bb.data.getVar("RSUGGESTS", localdata, 1) or "") 370 rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", 1) or "")
371 rprovides = bb.utils.explode_dep_versions(bb.data.getVar("RPROVIDES", localdata, 1) or "") 371 rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", 1) or "")
372 rreplaces = bb.utils.explode_dep_versions(bb.data.getVar("RREPLACES", localdata, 1) or "") 372 rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", 1) or "")
373 rconflicts = bb.utils.explode_dep_versions(bb.data.getVar("RCONFLICTS", localdata, 1) or "") 373 rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", 1) or "")
374 374
375 if rdepends: 375 if rdepends:
376 ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends)) 376 ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
@@ -384,14 +384,14 @@ python do_package_ipk () {
384 ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) 384 ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
385 if rconflicts: 385 if rconflicts:
386 ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) 386 ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
387 src_uri = bb.data.getVar("SRC_URI", localdata, 1) 387 src_uri = localdata.getVar("SRC_URI", 1)
388 if src_uri: 388 if src_uri:
389 src_uri = re.sub("\s+", " ", src_uri) 389 src_uri = re.sub("\s+", " ", src_uri)
390 ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) 390 ctrlfile.write("Source: %s\n" % " ".join(src_uri.split()))
391 ctrlfile.close() 391 ctrlfile.close()
392 392
393 for script in ["preinst", "postinst", "prerm", "postrm"]: 393 for script in ["preinst", "postinst", "prerm", "postrm"]:
394 scriptvar = bb.data.getVar('pkg_%s' % script, localdata, 1) 394 scriptvar = localdata.getVar('pkg_%s' % script, 1)
395 if not scriptvar: 395 if not scriptvar:
396 continue 396 continue
397 try: 397 try:
@@ -403,7 +403,7 @@ python do_package_ipk () {
403 scriptfile.close() 403 scriptfile.close()
404 os.chmod(os.path.join(controldir, script), 0755) 404 os.chmod(os.path.join(controldir, script), 0755)
405 405
406 conffiles_str = bb.data.getVar("CONFFILES", localdata, 1) 406 conffiles_str = localdata.getVar("CONFFILES", 1)
407 if conffiles_str: 407 if conffiles_str:
408 try: 408 try:
409 conffiles = file(os.path.join(controldir, 'conffiles'), 'w') 409 conffiles = file(os.path.join(controldir, 'conffiles'), 'w')
@@ -415,8 +415,8 @@ python do_package_ipk () {
415 conffiles.close() 415 conffiles.close()
416 416
417 os.chdir(basedir) 417 os.chdir(basedir)
418 ret = os.system("PATH=\"%s\" %s %s %s" % (bb.data.getVar("PATH", localdata, 1), 418 ret = os.system("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", 1),
419 bb.data.getVar("OPKGBUILDCMD",d,1), pkg, pkgoutdir)) 419 d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir))
420 if ret != 0: 420 if ret != 0:
421 bb.utils.unlockfile(lf) 421 bb.utils.unlockfile(lf)
422 raise bb.build.FuncFailed("opkg-build execution failed") 422 raise bb.build.FuncFailed("opkg-build execution failed")
@@ -437,13 +437,13 @@ python do_package_write_ipk_setscene () {
437addtask do_package_write_ipk_setscene 437addtask do_package_write_ipk_setscene
438 438
439python () { 439python () {
440 if bb.data.getVar('PACKAGES', d, True) != '': 440 if d.getVar('PACKAGES', True) != '':
441 deps = (bb.data.getVarFlag('do_package_write_ipk', 'depends', d) or "").split() 441 deps = (d.getVarFlag('do_package_write_ipk', 'depends') or "").split()
442 deps.append('opkg-utils-native:do_populate_sysroot') 442 deps.append('opkg-utils-native:do_populate_sysroot')
443 deps.append('virtual/fakeroot-native:do_populate_sysroot') 443 deps.append('virtual/fakeroot-native:do_populate_sysroot')
444 bb.data.setVarFlag('do_package_write_ipk', 'depends', " ".join(deps), d) 444 bb.data.setVarFlag('do_package_write_ipk', 'depends', " ".join(deps), d)
445 bb.data.setVarFlag('do_package_write_ipk', 'fakeroot', "1", d) 445 d.setVarFlag('do_package_write_ipk', 'fakeroot', "1")
446 bb.data.setVarFlag('do_package_write_ipk_setscene', 'fakeroot', "1", d) 446 d.setVarFlag('do_package_write_ipk_setscene', 'fakeroot', "1")
447} 447}
448 448
449python do_package_write_ipk () { 449python do_package_write_ipk () {