diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-03 10:59:25 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-05 10:22:56 -0800 |
commit | 06f2f8ce0a3093973ca54b48f542f8485b666079 (patch) | |
tree | dbcfa5c491eb2e5d237aa539cb7c6e77dc07dd6f /meta/classes/package_ipk.bbclass | |
parent | d01dadfb87cfd2284b3e849d35a35fe5df0239c4 (diff) | |
download | poky-06f2f8ce0a3093973ca54b48f542f8485b666079.tar.gz |
meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)
Using "1" with getVar is bad coding style and "True" is preferred.
This patch is a sed over the meta directory of the form:
sed \
-e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \
-e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \
-i `grep -ril getVar *`
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r-- | meta/classes/package_ipk.bbclass | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index e9d1ddcdbc..ff8b5b488a 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
@@ -15,12 +15,12 @@ python package_ipk_fn () { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | python package_ipk_install () { | 17 | python package_ipk_install () { |
18 | pkg = d.getVar('PKG', 1) | 18 | pkg = d.getVar('PKG', True) |
19 | pkgfn = d.getVar('PKGFN', 1) | 19 | pkgfn = d.getVar('PKGFN', True) |
20 | rootfs = d.getVar('IMAGE_ROOTFS', 1) | 20 | rootfs = d.getVar('IMAGE_ROOTFS', True) |
21 | ipkdir = d.getVar('DEPLOY_DIR_IPK', 1) | 21 | ipkdir = d.getVar('DEPLOY_DIR_IPK', True) |
22 | stagingdir = d.getVar('STAGING_DIR', 1) | 22 | stagingdir = d.getVar('STAGING_DIR', True) |
23 | tmpdir = d.getVar('TMPDIR', 1) | 23 | tmpdir = d.getVar('TMPDIR', True) |
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)") |
@@ -289,7 +289,7 @@ python do_package_ipk () { | |||
289 | 289 | ||
290 | localdata.setVar('ROOT', '') | 290 | localdata.setVar('ROOT', '') |
291 | localdata.setVar('ROOT_%s' % pkg, root) | 291 | localdata.setVar('ROOT_%s' % pkg, root) |
292 | pkgname = localdata.getVar('PKG_%s' % pkg, 1) | 292 | pkgname = localdata.getVar('PKG_%s' % pkg, True) |
293 | if not pkgname: | 293 | if not pkgname: |
294 | pkgname = pkg | 294 | pkgname = pkg |
295 | localdata.setVar('PKG', pkgname) | 295 | localdata.setVar('PKG', pkgname) |
@@ -298,7 +298,7 @@ python do_package_ipk () { | |||
298 | 298 | ||
299 | bb.data.update_data(localdata) | 299 | bb.data.update_data(localdata) |
300 | basedir = os.path.join(os.path.dirname(root)) | 300 | basedir = os.path.join(os.path.dirname(root)) |
301 | arch = localdata.getVar('PACKAGE_ARCH', 1) | 301 | arch = localdata.getVar('PACKAGE_ARCH', True) |
302 | pkgoutdir = "%s/%s" % (outdir, arch) | 302 | pkgoutdir = "%s/%s" % (outdir, arch) |
303 | bb.mkdirhier(pkgoutdir) | 303 | bb.mkdirhier(pkgoutdir) |
304 | os.chdir(root) | 304 | os.chdir(root) |
@@ -310,7 +310,7 @@ python do_package_ipk () { | |||
310 | except ValueError: | 310 | except ValueError: |
311 | pass | 311 | pass |
312 | if not g and localdata.getVar('ALLOW_EMPTY') != "1": | 312 | if not g and localdata.getVar('ALLOW_EMPTY') != "1": |
313 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', 1), localdata.getVar('PKGR', 1))) | 313 | bb.note("Not creating empty archive for %s-%s-%s" % (pkg, localdata.getVar('PKGV', True), localdata.getVar('PKGR', True))) |
314 | bb.utils.unlockfile(lf) | 314 | bb.utils.unlockfile(lf) |
315 | continue | 315 | continue |
316 | 316 | ||
@@ -323,7 +323,7 @@ python do_package_ipk () { | |||
323 | raise bb.build.FuncFailed("unable to open control file for writing.") | 323 | raise bb.build.FuncFailed("unable to open control file for writing.") |
324 | 324 | ||
325 | fields = [] | 325 | fields = [] |
326 | pe = d.getVar('PKGE', 1) | 326 | pe = d.getVar('PKGE', True) |
327 | if pe and int(pe) > 0: | 327 | if pe and int(pe) > 0: |
328 | fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) | 328 | fields.append(["Version: %s:%s-%s\n", ['PKGE', 'PKGV', 'PKGR']]) |
329 | else: | 329 | else: |
@@ -340,7 +340,7 @@ python do_package_ipk () { | |||
340 | def pullData(l, d): | 340 | def pullData(l, d): |
341 | l2 = [] | 341 | l2 = [] |
342 | for i in l: | 342 | for i in l: |
343 | l2.append(d.getVar(i, 1)) | 343 | l2.append(d.getVar(i, True)) |
344 | return l2 | 344 | return l2 |
345 | 345 | ||
346 | ctrlfile.write("Package: %s\n" % pkgname) | 346 | ctrlfile.write("Package: %s\n" % pkgname) |
@@ -369,12 +369,12 @@ python do_package_ipk () { | |||
369 | 369 | ||
370 | bb.build.exec_func("mapping_rename_hook", localdata) | 370 | bb.build.exec_func("mapping_rename_hook", localdata) |
371 | 371 | ||
372 | rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", 1) or "") | 372 | rdepends = bb.utils.explode_dep_versions(localdata.getVar("RDEPENDS", True) or "") |
373 | rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", 1) or "") | 373 | rrecommends = bb.utils.explode_dep_versions(localdata.getVar("RRECOMMENDS", True) or "") |
374 | rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", 1) or "") | 374 | rsuggests = bb.utils.explode_dep_versions(localdata.getVar("RSUGGESTS", True) or "") |
375 | rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", 1) or "") | 375 | rprovides = bb.utils.explode_dep_versions(localdata.getVar("RPROVIDES", True) or "") |
376 | rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", 1) or "") | 376 | rreplaces = bb.utils.explode_dep_versions(localdata.getVar("RREPLACES", True) or "") |
377 | rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", 1) or "") | 377 | rconflicts = bb.utils.explode_dep_versions(localdata.getVar("RCONFLICTS", True) or "") |
378 | 378 | ||
379 | if rdepends: | 379 | if rdepends: |
380 | ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends)) | 380 | ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends)) |
@@ -388,14 +388,14 @@ python do_package_ipk () { | |||
388 | ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) | 388 | ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) |
389 | if rconflicts: | 389 | if rconflicts: |
390 | ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) | 390 | ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) |
391 | src_uri = localdata.getVar("SRC_URI", 1) | 391 | src_uri = localdata.getVar("SRC_URI", True) |
392 | if src_uri: | 392 | if src_uri: |
393 | src_uri = re.sub("\s+", " ", src_uri) | 393 | src_uri = re.sub("\s+", " ", src_uri) |
394 | ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) | 394 | ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) |
395 | ctrlfile.close() | 395 | ctrlfile.close() |
396 | 396 | ||
397 | for script in ["preinst", "postinst", "prerm", "postrm"]: | 397 | for script in ["preinst", "postinst", "prerm", "postrm"]: |
398 | scriptvar = localdata.getVar('pkg_%s' % script, 1) | 398 | scriptvar = localdata.getVar('pkg_%s' % script, True) |
399 | if not scriptvar: | 399 | if not scriptvar: |
400 | continue | 400 | continue |
401 | try: | 401 | try: |
@@ -407,7 +407,7 @@ python do_package_ipk () { | |||
407 | scriptfile.close() | 407 | scriptfile.close() |
408 | os.chmod(os.path.join(controldir, script), 0755) | 408 | os.chmod(os.path.join(controldir, script), 0755) |
409 | 409 | ||
410 | conffiles_str = localdata.getVar("CONFFILES", 1) | 410 | conffiles_str = localdata.getVar("CONFFILES", True) |
411 | if conffiles_str: | 411 | if conffiles_str: |
412 | try: | 412 | try: |
413 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') | 413 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') |
@@ -419,7 +419,7 @@ python do_package_ipk () { | |||
419 | conffiles.close() | 419 | conffiles.close() |
420 | 420 | ||
421 | os.chdir(basedir) | 421 | os.chdir(basedir) |
422 | ret = os.system("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", 1), | 422 | ret = os.system("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True), |
423 | d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir)) | 423 | d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir)) |
424 | if ret != 0: | 424 | if ret != 0: |
425 | bb.utils.unlockfile(lf) | 425 | bb.utils.unlockfile(lf) |