diff options
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index d82e9bb55c..73cd88669a 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
| @@ -64,18 +64,18 @@ PATCH_GIT_USER_NAME ?= "OpenEmbedded" | |||
| 64 | # Write out metadata about this package for comparison when writing future packages | 64 | # Write out metadata about this package for comparison when writing future packages |
| 65 | # | 65 | # |
| 66 | python buildhistory_emit_pkghistory() { | 66 | python buildhistory_emit_pkghistory() { |
| 67 | if not d.getVar('BB_CURRENTTASK', True) in ['packagedata', 'packagedata_setscene']: | 67 | if not d.getVar('BB_CURRENTTASK') in ['packagedata', 'packagedata_setscene']: |
| 68 | return 0 | 68 | return 0 |
| 69 | 69 | ||
| 70 | if not "package" in (d.getVar('BUILDHISTORY_FEATURES', True) or "").split(): | 70 | if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): |
| 71 | return 0 | 71 | return 0 |
| 72 | 72 | ||
| 73 | import re | 73 | import re |
| 74 | import json | 74 | import json |
| 75 | import errno | 75 | import errno |
| 76 | 76 | ||
| 77 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | 77 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') |
| 78 | oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE', True) | 78 | oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') |
| 79 | 79 | ||
| 80 | class RecipeInfo: | 80 | class RecipeInfo: |
| 81 | def __init__(self, name): | 81 | def __init__(self, name): |
| @@ -182,12 +182,12 @@ python buildhistory_emit_pkghistory() { | |||
| 182 | items.sort() | 182 | items.sort() |
| 183 | return ' '.join(items) | 183 | return ' '.join(items) |
| 184 | 184 | ||
| 185 | pn = d.getVar('PN', True) | 185 | pn = d.getVar('PN') |
| 186 | pe = d.getVar('PE', True) or "0" | 186 | pe = d.getVar('PE') or "0" |
| 187 | pv = d.getVar('PV', True) | 187 | pv = d.getVar('PV') |
| 188 | pr = d.getVar('PR', True) | 188 | pr = d.getVar('PR') |
| 189 | 189 | ||
| 190 | pkgdata_dir = d.getVar('PKGDATA_DIR', True) | 190 | pkgdata_dir = d.getVar('PKGDATA_DIR') |
| 191 | packages = "" | 191 | packages = "" |
| 192 | try: | 192 | try: |
| 193 | with open(os.path.join(pkgdata_dir, pn)) as f: | 193 | with open(os.path.join(pkgdata_dir, pn)) as f: |
| @@ -203,7 +203,7 @@ python buildhistory_emit_pkghistory() { | |||
| 203 | raise | 203 | raise |
| 204 | 204 | ||
| 205 | packagelist = packages.split() | 205 | packagelist = packages.split() |
| 206 | preserve = d.getVar('BUILDHISTORY_PRESERVE', True).split() | 206 | preserve = d.getVar('BUILDHISTORY_PRESERVE').split() |
| 207 | if not os.path.exists(pkghistdir): | 207 | if not os.path.exists(pkghistdir): |
| 208 | bb.utils.mkdirhier(pkghistdir) | 208 | bb.utils.mkdirhier(pkghistdir) |
| 209 | else: | 209 | else: |
| @@ -223,11 +223,11 @@ python buildhistory_emit_pkghistory() { | |||
| 223 | rcpinfo.pe = pe | 223 | rcpinfo.pe = pe |
| 224 | rcpinfo.pv = pv | 224 | rcpinfo.pv = pv |
| 225 | rcpinfo.pr = pr | 225 | rcpinfo.pr = pr |
| 226 | rcpinfo.depends = sortlist(oe.utils.squashspaces(d.getVar('DEPENDS', True) or "")) | 226 | rcpinfo.depends = sortlist(oe.utils.squashspaces(d.getVar('DEPENDS') or "")) |
| 227 | rcpinfo.packages = packages | 227 | rcpinfo.packages = packages |
| 228 | write_recipehistory(rcpinfo, d) | 228 | write_recipehistory(rcpinfo, d) |
| 229 | 229 | ||
| 230 | pkgdest = d.getVar('PKGDEST', True) | 230 | pkgdest = d.getVar('PKGDEST') |
| 231 | for pkg in packagelist: | 231 | for pkg in packagelist: |
| 232 | pkgdata = {} | 232 | pkgdata = {} |
| 233 | with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: | 233 | with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: |
| @@ -293,7 +293,7 @@ python buildhistory_emit_pkghistory() { | |||
| 293 | def write_recipehistory(rcpinfo, d): | 293 | def write_recipehistory(rcpinfo, d): |
| 294 | bb.debug(2, "Writing recipe history") | 294 | bb.debug(2, "Writing recipe history") |
| 295 | 295 | ||
| 296 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | 296 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') |
| 297 | 297 | ||
| 298 | infofile = os.path.join(pkghistdir, "latest") | 298 | infofile = os.path.join(pkghistdir, "latest") |
| 299 | with open(infofile, "w") as f: | 299 | with open(infofile, "w") as f: |
| @@ -308,7 +308,7 @@ def write_recipehistory(rcpinfo, d): | |||
| 308 | def write_pkghistory(pkginfo, d): | 308 | def write_pkghistory(pkginfo, d): |
| 309 | bb.debug(2, "Writing package history for package %s" % pkginfo.name) | 309 | bb.debug(2, "Writing package history for package %s" % pkginfo.name) |
| 310 | 310 | ||
| 311 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | 311 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') |
| 312 | 312 | ||
| 313 | pkgpath = os.path.join(pkghistdir, pkginfo.name) | 313 | pkgpath = os.path.join(pkghistdir, pkginfo.name) |
| 314 | if not os.path.exists(pkgpath): | 314 | if not os.path.exists(pkgpath): |
| @@ -369,7 +369,7 @@ def buildhistory_list_installed(d, rootfs_type="image"): | |||
| 369 | pkgs = sdk_list_installed_packages(d, rootfs_type == "sdk_target") | 369 | pkgs = sdk_list_installed_packages(d, rootfs_type == "sdk_target") |
| 370 | 370 | ||
| 371 | for output_type, output_file in process_list: | 371 | for output_type, output_file in process_list: |
| 372 | output_file_full = os.path.join(d.getVar('WORKDIR', True), output_file) | 372 | output_file_full = os.path.join(d.getVar('WORKDIR'), output_file) |
| 373 | 373 | ||
| 374 | with open(output_file_full, 'w') as output: | 374 | with open(output_file_full, 'w') as output: |
| 375 | output.write(format_pkg_list(pkgs, output_type)) | 375 | output.write(format_pkg_list(pkgs, output_type)) |
| @@ -550,7 +550,7 @@ END | |||
| 550 | python buildhistory_get_extra_sdkinfo() { | 550 | python buildhistory_get_extra_sdkinfo() { |
| 551 | import operator | 551 | import operator |
| 552 | import math | 552 | import math |
| 553 | if d.getVar('BB_CURRENTTASK', True) == 'populate_sdk_ext': | 553 | if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext': |
| 554 | tasksizes = {} | 554 | tasksizes = {} |
| 555 | filesizes = {} | 555 | filesizes = {} |
| 556 | for root, _, files in os.walk(d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')): | 556 | for root, _, files in os.walk(d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache')): |
| @@ -591,7 +591,7 @@ SDK_POSTPROCESS_COMMAND_append = " buildhistory_get_sdkinfo ; buildhistory_get_e | |||
| 591 | SDK_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; " | 591 | SDK_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_sdkinfo ; buildhistory_get_extra_sdkinfo; " |
| 592 | 592 | ||
| 593 | def buildhistory_get_build_id(d): | 593 | def buildhistory_get_build_id(d): |
| 594 | if d.getVar('BB_WORKERCONTEXT', True) != '1': | 594 | if d.getVar('BB_WORKERCONTEXT') != '1': |
| 595 | return "" | 595 | return "" |
| 596 | localdata = bb.data.createCopy(d) | 596 | localdata = bb.data.createCopy(d) |
| 597 | bb.data.update_data(localdata) | 597 | bb.data.update_data(localdata) |
| @@ -605,12 +605,12 @@ def buildhistory_get_build_id(d): | |||
| 605 | if flines: | 605 | if flines: |
| 606 | statuslines.extend(flines) | 606 | statuslines.extend(flines) |
| 607 | 607 | ||
| 608 | statusheader = d.getVar('BUILDCFG_HEADER', True) | 608 | statusheader = d.getVar('BUILDCFG_HEADER') |
| 609 | return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) | 609 | return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) |
| 610 | 610 | ||
| 611 | def buildhistory_get_metadata_revs(d): | 611 | def buildhistory_get_metadata_revs(d): |
| 612 | # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want | 612 | # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want |
| 613 | layers = (d.getVar("BBLAYERS", True) or "").split() | 613 | layers = (d.getVar("BBLAYERS") or "").split() |
| 614 | medadata_revs = ["%-17s = %s:%s" % (os.path.basename(i), \ | 614 | medadata_revs = ["%-17s = %s:%s" % (os.path.basename(i), \ |
| 615 | base_get_metadata_git_branch(i, None).strip(), \ | 615 | base_get_metadata_git_branch(i, None).strip(), \ |
| 616 | base_get_metadata_git_revision(i, None)) \ | 616 | base_get_metadata_git_revision(i, None)) \ |
| @@ -622,7 +622,7 @@ def outputvars(vars, listvars, d): | |||
| 622 | listvars = listvars.split() | 622 | listvars = listvars.split() |
| 623 | ret = "" | 623 | ret = "" |
| 624 | for var in vars: | 624 | for var in vars: |
| 625 | value = d.getVar(var, True) or "" | 625 | value = d.getVar(var) or "" |
| 626 | if var in listvars: | 626 | if var in listvars: |
| 627 | # Squash out spaces | 627 | # Squash out spaces |
| 628 | value = oe.utils.squashspaces(value) | 628 | value = oe.utils.squashspaces(value) |
| @@ -630,17 +630,17 @@ def outputvars(vars, listvars, d): | |||
| 630 | return ret.rstrip('\n') | 630 | return ret.rstrip('\n') |
| 631 | 631 | ||
| 632 | def buildhistory_get_imagevars(d): | 632 | def buildhistory_get_imagevars(d): |
| 633 | if d.getVar('BB_WORKERCONTEXT', True) != '1': | 633 | if d.getVar('BB_WORKERCONTEXT') != '1': |
| 634 | return "" | 634 | return "" |
| 635 | imagevars = "DISTRO DISTRO_VERSION USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE ROOTFS_POSTPROCESS_COMMAND IMAGE_POSTPROCESS_COMMAND" | 635 | imagevars = "DISTRO DISTRO_VERSION USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE ROOTFS_POSTPROCESS_COMMAND IMAGE_POSTPROCESS_COMMAND" |
| 636 | listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS PACKAGE_EXCLUDE" | 636 | listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS PACKAGE_EXCLUDE" |
| 637 | return outputvars(imagevars, listvars, d) | 637 | return outputvars(imagevars, listvars, d) |
| 638 | 638 | ||
| 639 | def buildhistory_get_sdkvars(d): | 639 | def buildhistory_get_sdkvars(d): |
| 640 | if d.getVar('BB_WORKERCONTEXT', True) != '1': | 640 | if d.getVar('BB_WORKERCONTEXT') != '1': |
| 641 | return "" | 641 | return "" |
| 642 | sdkvars = "DISTRO DISTRO_VERSION SDK_NAME SDK_VERSION SDKMACHINE SDKIMAGE_FEATURES BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE" | 642 | sdkvars = "DISTRO DISTRO_VERSION SDK_NAME SDK_VERSION SDKMACHINE SDKIMAGE_FEATURES BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE" |
| 643 | if d.getVar('BB_CURRENTTASK', True) == 'populate_sdk_ext': | 643 | if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext': |
| 644 | # Extensible SDK uses some additional variables | 644 | # Extensible SDK uses some additional variables |
| 645 | sdkvars += " SDK_LOCAL_CONF_WHITELIST SDK_LOCAL_CONF_BLACKLIST SDK_INHERIT_BLACKLIST SDK_UPDATE_URL SDK_EXT_TYPE SDK_RECRDEP_TASKS SDK_INCLUDE_PKGDATA SDK_INCLUDE_TOOLCHAIN" | 645 | sdkvars += " SDK_LOCAL_CONF_WHITELIST SDK_LOCAL_CONF_BLACKLIST SDK_INHERIT_BLACKLIST SDK_UPDATE_URL SDK_EXT_TYPE SDK_RECRDEP_TASKS SDK_INCLUDE_PKGDATA SDK_INCLUDE_TOOLCHAIN" |
| 646 | listvars = "SDKIMAGE_FEATURES BAD_RECOMMENDATIONS PACKAGE_EXCLUDE SDK_LOCAL_CONF_WHITELIST SDK_LOCAL_CONF_BLACKLIST SDK_INHERIT_BLACKLIST" | 646 | listvars = "SDKIMAGE_FEATURES BAD_RECOMMENDATIONS PACKAGE_EXCLUDE SDK_LOCAL_CONF_WHITELIST SDK_LOCAL_CONF_BLACKLIST SDK_INHERIT_BLACKLIST" |
| @@ -735,16 +735,16 @@ END | |||
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | python buildhistory_eventhandler() { | 737 | python buildhistory_eventhandler() { |
| 738 | if e.data.getVar('BUILDHISTORY_FEATURES', True).strip(): | 738 | if e.data.getVar('BUILDHISTORY_FEATURES').strip(): |
| 739 | reset = e.data.getVar("BUILDHISTORY_RESET", True) | 739 | reset = e.data.getVar("BUILDHISTORY_RESET") |
| 740 | olddir = e.data.getVar("BUILDHISTORY_OLD_DIR", True) | 740 | olddir = e.data.getVar("BUILDHISTORY_OLD_DIR") |
| 741 | if isinstance(e, bb.event.BuildStarted): | 741 | if isinstance(e, bb.event.BuildStarted): |
| 742 | if reset: | 742 | if reset: |
| 743 | import shutil | 743 | import shutil |
| 744 | # Clean up after potentially interrupted build. | 744 | # Clean up after potentially interrupted build. |
| 745 | if os.path.isdir(olddir): | 745 | if os.path.isdir(olddir): |
| 746 | shutil.rmtree(olddir) | 746 | shutil.rmtree(olddir) |
| 747 | rootdir = e.data.getVar("BUILDHISTORY_DIR", True) | 747 | rootdir = e.data.getVar("BUILDHISTORY_DIR") |
| 748 | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] | 748 | entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] |
| 749 | bb.utils.mkdirhier(olddir) | 749 | bb.utils.mkdirhier(olddir) |
| 750 | for entry in entries: | 750 | for entry in entries: |
| @@ -754,7 +754,7 @@ python buildhistory_eventhandler() { | |||
| 754 | if reset: | 754 | if reset: |
| 755 | import shutil | 755 | import shutil |
| 756 | shutil.rmtree(olddir) | 756 | shutil.rmtree(olddir) |
| 757 | if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1": | 757 | if e.data.getVar("BUILDHISTORY_COMMIT") == "1": |
| 758 | bb.note("Writing buildhistory") | 758 | bb.note("Writing buildhistory") |
| 759 | localdata = bb.data.createCopy(e.data) | 759 | localdata = bb.data.createCopy(e.data) |
| 760 | localdata.setVar('BUILDHISTORY_BUILD_FAILURES', str(e._failures)) | 760 | localdata.setVar('BUILDHISTORY_BUILD_FAILURES', str(e._failures)) |
| @@ -774,7 +774,7 @@ def _get_srcrev_values(d): | |||
| 774 | """ | 774 | """ |
| 775 | 775 | ||
| 776 | scms = [] | 776 | scms = [] |
| 777 | fetcher = bb.fetch.Fetch(d.getVar('SRC_URI', True).split(), d) | 777 | fetcher = bb.fetch.Fetch(d.getVar('SRC_URI').split(), d) |
| 778 | urldata = fetcher.ud | 778 | urldata = fetcher.ud |
| 779 | for u in urldata: | 779 | for u in urldata: |
| 780 | if urldata[u].method.supports_srcrev(): | 780 | if urldata[u].method.supports_srcrev(): |
| @@ -806,7 +806,7 @@ def _get_srcrev_values(d): | |||
| 806 | do_fetch[postfuncs] += "write_srcrev" | 806 | do_fetch[postfuncs] += "write_srcrev" |
| 807 | do_fetch[vardepsexclude] += "write_srcrev" | 807 | do_fetch[vardepsexclude] += "write_srcrev" |
| 808 | python write_srcrev() { | 808 | python write_srcrev() { |
| 809 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | 809 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') |
| 810 | srcrevfile = os.path.join(pkghistdir, 'latest_srcrev') | 810 | srcrevfile = os.path.join(pkghistdir, 'latest_srcrev') |
| 811 | 811 | ||
| 812 | srcrevs, tag_srcrevs = _get_srcrev_values(d) | 812 | srcrevs, tag_srcrevs = _get_srcrev_values(d) |
| @@ -838,7 +838,7 @@ python write_srcrev() { | |||
| 838 | for name, srcrev in tag_srcrevs.items(): | 838 | for name, srcrev in tag_srcrevs.items(): |
| 839 | f.write('# tag_%s = "%s"\n' % (name, srcrev)) | 839 | f.write('# tag_%s = "%s"\n' % (name, srcrev)) |
| 840 | if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev: | 840 | if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev: |
| 841 | pkg = d.getVar('PN', True) | 841 | pkg = d.getVar('PN') |
| 842 | bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev)) | 842 | bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev)) |
| 843 | 843 | ||
| 844 | else: | 844 | else: |
