summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-07 13:56:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 14:06:51 +0100
commit9ebcb981214f53f67036b35f088aee7599b7d8c4 (patch)
tree3aca36ac65ffc41e4bc8bb17290a591eb505f027 /meta/classes
parentc3d18afaa54fe81aef80e45ec3564f7318dd4966 (diff)
downloadpoky-9ebcb981214f53f67036b35f088aee7599b7d8c4.tar.gz
sanity.bbclass: Use open(), not file()
file() syntax is removed in python 3, use open() instead. (From OE-Core rev: b2d10f15db23246e3957b69d77433f87674928bb) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sanity.bbclass24
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 766e97e916..601ef1fb70 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -232,7 +232,7 @@ def check_create_long_filename(filepath, pathname):
232 try: 232 try:
233 if not os.path.exists(filepath): 233 if not os.path.exists(filepath):
234 bb.utils.mkdirhier(filepath) 234 bb.utils.mkdirhier(filepath)
235 f = file(testfile, "w") 235 f = open(testfile, "w")
236 f.close() 236 f.close()
237 os.remove(testfile) 237 os.remove(testfile)
238 except IOError as e: 238 except IOError as e:
@@ -339,7 +339,7 @@ def check_gcc_march(sanity_data):
339 if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0: 339 if sanity_data.getVar("BUILD_CFLAGS",True).find("-march") < 0:
340 340
341 # Construct a test file 341 # Construct a test file
342 f = file("gcc_test.c", "w") 342 f = open("gcc_test.c", "w")
343 f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n") 343 f.write("int main (){ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4; return 0;}\n")
344 f.close() 344 f.close()
345 import commands 345 import commands
@@ -561,7 +561,7 @@ def check_sanity(sanity_data):
561 last_sstate_dir = "" 561 last_sstate_dir = ""
562 sanityverfile = 'conf/sanity_info' 562 sanityverfile = 'conf/sanity_info'
563 if os.path.exists(sanityverfile): 563 if os.path.exists(sanityverfile):
564 f = file(sanityverfile, 'r') 564 f = open(sanityverfile, 'r')
565 for line in f: 565 for line in f:
566 if line.startswith('SANITY_VERSION'): 566 if line.startswith('SANITY_VERSION'):
567 last_sanity_version = int(line.split()[1]) 567 last_sanity_version = int(line.split()[1])
@@ -584,7 +584,7 @@ def check_sanity(sanity_data):
584 if last_sstate_dir != sstate_dir: 584 if last_sstate_dir != sstate_dir:
585 messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data) 585 messages = messages + check_sanity_sstate_dir_change(sstate_dir, sanity_data)
586 if os.path.exists("conf") and not messages: 586 if os.path.exists("conf") and not messages:
587 f = file(sanityverfile, 'w') 587 f = open(sanityverfile, 'w')
588 f.write("SANITY_VERSION %s\n" % sanity_version) 588 f.write("SANITY_VERSION %s\n" % sanity_version)
589 f.write("TMPDIR %s\n" % tmpdir) 589 f.write("TMPDIR %s\n" % tmpdir)
590 f.write("SSTATE_DIR %s\n" % sstate_dir) 590 f.write("SSTATE_DIR %s\n" % sstate_dir)
@@ -594,13 +594,13 @@ def check_sanity(sanity_data):
594 # 594 #
595 checkfile = os.path.join(tmpdir, "saved_tmpdir") 595 checkfile = os.path.join(tmpdir, "saved_tmpdir")
596 if os.path.exists(checkfile): 596 if os.path.exists(checkfile):
597 f = file(checkfile, "r") 597 f = open(checkfile, "r")
598 saved_tmpdir = f.read().strip() 598 saved_tmpdir = f.read().strip()
599 if (saved_tmpdir != tmpdir): 599 if (saved_tmpdir != tmpdir):
600 messages = messages + "Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir 600 messages = messages + "Error, TMPDIR has changed location. You need to either move it back to %s or rebuild\n" % saved_tmpdir
601 else: 601 else:
602 bb.utils.mkdirhier(tmpdir) 602 bb.utils.mkdirhier(tmpdir)
603 f = file(checkfile, "w") 603 f = open(checkfile, "w")
604 f.write(tmpdir) 604 f.write(tmpdir)
605 f.close() 605 f.close()
606 606
@@ -610,17 +610,17 @@ def check_sanity(sanity_data):
610 current_abi = sanity_data.getVar('OELAYOUT_ABI', True) 610 current_abi = sanity_data.getVar('OELAYOUT_ABI', True)
611 abifile = sanity_data.getVar('SANITY_ABIFILE', True) 611 abifile = sanity_data.getVar('SANITY_ABIFILE', True)
612 if os.path.exists(abifile): 612 if os.path.exists(abifile):
613 f = file(abifile, "r") 613 f = open(abifile, "r")
614 abi = f.read().strip() 614 abi = f.read().strip()
615 if not abi.isdigit(): 615 if not abi.isdigit():
616 f = file(abifile, "w") 616 f = open(abifile, "w")
617 f.write(current_abi) 617 f.write(current_abi)
618 elif abi == "2" and current_abi == "3": 618 elif abi == "2" and current_abi == "3":
619 bb.note("Converting staging from layout version 2 to layout version 3") 619 bb.note("Converting staging from layout version 2 to layout version 3")
620 subprocess.call(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"), shell=True) 620 subprocess.call(sanity_data.expand("mv ${TMPDIR}/staging ${TMPDIR}/sysroots"), shell=True)
621 subprocess.call(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"), shell=True) 621 subprocess.call(sanity_data.expand("ln -s sysroots ${TMPDIR}/staging"), shell=True)
622 subprocess.call(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done"), shell=True) 622 subprocess.call(sanity_data.expand("cd ${TMPDIR}/stamps; for i in */*do_populate_staging; do new=`echo $i | sed -e 's/do_populate_staging/do_populate_sysroot/'`; mv $i $new; done"), shell=True)
623 f = file(abifile, "w") 623 f = open(abifile, "w")
624 f.write(current_abi) 624 f.write(current_abi)
625 elif abi == "3" and current_abi == "4": 625 elif abi == "3" and current_abi == "4":
626 bb.note("Converting staging layout from version 3 to layout version 4") 626 bb.note("Converting staging layout from version 3 to layout version 4")
@@ -628,14 +628,14 @@ def check_sanity(sanity_data):
628 subprocess.call(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"), shell=True) 628 subprocess.call(sanity_data.expand("mv ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS} ${STAGING_BINDIR_CROSS}"), shell=True)
629 subprocess.call(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"), shell=True) 629 subprocess.call(sanity_data.expand("ln -s ${STAGING_BINDIR_CROSS} ${STAGING_DIR_NATIVE}${bindir_native}/${MULTIMACH_HOST_SYS}"), shell=True)
630 630
631 f = file(abifile, "w") 631 f = open(abifile, "w")
632 f.write(current_abi) 632 f.write(current_abi)
633 elif abi == "4": 633 elif abi == "4":
634 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n" 634 messages = messages + "Staging layout has changed. The cross directory has been deprecated and cross packages are now built under the native sysroot.\nThis requires a rebuild.\n"
635 elif abi == "5" and current_abi == "6": 635 elif abi == "5" and current_abi == "6":
636 bb.note("Converting staging layout from version 5 to layout version 6") 636 bb.note("Converting staging layout from version 5 to layout version 6")
637 subprocess.call(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"), shell=True) 637 subprocess.call(sanity_data.expand("mv ${TMPDIR}/pstagelogs ${SSTATE_MANIFESTS}"), shell=True)
638 f = file(abifile, "w") 638 f = open(abifile, "w")
639 f.write(current_abi) 639 f.write(current_abi)
640 elif abi == "7" and current_abi == "8": 640 elif abi == "7" and current_abi == "8":
641 messages = messages + "Your configuration is using stamp files including the sstate hash but your build directory was built with stamp files that do not include this.\nTo continue, either rebuild or switch back to the OEBasic signature handler with BB_SIGNATURE_HANDLER = 'OEBasic'.\n" 641 messages = messages + "Your configuration is using stamp files including the sstate hash but your build directory was built with stamp files that do not include this.\nTo continue, either rebuild or switch back to the OEBasic signature handler with BB_SIGNATURE_HANDLER = 'OEBasic'.\n"
@@ -645,7 +645,7 @@ def check_sanity(sanity_data):
645 # Code to convert from one ABI to another could go here if possible. 645 # Code to convert from one ABI to another could go here if possible.
646 messages = messages + "Error, TMPDIR has changed its layout version number (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi) 646 messages = messages + "Error, TMPDIR has changed its layout version number (%s to %s) and you need to either rebuild, revert or adjust it at your own risk.\n" % (abi, current_abi)
647 else: 647 else:
648 f = file(abifile, "w") 648 f = open(abifile, "w")
649 f.write(current_abi) 649 f.write(current_abi)
650 f.close() 650 f.close()
651 651