diff options
| -rw-r--r-- | meta/classes/base.bbclass | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 5067dfbea0..ed0fced858 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
| @@ -85,7 +85,7 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data): | |||
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | def base_dep_prepend(d): | 87 | def base_dep_prepend(d): |
| 88 | import bb; | 88 | import bb |
| 89 | # | 89 | # |
| 90 | # Ideally this will check a flag so we will operate properly in | 90 | # Ideally this will check a flag so we will operate properly in |
| 91 | # the case where host == build == target, for now we don't work in | 91 | # the case where host == build == target, for now we don't work in |
| @@ -128,6 +128,14 @@ def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): | |||
| 128 | else: | 128 | else: |
| 129 | return falsevalue | 129 | return falsevalue |
| 130 | 130 | ||
| 131 | def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): | ||
| 132 | import bb | ||
| 133 | result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) | ||
| 134 | if result <= 0: | ||
| 135 | return truevalue | ||
| 136 | else: | ||
| 137 | return falsevalue | ||
| 138 | |||
| 131 | def base_contains(variable, checkvalues, truevalue, falsevalue, d): | 139 | def base_contains(variable, checkvalues, truevalue, falsevalue, d): |
| 132 | import bb | 140 | import bb |
| 133 | matches = 0 | 141 | matches = 0 |
| @@ -405,7 +413,6 @@ python do_listtasks() { | |||
| 405 | addtask clean | 413 | addtask clean |
| 406 | do_clean[dirs] = "${TOPDIR}" | 414 | do_clean[dirs] = "${TOPDIR}" |
| 407 | do_clean[nostamp] = "1" | 415 | do_clean[nostamp] = "1" |
| 408 | do_clean[bbdepcmd] = "" | ||
| 409 | python base_do_clean() { | 416 | python base_do_clean() { |
| 410 | """clear the build and temp directories""" | 417 | """clear the build and temp directories""" |
| 411 | dir = bb.data.expand("${WORKDIR}", d) | 418 | dir = bb.data.expand("${WORKDIR}", d) |
| @@ -418,27 +425,24 @@ python base_do_clean() { | |||
| 418 | os.system('rm -f '+ dir) | 425 | os.system('rm -f '+ dir) |
| 419 | } | 426 | } |
| 420 | 427 | ||
| 428 | addtask rebuild after do_${BB_DEFAULT_TASK} | ||
| 421 | addtask rebuild | 429 | addtask rebuild |
| 422 | do_rebuild[dirs] = "${TOPDIR}" | 430 | do_rebuild[dirs] = "${TOPDIR}" |
| 423 | do_rebuild[nostamp] = "1" | 431 | do_rebuild[nostamp] = "1" |
| 424 | do_rebuild[bbdepcmd] = "" | ||
| 425 | python base_do_rebuild() { | 432 | python base_do_rebuild() { |
| 426 | """rebuild a package""" | 433 | """rebuild a package""" |
| 427 | bb.build.exec_task('do_clean', d) | ||
| 428 | bb.build.exec_task('do_' + bb.data.getVar('BB_DEFAULT_TASK', d, 1), d) | ||
| 429 | } | 434 | } |
| 430 | 435 | ||
| 431 | addtask mrproper | 436 | addtask mrproper |
| 432 | do_mrproper[dirs] = "${TOPDIR}" | 437 | do_mrproper[dirs] = "${TOPDIR}" |
| 433 | do_mrproper[nostamp] = "1" | 438 | do_mrproper[nostamp] = "1" |
| 434 | do_mrproper[bbdepcmd] = "" | ||
| 435 | python base_do_mrproper() { | 439 | python base_do_mrproper() { |
| 436 | """clear downloaded sources, build and temp directories""" | 440 | """clear downloaded sources, build and temp directories""" |
| 437 | dir = bb.data.expand("${DL_DIR}", d) | 441 | dir = bb.data.expand("${DL_DIR}", d) |
| 438 | if dir == '/': bb.build.FuncFailed("wrong DATADIR") | 442 | if dir == '/': bb.build.FuncFailed("wrong DATADIR") |
| 439 | bb.debug(2, "removing " + dir) | 443 | bb.debug(2, "removing " + dir) |
| 440 | os.system('rm -rf ' + dir) | 444 | os.system('rm -rf ' + dir) |
| 441 | bb.build.exec_task('do_clean', d) | 445 | bb.build.exec_func('do_clean', d) |
| 442 | } | 446 | } |
| 443 | 447 | ||
| 444 | addtask fetch | 448 | addtask fetch |
| @@ -532,7 +536,7 @@ def oe_unpack_file(file, data, url = None): | |||
| 532 | cmd = 'tar x --no-same-owner -f %s' % file | 536 | cmd = 'tar x --no-same-owner -f %s' % file |
| 533 | elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'): | 537 | elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'): |
| 534 | cmd = 'tar xz --no-same-owner -f %s' % file | 538 | cmd = 'tar xz --no-same-owner -f %s' % file |
| 535 | elif file.endswith('.tbz') or file.endswith('.tar.bz2'): | 539 | elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'): |
| 536 | cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file | 540 | cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file |
| 537 | elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): | 541 | elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): |
| 538 | cmd = 'gzip -dc %s > %s' % (file, efile) | 542 | cmd = 'gzip -dc %s > %s' % (file, efile) |
| @@ -673,6 +677,17 @@ python base_eventhandler() { | |||
| 673 | if pesteruser: | 677 | if pesteruser: |
| 674 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) | 678 | bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) |
| 675 | 679 | ||
| 680 | # | ||
| 681 | # Handle removing stamps for 'rebuild' task | ||
| 682 | # | ||
| 683 | if name.startswith("StampUpdate"): | ||
| 684 | for (fn, task) in e.targets: | ||
| 685 | #print "%s %s" % (task, fn) | ||
| 686 | if task == "do_rebuild": | ||
| 687 | dir = "%s.*" % e.stampPrefix[fn] | ||
| 688 | bb.note("Removing stamps: " + dir) | ||
| 689 | os.system('rm -f '+ dir) | ||
| 690 | |||
| 676 | if not data in e.__dict__: | 691 | if not data in e.__dict__: |
| 677 | return NotHandled | 692 | return NotHandled |
| 678 | 693 | ||
| @@ -687,7 +702,6 @@ python base_eventhandler() { | |||
| 687 | 702 | ||
| 688 | addtask configure after do_unpack do_patch | 703 | addtask configure after do_unpack do_patch |
| 689 | do_configure[dirs] = "${S} ${B}" | 704 | do_configure[dirs] = "${S} ${B}" |
| 690 | do_configure[bbdepcmd] = "do_populate_staging" | ||
| 691 | do_configure[deptask] = "do_populate_staging" | 705 | do_configure[deptask] = "do_populate_staging" |
| 692 | base_do_configure() { | 706 | base_do_configure() { |
| 693 | : | 707 | : |
| @@ -695,7 +709,6 @@ base_do_configure() { | |||
| 695 | 709 | ||
| 696 | addtask compile after do_configure | 710 | addtask compile after do_configure |
| 697 | do_compile[dirs] = "${S} ${B}" | 711 | do_compile[dirs] = "${S} ${B}" |
| 698 | do_compile[bbdepcmd] = "do_populate_staging" | ||
| 699 | base_do_compile() { | 712 | base_do_compile() { |
| 700 | if [ -e Makefile -o -e makefile ]; then | 713 | if [ -e Makefile -o -e makefile ]; then |
| 701 | oe_runmake || die "make failed" | 714 | oe_runmake || die "make failed" |
| @@ -826,6 +839,20 @@ python read_subpackage_metadata () { | |||
| 826 | bb.data.setVar(key, sdata[key], d) | 839 | bb.data.setVar(key, sdata[key], d) |
| 827 | } | 840 | } |
| 828 | 841 | ||
| 842 | # Make sure MACHINE isn't exported | ||
| 843 | # (breaks binutils at least) | ||
| 844 | MACHINE[unexport] = "1" | ||
| 845 | |||
| 846 | # Make sure TARGET_ARCH isn't exported | ||
| 847 | # (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this | ||
| 848 | # in them, undocumented) | ||
| 849 | TARGET_ARCH[unexport] = "1" | ||
| 850 | |||
| 851 | # Make sure DISTRO isn't exported | ||
| 852 | # (breaks sysvinit at least) | ||
| 853 | DISTRO[unexport] = "1" | ||
| 854 | |||
| 855 | |||
| 829 | def base_after_parse(d): | 856 | def base_after_parse(d): |
| 830 | import bb, os, exceptions | 857 | import bb, os, exceptions |
| 831 | 858 | ||
| @@ -845,8 +872,6 @@ def base_after_parse(d): | |||
| 845 | if this_machine and not re.match(need_machine, this_machine): | 872 | if this_machine and not re.match(need_machine, this_machine): |
| 846 | raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine) | 873 | raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine) |
| 847 | 874 | ||
| 848 | |||
| 849 | |||
| 850 | pn = bb.data.getVar('PN', d, 1) | 875 | pn = bb.data.getVar('PN', d, 1) |
| 851 | 876 | ||
| 852 | # OBSOLETE in bitbake 1.7.4 | 877 | # OBSOLETE in bitbake 1.7.4 |
| @@ -858,16 +883,6 @@ def base_after_parse(d): | |||
| 858 | if use_nls != None: | 883 | if use_nls != None: |
| 859 | bb.data.setVar('USE_NLS', use_nls, d) | 884 | bb.data.setVar('USE_NLS', use_nls, d) |
| 860 | 885 | ||
| 861 | # Make sure MACHINE isn't exported | ||
| 862 | # (breaks binutils at least) | ||
| 863 | bb.data.delVarFlag('MACHINE', 'export', d) | ||
| 864 | bb.data.setVarFlag('MACHINE', 'unexport', 1, d) | ||
| 865 | |||
| 866 | # Make sure DISTRO isn't exported | ||
| 867 | # (breaks sysvinit at least) | ||
| 868 | bb.data.delVarFlag('DISTRO', 'export', d) | ||
| 869 | bb.data.setVarFlag('DISTRO', 'unexport', 1, d) | ||
| 870 | |||
| 871 | # Git packages should DEPEND on git-native | 886 | # Git packages should DEPEND on git-native |
| 872 | srcuri = bb.data.getVar('SRC_URI', d, 1) | 887 | srcuri = bb.data.getVar('SRC_URI', d, 1) |
| 873 | if "git://" in srcuri: | 888 | if "git://" in srcuri: |
| @@ -897,7 +912,7 @@ def base_after_parse(d): | |||
| 897 | if len(paths) == 0: | 912 | if len(paths) == 0: |
| 898 | return | 913 | return |
| 899 | 914 | ||
| 900 | for s in bb.data.getVar('SRC_URI', d, 1).split(): | 915 | for s in srcuri.split(): |
| 901 | if not s.startswith("file://"): | 916 | if not s.startswith("file://"): |
| 902 | continue | 917 | continue |
| 903 | local = bb.data.expand(bb.fetch.localpath(s, d), d) | 918 | local = bb.data.expand(bb.fetch.localpath(s, d), d) |
